Hello,
I'm a complete newbie with rrdtool. is it possible to get the average value of a rrd file with rrdtool? For example I have for each server a SRV_CPU.rrd. Could I get the average CPU from this rrd file for a time interval of a month? How would I do this?
I made a feature request for this to get the average value of a service. http://tracker.nagios.com/view.php?id=521
But as my management wants to see this earlier than you guys will be able to implement this, I was thinking about trying this myself. But is this possible with the Nagios rrd files in /usr/local/nagios/share/perfdata?
Grtz
Willem
Getting averages for a month from rrd files.
Getting averages for a month from rrd files.
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net
Re: Getting averages for a month from rrd files.
I'm not extremely well-versed in rrdtool, but I think this is close to what you want:
rrdtool fetch /usr/local/nagios/share/perfdata/<HOST>/<SERVICE>.rrd AVERAGE -30d
Should give you the last 30 days. Going to be a lot of lines, just to warn you.
rrdtool fetch /usr/local/nagios/share/perfdata/<HOST>/<SERVICE>.rrd AVERAGE -30d
Should give you the last 30 days. Going to be a lot of lines, just to warn you.
Former Nagios employee
Re: Getting averages for a month from rrd files.
Alright, you can do this with rrdtool and the PRINT command:
cd into an rrd folder located in:
cd /usr/local/nagios/share/perfdata/<host>/
To get a one month average of ping times:
Output:
The breakdown of the command above:
cd into an rrd folder located in:
cd /usr/local/nagios/share/perfdata/<host>/
To get a one month average of ping times:
Code: Select all
rrdtool graph dummy -s -1month -e start+1month DEF:test=_HOST_.rrd:1:AVERAGE PRINT:test:AVERAGE:'average - %.0lf'Code: Select all
0x0
average - 87Code: Select all
rrdtool graph <dummy filename> -s <start time> -e <endtime> DEF:<var name(anything you want)>=<rrd>:<datasource name>:AVERAGE PRINT:<var name>:AVERAGE:'average - %.0lf'Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Getting averages for a month from rrd files.
Hello,
This seems to work as expected!
Now I just need to write a bash script that wil loop through all hosts in /usr/local/nagios/share/perfdata and if it finds SRV_CPU, write the value to a file. Can you please leave the thread open for a while in case I would need some help.. 
Thanks you very much all for the help. (again)
Willem
This seems to work as expected!
Code: Select all
rrdtool graph dummy -s -1month -e start+1month DEF:test=SRV_CPU.rrd:1:AVERAGE PRINT:test:AVERAGE:'average - %.0lf'
0x0
average - 11Thanks you very much all for the help. (again)
Willem
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net
Re: Getting averages for a month from rrd files.
Sure thing. And thank you Andy for proving my statement:WillemDH wrote:Can you please leave the thread open for a while in case I would need some help..
tmcdonald wrote:I'm not extremely well-versed in rrdtool
Former Nagios employee
Re: Getting averages for a month from rrd files.
This thread can be closed.
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net