Page 1 of 1

localhost Current Load with multiple CPUs

Posted: Mon Feb 21, 2011 8:58 pm
by Box293
I was looking at our Nagios XI server and noticed that it has a load of about 7 - 14 on average. This is a three CPU VM.

I was playing with the check_load command and noticed that there was the -r option that Divide the load averages by the number of CPUs.

without -r

Code: Select all

./check_load -w 5.0,4.0,3.0 -c 10.0,6.0,4.0
CRITICAL - load average: 14.27, 8.65, 8.25|load1=14.270;5.000;10.000;0; load5=8.650;4.000;6.000;0; load15=8.250;3.000;4.000;0;
with -r

Code: Select all

./check_load -w 5.0,4.0,3.0 -c 10.0,6.0,4.0 -r
OK - load average: 4.76, 2.88, 2.75|load1=4.757;5.000;10.000;0; load5=2.883;4.000;6.000;0; load15=2.750;3.000;4.000;0;
I then modified the Currnet Load service to use the -r. This is great, the localhost is no longer going into warning and critical states. I can also see the before and after affects when looking at the performance graphs for Current Load.
current load graphs - 4 hour.png
current load graphs - 1 week.png
However I've noticed that in the dashlet Server Statistics the load is still very high, it does not reflect the data for the Current Load service.

Question: Is there a way to make the dashlet Server Statistics match the service (use the -r option)
Suggestion: Change the Current Load service to use the -r option as the default setting. I know that the VM is distributed as a single CPU VM but it's less hassle to change it later on, also physical boxes are usually going to have > 1 CPU.
server statistics.png
Nagios XI 2009R1.4B running on a VMware VM on an ESXi 4.1 host.

Re: localhost Current Load with multiple CPUs

Posted: Thu Feb 24, 2011 10:25 am
by mguthrie
I see what you mean, and this is a decent idea, although the code for this change is buried somewhere that I was unable to find at the moment. I would suggest filing it as a feature request on our tracker. tracker.nagios.com.

Re: localhost Current Load with multiple CPUs

Posted: Thu Feb 24, 2011 10:52 am
by tonyyarusso
Suggestion: Change the Current Load service to use the -r option as the default setting.
Makes sense to me. I filed it at http://tracker.nagios.com/view.php?id=126.
Question: Is there a way to make the dashlet Server Statistics match the service (use the -r option)
"Yes". I found the line of code that does this, and in the current SVN copy it's #185 in nagiosxi/basedir/cron/sysstat.php, which looks like this:

Code: Select all

	// GET LOAD INFO
	$cmdline=sprintf("/usr/bin/uptime | sed s/,//g | awk -F'average: ' '{  print $2 }'");
As you can see, this particular piece isn't even using the Nagios plugin, but just the uptime command directly. I would imagine though that you could change it to do so, with something like this:

Code: Select all

	// GET LOAD INFO
	$cmdline=sprintf("/usr/local/nagios/libexec/check_load -r -w 100,100,100 -c 200,200,200 | sed s/,//g | awk -F'average: ' '{  print $2 }' | sed 's/|.*//'");

Re: localhost Current Load with multiple CPUs

Posted: Thu Feb 24, 2011 3:56 pm
by Box293
Cheers,
I'll have a play and see how it goes.

Re: localhost Current Load with multiple CPUs

Posted: Fri Feb 25, 2011 10:21 am
by rdedon
Very nice, thank you :-)

Re: localhost Current Load with multiple CPUs

Posted: Sun Mar 06, 2011 5:50 pm
by Box293
Since I made the change that Tony suggested the Server Statistics dashlet has worked fine and is accurately reporting the data.

Re: localhost Current Load with multiple CPUs

Posted: Mon Mar 07, 2011 12:08 pm
by mguthrie
Nice!! Glad it's working for you!