Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#! /bin/bash | ||
### BEGIN INIT INFO | ||
# Provides: graphios | ||
# Required-Start: $local_fs $remote_fs $syslog $named $network $time nagios3 | ||
# Required-Stop: $local_fs $remote_fs $syslog $named $network | ||
# Should-Start: | ||
# Should-Stop: | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: 0 1 6 | ||
# Short-Description: graphios bridge between nagios and graphite | ||
# Description: graphios feeds nagios performance data to graphite | ||
### END INIT INFO | ||
# File : graphios | ||
|
||
# Source function library. | ||
. /lib/lsb/init-functions | ||
|
||
|
||
prog="/opt/graphios/graphios.py" | ||
# or use the command line options: | ||
#prog="/opt/nagios/bin/graphios.py --log-file=/dir/mylog.log --spool-directory=/dir/my/sool" | ||
GRAPHIOS_USER="nagios" | ||
RETVAL=0 | ||
|
||
start () { | ||
log_daemon_msg "Starting $DESC" "$NAME" | ||
/usr/bin/sudo -u $GRAPHIOS_USER "$prog" & | ||
log_end_msg $? | ||
echo | ||
} | ||
|
||
stop () { | ||
log_daemon_msg "Stopping $DESC" "$NAME" | ||
killproc graphios.py | ||
log_end_msg $? | ||
echo | ||
} | ||
|
||
restart () { | ||
stop | ||
start | ||
} | ||
|
||
|
||
# See how we are called. | ||
case "$1" in | ||
start) | ||
start | ||
;; | ||
stop) | ||
stop | ||
;; | ||
restart|reload) | ||
restart | ||
;; | ||
status) | ||
status $prog | ||
RETVAL=$? | ||
;; | ||
*) | ||
echo "Usage: service graphios {start|stop|restart|reload}" | ||
RETVAL=2 | ||
;; | ||
esac | ||
|
||
exit $RETVAL |