Page 1 of 2
monitor cpu utilization
Posted: Fri Mar 15, 2013 8:01 am
by rahuliq
Hi
Is it possible to monitor CPU utilization with nagios.
Regards
Rahul
Re: monitor cpu utilization
Posted: Fri Mar 15, 2013 9:20 am
by slansing
Yes it is, on what device are you looking to monitor CPU Utilization on? A Windows server, Linux server...etc?
Re: monitor cpu utilization
Posted: Sat Mar 16, 2013 12:52 am
by rahuliq
Linux server
Re: monitor cpu utilization
Posted: Mon Mar 18, 2013 10:10 am
by slansing
You can definitely do this, the easiest way would be through NRPE. Please take a look at these pieces of documentation:
Overview:
http://nagios.sourceforge.net/docs/nrpe/NRPE.pdf
This document will walk you through how to install NRPE on the Linux remote host, and how to set up a service configuration, and check command to check this host for it's CPU load. If you need additional guidance let us know!
Re: monitor cpu utilization
Posted: Mon Mar 18, 2013 11:51 am
by rahuliq
I have already setup nagios,nrpe and I'm monitoring the cpu load.
What I need to monitor is the %CPU utilization and also be able to graph it using something like pnp4nagios, nagiosgraph or cacti.
Regards
Rahul
Re: monitor cpu utilization
Posted: Mon Mar 18, 2013 11:58 am
by slansing
Have you taken a look at integrating this plugin with your NRPE setup?:
http://exchange.nagios.org/directory/Pl ... ts/details
This provides a number of useful stats other than the standard Linux Load collection. You would simply place this plugin on the remote host, set up a command definition in the NRPE.cfg file on that server, and then call that command from the Nagios server using check_nrpe.
Re: monitor cpu utilization
Posted: Mon Mar 18, 2013 12:30 pm
by rahuliq
I get the error NRPE: Unable to read output on the nagios web console
I placed the plugin in the folder /usr/local/nagios/libexec/
I placed the below command def in nrpe.cfg
command[check_cpu_utilization]=/usr/local/nagios/libexec/check_linux_stats.pl -C -w 90 -c 100 -s 5
Are there any perl modules that need to be installed
Re: monitor cpu utilization
Posted: Mon Mar 18, 2013 12:41 pm
by slansing
You may want to place $ARG1$ and $ARG2$ for example, in the -w and -c sections of the remote server's command definition to save some time if you decide to change the warning and critical values in the future, though, as you have it defined now, how are you calling the plugin from Nagios? From the command line? It is recommended to first test it from the command line and then add it into your configuration files to make sure it works before the final configuration steps.
Re: monitor cpu utilization
Posted: Mon Mar 18, 2013 12:48 pm
by lmiltchev
I placed the plugin in the folder /usr/local/nagios/libexec/
I placed the below command def in nrpe.cfg
command[check_cpu_utilization]=/usr/local/nagios/libexec/check_linux_stats.pl -C -w 90 -c 100 -s 5
Are there any perl modules that need to be installed
Just to clarify - you placed the plugin and defined the command on the remote server, correct?
Try running it locally to make sure it works (before you even try using it with NRPE):
You will have to install Sys-Statistics-Linux perl module prior to using it:
Code: Select all
yum install perl-Sys-Statistics-Linux -y
Re: monitor cpu utilization
Posted: Mon Mar 18, 2013 2:01 pm
by rahuliq
Thank you Guys
Worked after doing #yum install perl-Sys-Statistics-Linux -y
Also made a small change in the script check_linux_stats.pl
my $perfdata .= "|"
."user=$cpu->{user}% "
."system=$cpu->{system}% "
."iowait=$cpu->{iowait}% "
."InUse=$cpu_used%;$o_warning;$o_critical";
print "CPU $status : InUse $cpu_used% $perfdata";
so that it will return cpu used as opposed to %idle