1、平時(shí)配置nagios客戶(hù)端nrped啟動(dòng)最常用的就是在/etc/rc.local文件配置:
成都創(chuàng)新互聯(lián)公司從2013年創(chuàng)立,是專(zhuān)業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目做網(wǎng)站、網(wǎng)站建設(shè)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元鄰水做網(wǎng)站,已為上家服務(wù),為鄰水各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:18980820575
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
2、但是還有更好的方式(這樣方便使用腳本啟動(dòng)或者關(guān)閉):
在/etc/init.d目錄下創(chuàng)建nrped腳本文件,并執(zhí)行 chmod +x /etc/init.d/nrped 賦予執(zhí)行權(quán)限
chkconfig --add nrped 或執(zhí)行直接執(zhí)行chkconfig nrped on 來(lái)添加為服務(wù)啟動(dòng)
nrped 腳本文件內(nèi)容(這個(gè)腳本不是我寫(xiě)的):
#!/bin/sh
#
# Created 2000-01-03 by jaclu@grm.se
#
# 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 is 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 "$1" 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)
$0 stop
$0 start
;;
status)
status nrpe
exit $?
;;
*)
echo "Usage: nrpe {start|stop|restart|status}"
exit 1
esac
exit 0