command line output for monthly CPU average

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
spitman
Posts: 3
Joined: Tue Jan 07, 2014 2:21 pm

command line output for monthly CPU average

Post 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
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: command line output for monthly CPU average

Post 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."
spitman
Posts: 3
Joined: Tue Jan 07, 2014 2:21 pm

Re: command line output for monthly CPU average

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: command line output for monthly CPU average

Post 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.
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.
spitman
Posts: 3
Joined: Tue Jan 07, 2014 2:21 pm

Re: command line output for monthly CPU average

Post 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 :)
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: command line output for monthly CPU average

Post 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).
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.
Locked