Average Graph from Single Value from Script

If you figure out how to do something interesting/cool in Cacti and want to share it with the community, please post your experience here.

Moderators: Developers, Moderators

Post Reply
Katoomba
Posts: 3
Joined: Mon Mar 28, 2022 3:18 pm

Average Graph from Single Value from Script

Post by Katoomba »

I have a perl script that outputs an integer value that is pulled from the National Weather Service temperature for given latitude/longitude coordinates.
I also have a working Data Input Method that pulls the data from the script and I have a graph template that works as well. The end result is a graph that shows the current temperature value as well as the minimum, maximum and average which are shown in the legend. It all works very nicely.

But I also want a graph of the average temperature. I have not been unable to figure out how to do this.

On careful examination of all data sources that provide averages, it turns out that they get their average value from the underlying script or SNMP OID. So there are no examples that show cacti doing the work of calculating an average using a single value coming from a data input method.

However, it seems to me to be a perfectly reasonable ask that cacti take the data that it is collecting and turn it into an average that can then be used to generate average graphs.
I mean, the legend shows an average so why can't the graph itself? Setting the CF Type to "AVERAGE" in one of the graph items in the graph template results in what appears to be a "LAST" graph. Probably because the averaging is happening to exactly one data point.

In other word, how can I create a moving average graph from a single data point sourced from a data input method?

Any help provided will be very much appreciated.

/Katoomba
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests