How to Control NRPE on MacOSX

Published Date Author: , Posted April 4th, 2010 at 5:09:33pm

I installed NRPE via the MacPorts command-line tool as root.

As a result, I am able to start and stop NRPE with the following commands:

* To Start NRPE: /opt/local/share/nrpe/init-script start
* To Stop NRPE: /opt/local/share/nrpe/init-script stop

[code lang=”shell”]
#!/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

NrpeBin=/opt/local/sbin/nrpe
NrpeCfg=/opt/local/etc/nrpe/nrpe.cfg
LockFile=/opt/local/var/run/nrpe/nrpe.lock

# See how we were called.
case "$1" in
start)
# Start daemons.
echo -n "Starting nrpe: "
$NrpeBin -c $NrpeCfg -d
echo
touch $LockFile
;;
stop)
# Stop daemons.
echo -n "Shutting down nrpe: "
pid=ps axc|awk "{if (\\$5==\"nrpe\") print \\$1}"
/bin/kill $pid
echo
rm -f $LockFile
;;
restart)
$0 stop
$0 start
;;
status)
/bin/ps -ax |/usr/bin/grep nrpe
;;
*)
echo "Usage: nrpe {start|stop|restart|status}"
exit 1
esac

exit 0
[/code]

No comments as yet.

Leave Your Comment  Leave a comment

All fields marked with "*" are required.