Quick Answer The use of previous value as a function in a rule does not always do what a user might expect. In reality it shows the previous value at the point of the previous sample. This means that if at the point of the last sample the value was unchanged then previous and current would be equal. Users sometime imagine that the previous value actually means the previous different value. |
Another way is to use the rate function which will calculate the value change per second and continues to exist as a number until next sample, which makes it more easy to make your calculations. Now take that number and multiply it by the sampling rate in seconds and you've got the actual change in number. Place it in new column, calculate further with it etc. Both PrevValue and Change are directly calculated from the current Value cell but they could all be combined for subtraction. PrevValue:
Change:
|
Rule Block
<ruleGroup name="PreviousValue">
<rule name="PrevValue">
<targets>
<target>/geneos/gateway/directory/probe/managedEntity/sampler[(@name="Random")]/dataview[(@name="Random")]/rows/row/cell[(@column="PrevValue")]</target>
</targets>
<priority>1</priority>
<pathAliases>
<pathAlias name="current">../cell[(@column="Value")]</pathAlias>
<pathAlias name="sampler">ancestor-or-self::sampler</pathAlias>
</pathAliases>
<block>
<transaction>
<update>
<property>@value</property>
<subtract>
<dataItem>
<pathAlias ref="current"></pathAlias>
<property>@value</property>
</dataItem>
<multiply>
<rate>
<dataItem>
<pathAlias ref="current"></pathAlias>
<property>@value</property>
</dataItem>
</rate>
<dataItem>
<pathAlias ref="sampler"></pathAlias>
<property>parameters/@SampleInterval</property>
</dataItem>
</multiply>
</subtract>
</update>
</transaction>
</block>
</rule>
<rule name="Change">
<targets>
<target>/geneos/gateway/directory/probe/managedEntity/sampler[(@name="Random")]/dataview[(@name="Random")]/rows/row/cell[(@column="Change")]</target>
</targets>
<priority>1</priority>
<pathAliases>
<pathAlias name="current">../cell[(@column="Value")]</pathAlias>
<pathAlias name="sampler">ancestor-or-self::sampler</pathAlias>
</pathAliases>
<block>
<transaction>
<update>
<property>@value</property>
<multiply>
<rate>
<dataItem>
<pathAlias ref="current"></pathAlias>
<property>@value</property>
</dataItem>
</rate>
<dataItem>
<pathAlias ref="sampler"></pathAlias>
<property>parameters/@SampleInterval</property>
</dataItem>
</multiply>
</update>
</transaction>
</block>
</rule>
</ruleGroup>
Comments
1 comment
Good workaround as long as you don't intend to manually sample your view as the author mentioned.
Please sign in to leave a comment.