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://axlewire.blog.51cto.com/e/u261/themes/default/images/spacer.gif "alt=" Spacer.gif "style=" padding:0px;margin:0px;vertical-align:top;border:1px solid rgb (221,221,221); Background-image: URL ("Http://axlewire.blog.51cto.com/e/u261/lang/zh-cn/images/localimage.png"); background-position:50% 50%; "/ >
This article is from the "is Wayward" blog, please be sure to keep this source http://9756063.blog.51cto.com/9746063/1604096
Nagios Custom Script Monitoring < Checking the existence of an EIP user's Java process >