Nagios Custom Script Monitoring < Checking the existence of an EIP user's Java process >

Source: Internet
Author: User

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 >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.