您好,登錄后才能下訂單哦!
1、平時(shí)配置nagios客戶端nrped啟動(dòng)最常用的就是在/etc/rc.local文件配置:
/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 來添加為服務(wù)啟動(dòng)
nrped 腳本文件內(nèi)容(這個(gè)腳本不是我寫的):
#!/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
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。