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