CPU Idle Plugin for Nagios and Cacti
This script provides the IDLE CPU of the target machine.
Should work with many flavors of Linux and UNIX.
This script requires:
1) Change NAGCACTIUSER to match the username you use for Nagios/Cacti data collection.
2) sar installed on the remote machine (provided by sysstat in some Linux distros)
3) ssh key set up from the Nagios/Cacti server to the desired user on the remote machine
4) If the user that connects to the remote machine is different from the
one that Nagios/Cacti run under, then you need something like this in sudoers:
cacti ALL=NOPASSWD: /bin/su - *
In Nagios command.cfg:
define command{
command_name   check_cpu
command_line   $USER1$/check_cpu_cacti_nagios.sh $HOSTADDRESS$ $ARG1$ $ARG2$ nagios
}
In Nagios services.cfg
define service{
use service_1_min
host_name remotehost1,remotehost2
service\_description cpu
check_command check_cpu!30!10
max_check_attempts 10
contact_groups admins
}