Client ip:192.168.1.11
Service-Side ip:192.168.1.12
Purpose: To check the existence of the Java process for EIP users
Client Configuration
Script Name: check_pid.sh
The script is as follows:
#! /bin/bash
Si= ' Ps-ef|grep java|grep eip|wc-l '
If [$si-eq 1];then
echo "Status OK"
Exit 0
Else
echo "The Pro is Down,plaese check!"
Exit 1
Fi
Placed under the/home/monitor/nagios/libexec, that is, Nrpe plug-in storage place, Chown-r monitor:monitor check_pid.sh
chmod +x check_pid.sh
Cd/home/monitor/nagios/etc
VI nrpe.cfg
Add the following content
command[check_pid.sh]=/home/monitor/nagios/libexec/check_pid.sh
Restart Nrpe
Service xinetd Restart
Server-side configuration:
Similarly, add check_pid.sh in/home/monitor/nagios/libexec
Cd/home/monitor/nagios/etc
CD objects
VI commands.cfg
Define Command{
Command_name check_pid.sh
Command_line $USER 1$/check_pid.sh $HOSTADDRESS $
}
Cd/home/monitor/nagios/etc/services
VI 192.168.1.11.cfg
Add the following content
Define Service{
Use Local-service
HOST_NAME 192.168.1.11
Service_description check_pid.sh
Check_command check_nrpe!check_pid.sh
}
Restart Nagios
Service Nagios Restart
Test:
/home/monitor/nagios/libexec
./check_nrpe-h 192.168.1.11-c check_pid.sh
See return information
Status OK
Open the Graphics monitoring page and you can see
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/58/A5/wKiom1S2fZPxNoVIAAA7YYrAQ_U563.jpg "title=" Return status " alt= "Wkiom1s2fzpxnoviaaa7yyraq_u563.jpg"/>
This article is from the Oracle blog, so be sure to keep this source http://axlewire.blog.51cto.com/1418858/1604091
Nagios Custom Script monitoring