Here I am checking the status of mysql running on the nagios Monitoring host
Go to nagios installation directory on nagios Monitoring host.
1. # cd /usr/local/nagios/etc/objects/
2. Add the following line to ” command.cfg and save
# vi commands.cfg
define command{
command_name check_tcp_mysql
command_line /usr/local/nagios/libexec/check_tcp -H localhost -p 3306 -w 100 -c 150
}
Note : we can see the proposed out put by executing this command from the console directly(“/usr/local/nagios/libexec/check_tcp -H localhost -p 3306 -w 100 -c 150″)
3. Edit localhost.cfg and append the line at the end of the file. Save and quit
define service{
use local-service ; Name of service template to use
host_name nagios-svr
service_description MySQL
check_command check_tcp_mysql
notifications_enabled 1
}
4. Verify the sample Nagios configuration files.
#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Thats’ it