-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moving files to init dir for organization
- Loading branch information
Shawn Sterling
committed
Oct 14, 2014
1 parent
6e98e12
commit e78cb12
Showing
7 changed files
with
170 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,64 @@ | ||
#! /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="/usr/local/bin/graphios" | ||
# 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 |
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,69 @@ | ||
#! /bin/bash | ||
# | ||
# graphios start the graphios script | ||
# | ||
# | ||
# chkconfig: 345 99 01 | ||
# description: graphios nagios -> graphite script | ||
# | ||
# File : graphios | ||
|
||
# Source function library. | ||
. /etc/init.d/functions | ||
|
||
# Source networking configuration. | ||
. /etc/sysconfig/network | ||
|
||
# Check that networking is up. | ||
[ "$NETWORKING" = "no" ] && exit 0 | ||
|
||
prog="/usr/bin/graphios" | ||
# or use the command line options: | ||
#prog="/usr/bin/graphios --log-file=/dir/mylog.log --spool-directory=/dir/my/sool" | ||
GRAPHIOS_USER="nagios" | ||
RETVAL=0 | ||
|
||
start () { | ||
echo -n "Starting $prog" | ||
/usr/bin/sudo -u $GRAPHIOS_USER "$prog" & | ||
RETVAL=$? | ||
[ $RETVAL -eq 0 ] && success || failure | ||
echo | ||
} | ||
|
||
stop () { | ||
echo -n "Stopping $prog" | ||
killproc graphios.py | ||
RETVAL=$? | ||
[ $RETVAL -eq 0 ] && success || failure | ||
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 |
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 @@ | ||
python setup.py install --optimize 1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES |
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,11 @@ | ||
# add symlink | ||
ln -s /usr/bin/graphios.py /usr/bin/graphios | ||
|
||
# add graphios service | ||
if [ ! -d /etc/systemd ]; then | ||
# we are running init | ||
if ! chkconfig --add graphios; then | ||
logger -p user.err -s -t %name -- "Error adding graphios service." | ||
exit 1 | ||
fi | ||
fi |
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,9 @@ | ||
if [ ! -d /etc/systemd ]; then | ||
# we are running init | ||
service graphios stop | ||
else | ||
# we are running systemd | ||
systemctl stop graphios.service | ||
fi | ||
|
||
unlink /usr/bin/graphios |
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,9 @@ | ||
[Unit] | ||
Description=graphios - a script to emit nagios perfdata to various backends | ||
|
||
[Service] | ||
ExecStart=/usr/bin/graphios | ||
restart=on-abort | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
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,7 @@ | ||
description "Graphios" | ||
author "Shawn Sterling" | ||
|
||
start on runlevel [234] | ||
stop on runlevel [016] | ||
|
||
exec /usr/local/bin/graphios.py |