×
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:
- 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>
- 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>
- 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="TRAINING_LAB_544823731")]/directory/probe[(@name="np_lab1")]/managedEntity[(@name="TRAINING1")]/sampler[(@name="CPU")][(@type="Infrastructure Defaults")]/dataview[(@name="CPU")]/headlines/cell[(@name="Hourly Average")]</target>
</targets>
<priority>1</priority>
<pathAliases>
<pathAlias name="sourceCell">/geneos/gateway[(@name="TRAINING_LAB_544823731")]/directory/probe[(@name="np_lab1")]/managedEntity[(@name="TRAINING1")]/sampler[(@name="CPU")][(@type="Infrastructure Defaults")]/dataview[(@name="CPU")]/rows/row[(@name="Average_cpu")]/cell[(@column="percentUtilisation")]</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"]