Page 1 of 1
command line output for monthly CPU average
Posted: Tue Jan 07, 2014 2:24 pm
by spitman
I was wondering if someone could help me with the syntax for outputting to the command line the monthly CPU load average. I'm somewhat of a beginner. Normally to print things out to the unix command line I start in the libexec directory and run them from there. I'm going to be running this against both NT and *nix host types.
Thanks in advance,
Susan
Re: command line output for monthly CPU average
Posted: Tue Jan 07, 2014 2:27 pm
by slansing
This is not exactly a feature of Nagios, that is why there is a reporting system in the web interface. This system aggregates data from archived logs in most cases. Plugins will only retrieve what they are coded to retrieve, and that is usually just the current statistics on what they are checking as this is how Nagios keeps admins up to date and alerted. You would likely have to write a script that will parse your logs for values returned by your CPU usage checks, then paste that together and output the results "much like the reports."
Re: command line output for monthly CPU average
Posted: Tue Jan 07, 2014 3:02 pm
by spitman
Slansing,
Thanks for the response. That being said...
We have nagiosgraph installed. I have spent a lot of time going down that rabbit hole, trying to figure out how to get this info. We have "splats" next to our services (like CPU load in this case) and we can click on the splat to see a graph. The CPU monthly load average is on that graph--and that exact output is what I'm trying to get spit out on the command line. It has to come from somewhere...
Thanks,
Susan
Re: command line output for monthly CPU average
Posted: Tue Jan 07, 2014 4:22 pm
by abrist
I presume you are using rrds? If so, you could dump the rrd and parse/process the output for an average over a given timeframe. The same could be done for the information in the logs, but it may be more painful to script the parser.
Re: command line output for monthly CPU average
Posted: Wed Jan 08, 2014 11:11 am
by spitman
So maybe I'm kind of barking up the wrong tree with the rrs, and I was wondering that... where are the log files, and could you help me build an example?
Thank you

Re: command line output for monthly CPU average
Posted: Wed Jan 08, 2014 12:20 pm
by abrist
I took a closer look at the logs, and unfortunately, only state changes are logged. The status.dat file will include information concerning the last check, but without ndo or rrds, you will not have the entire history of check results (all checks, all states).