Symptoms

Operations Automation shows incorrect resource usage for counter resources.

Moreover, even though backend returns the same value, usage displayed by Operations Automation is different after each run of the "Synchronize resource usage for instances of APS applications" task.

Typically it fluctuates between 0 and double of the actual value.

Cause

Running updateResource($this) inside retrieve() function.

Both retrieve() and updateResource() functions when they change counter fields in a resource report resource usage to Operations Automation in terms of difference with current value. Actual usage recalculation will happen only after retrieve() completes, so if you run updateResource($this) inside retrieve(), double difference will be reported.

Resolution

Remove updateResource() calls to the same APS resource you calculate counters for from your retrieve() function.

It is sufficient to only update counters fields on $this object. It will be returned to controller by the retrieve() function and it is sufficient to update the usage values.

An example is available in the Resource Consumption Monitoring demo project.

Internal content