Reputation: 7
I really need a script for Nagios to monitor the cpu usage on the remote hosts I have this command but it does not work
# 'check_cpu' command definition
# w = Warning level (if CPU % idle falls below this level - must be a percentage)
# c = Critical level
define command{
command_name check_cpu
command_line $USER1$/check_cpu -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p $USER3$
}
vi /etc/nagios/nrpe.cfg
command[check_uptime]=/usr/local/nagios/libexec/check_uptime
Upvotes: 1
Views: 3188
Reputation: 561
I'm a bit confused here. Your two commands are unrelated.
You need to check cpu on a remote host via NRPE? First, is NRPE installed on the remote host? Is check_nrpe
plugin installed on the Nagios server?
I'm going to assume that you have NRPE loaded on the remote server (since you listed a check_uptime command in the NRPE configuration file). This means at the very least you'll need to use the check_nrpe
command to grab the data you need.
On the remote host in /etc/nagios/nrpe.cfg
there should be a few other commands hopefully, maybe something like:
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
If for some reason there isn't, you're going to need to do some reading. This is a good document to start with.
Then, on your Nagios server you can define a service using the check_nrpe
like this:
define service {
use generic-service
host_name remotehost
service_description CPU Load
check_command check_nrpe!check_load
}
Now, to wrap all this up with a quick and hopefully comprehensive explanation of how NRPE works with Nagios:
check_uptime
, check_load
check_nrpe
on the Nagios sideHope this helped!
Upvotes: 1