Back to Geneos FAQ

How can I create a rolling average for a given metric?

You can use the compute engine and history periods to create a rolling average for any given metric. Details of how to do this are shown below:

  1. The first thing you need to do is add a cell or headline that will retain the average value. To do this, you need to use the dataviews section under the advanced section of the sampler. We are using a sampler called CPU, which uses a CPU plugin:
<sampler name="CPU">
    <var-group>
        <data>Hardware</data>
    </var-group>
    <plugin>
        <cpu></cpu>
    </plugin>
    <dataviews>
        <dataview name="CPU">
            <additions>
                <var-headlines>
                    <data>
                        <headline>
                            <data>Hourly Average</data>
                        </headline>
                    </data>
                </var-headlines>
            </additions>
        </dataview>
    </dataviews>
</sampler>
  1. You then need to add a history period over which you want to collect an average. This is added to the rules section of the setup, here is an example:
 <historyPeriod name="1 hour">
    <calculationPeriod>
        <rollingPeriod>
            <measure>hour</measure>
            <length>1</length>
        </rollingPeriod>
    </calculationPeriod>
</historyPeriod>
  1. Within a rule you can now add a value to the cell you created in the first step using rule syntax like below:
<rule name="Example History period">
    <targets>
        <target>/geneos/gateway[(@name=&quot;TRAINING_LAB_544823731&quot;)]/directory/probe[(@name=&quot;np_lab1&quot;)]/managedEntity[(@name=&quot;TRAINING1&quot;)]/sampler[(@name=&quot;CPU&quot;)][(@type=&quot;Infrastructure Defaults&quot;)]/dataview[(@name=&quot;CPU&quot;)]/headlines/cell[(@name=&quot;Hourly Average&quot;)]</target>
    </targets>
    <priority>1</priority>
    <pathAliases>
        <pathAlias name="sourceCell">/geneos/gateway[(@name=&quot;TRAINING_LAB_544823731&quot;)]/directory/probe[(@name=&quot;np_lab1&quot;)]/managedEntity[(@name=&quot;TRAINING1&quot;)]/sampler[(@name=&quot;CPU&quot;)][(@type=&quot;Infrastructure Defaults&quot;)]/dataview[(@name=&quot;CPU&quot;)]/rows/row[(@name=&quot;Average_cpu&quot;)]/cell[(@column=&quot;percentUtilisation&quot;)]</pathAlias>
    </pathAliases>
    <block>
        <transaction>
            <update>
                <property>@value</property>
                <average>
                    <historicalDataItem>
                        <pathAlias ref="sourceCell"></pathAlias>
                        <property>@value</property>
                        <historyPeriod ref="1 hour"></historyPeriod>
                    </historicalDataItem>
                </average>
            </update>
        </transaction>
    </block>
</rule>
["Geneos"] ["Geneos > Gateway"] ["FAQ"]

Was this topic helpful?