Nagios Client nrped Service mode startup script

Source: Internet
Author: User

1, usually configure Nagios client nrped boot most commonly used is in the/etc/rc.local file configuration:

/usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe.cfg-d


2, but there is a better way (so it is easy to use the script to start or close):

Create the nrped script file under the/ETC/INIT.D directory and execute chmod +x/etc/init.d/nrped give execute permission

Chkconfig--add nrped or perform a direct execution chkconfig nrped on to add as service startup




nrped Script File contents (this script is not written by me):

#!/bin/sh

#

# Created 2000-01-03 by [email protected]

#

# Nrpe This shell script takes care of starting and stopping

# Nrpe.

#

# chkconfig:2345 80 30

# Description:nrpe is a daemon for a remote Nagios server, \

# running Nagios plugins on this host.

# Processname:nrpe

# config:/usr/local/nagios/etc/nrpe.cfg



# Source Function Library

if [-f/etc/rc.d/init.d/functions]; Then

. /etc/rc.d/init.d/functions

elif [-f/etc/init.d/functions]; Then

. /etc/init.d/functions

elif [-f/etc/rc.d/functions]; Then

. /etc/rc.d/functions

Fi


# Source Networking configuration.

. /etc/sysconfig/network


# Check that networking are up.

[${networking} = "No"] && exit 0


Nrpebin=/usr/local/nagios/bin/nrpe

Nrpecfg=/usr/local/nagios/etc/nrpe.cfg

Lockfile=/var/lock/subsys/nrpe


# See how we were called.

Case "$" in

Start

# Start Daemons.

Echo-n "Starting Nrpe:"

Daemon $NrpeBin-C $NRPECFG-D

Echo

Touch $LockFile

;;

Stop

# Stop Daemons.

Echo-n "shutting down Nrpe:"

Killproc Nrpe

Echo

Rm-f $LockFile

;;

Restart

$ stop

$ start

;;

Status

Status Nrpe

Exit $?

;;

*)

echo "Usage:nrpe {start|stop|restart|status}"

Exit 1

Esac


Exit 0


This article is from the "Wish" blog, please be sure to keep this source http://xinyuan8.blog.51cto.com/677906/1616376

Nagios Client nrped Service mode startup script

Related Article

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.