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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/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
#!/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

No comments as yet.

Leave Your Comment  Leave a comment

All fields marked with "*" are required.