first working ebuild of shinken. (v 0.6.5)

This commit is contained in:
Micha Glave
2011-07-05 23:19:40 +02:00
parent 6dc7adb06a
commit a87c12b4c1
5 changed files with 306 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
--- setup.py.orig 2011-06-23 10:21:23.000000000 +0200
+++ setup.py 2011-07-05 23:07:31.000000000 +0200
@@ -174,9 +174,9 @@
buf = f.read()
f.close
# substitute
- buf = buf.replace("$ETC$", self.etc_path)
- buf = buf.replace("$VAR$", self.var_path)
- buf = buf.replace("$SCRIPTS_BIN$", self._install_scripts)
+ buf = buf.replace("$ETC$", "/etc/shinken")
+ buf = buf.replace("$VAR$", "/var/lib/shinken")
+ buf = buf.replace("$SCRIPTS_BIN$", "/usr/bin")
# write out the new file
f = open(outfile, "w")
f.write(buf)
@@ -192,21 +192,21 @@
for name in daemon_ini_files:
inname = os.path.join('etc', name)
outname = os.path.join(self.build_dir, name)
- log.info('updating path in %s : to "%s"' % (outname, self.var_path))
+ log.info('updating path in %s : to "%s"' % (outname, "/var/lib/shinken"))
if False:
## disabled for now:
## all daemons are now using relative paths by default
## (relative to the "VAR" one of /etc/default/shinken)
update_file_with_string(inname, outname,
- "../var", self.var_path)
+ "../var", "/var/lib/shinken")
# but we have to force the user/group & workdir values still:
append_file_with(inname, outname, """
user=%s
group=%s
workdir=%s
-""" % ( self.owner, self.group, self.var_path, ))
+""" % ( self.owner, self.group, "/var/lib/shinken", ))
# And now the resource.cfg path with the value of libexec path
# Replace the libexec path by the one in the parameter file
@@ -230,7 +230,7 @@
## nagios.cfg & shinken-specific use now relative paths (relative to the "VAR" one)
update_file_with_string(inname, outname,
"/usr/local/shinken/var",
- self.var_path)
+ "/var/lib/shinken")
## but we HAVE to set the shinken_user & shinken_group to thoses requested :
append_file_with(inname, outname, """
@@ -416,7 +416,7 @@
},
name = "Shinken",
- version = "0.6",
+ version = "0.6.5",
packages = find_packages(),
package_data = {'':['*.py','modules/*.py','modules/*/*.py']},
description = "Shinken is a monitoring tool compatible with Nagios configuration and plugins",
@@ -484,29 +484,6 @@
glob('etc/certs/[!_]*.pem')
),
- (
- os.path.join('/etc', 'init.d'),
- [
- 'bin/init.d/shinken',
- 'bin/init.d/shinken-arbiter',
- 'bin/init.d/shinken-broker',
- 'bin/init.d/shinken-receiver',
- 'bin/init.d/shinken-poller',
- 'bin/init.d/shinken-reactionner',
- 'bin/init.d/shinken-scheduler'
- ]
- ),
-
- (
- os.path.join(etc_root, 'default',),
- [ 'build/bin/default/shinken' ]
- ),
-
- (
- default_paths['var'],
- [ 'var/void_for_git' ]
- ),
-
(
default_paths['libexec'], ['libexec/check.sh']
),

View File

@@ -0,0 +1,95 @@
# /etc/default/shinken
## These vars will overRide the hardcoded ones in init script
ETC=/etc/shinken
VAR=/var/lib/shinken
BIN=/usr/bin
# location of the nagios configuration file
SHINKENCFG="$ETC/nagios.cfg"
# We got 2 configs because tools like Centreon don't generate all
#configuration (only the shinken.cfg part)
SHINKENSPECIFICCFG="$ETC/shinken-specific.cfg"
# The command to launch
ARBITERDAEMON=$BIN/shinken-arbiter
#The ARBITER PID
if [ -r $SHINKENCFG ] ; then
tmppid=`grep 'lock_file=' $SHINKENCFG | grep -v '#' | tail -n 1 | awk -F '=' '{print $2}'`
ARBITERPID=${tmppid-$VAR/arbiterd.pid}
else
ARBITERPID="$VAR/arbiterd.pid"
fi
ARBITERDEBUGFILE="$VAR/arbiter-debug.log"
###SCHEDULER PART
# location of the scheduler daemon configuration
SCHEDULERCFG="$ETC/schedulerd.ini"
# The command to launch
SCHEDULERDAEMON=$BIN/shinken-scheduler
#The SCHEDULER PID
SCHEDULERPID="$VAR/schedulerd.pid"
SCHEDULERDEBUGFILE="$VAR/scheduler-debug.log"
###POLLER PART
# location of the poller daemon configuration
POLLERCFG="$ETC/pollerd.ini"
# The command to launch
POLLERDAEMON=$BIN/shinken-poller
#The poller pid
POLLERPID="$VAR/pollerd.pid"
POLLERDEBUGFILE="$VAR/poller-debug.log"
###REACTIONNER PART
# location of the reactionner daemon configuration
REACTIONNERCFG="$ETC/reactionnerd.ini"
# The command to launch
REACTIONNERDAEMON=$BIN/shinken-reactionner
#The reactionner pid
REACTIONNERPID="$VAR/reactionnerd.pid"
REACTIONNERDEBUGFILE="$VAR/reactionner-debug.log"
###BROKER PART
# location of the broker daemon configuration
BROKERCFG="$ETC/brokerd.ini"
# The command to launch
BROKERDAEMON=$BIN/shinken-broker
#The broker pid
BROKERPID="$VAR/brokerd.pid"
BROKERDEBUGFILE="$VAR/broker-debug.log"
###RECEIVER PART
# location of the broker daemon configuration
RECEIVERCFG="$ETC/receiverd.ini"
# The command to launch
RECEIVERDAEMON=$BIN/shinken-receiver
#The broker pid
RECEIVERPID="$VAR/receiverd.pid"
RECEIVERDEBUGFILE="$VAR/receiver-debug.log"
# nicelevel to run nagios daemon with
NICENESS=5

View File

@@ -0,0 +1,43 @@
#!/sbin/runscript
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
MODULE=${SVCNAME#*.}
_MODULE=$(echo $MODULE | awk '{print toupper($0)}')
SHINKEN=/usr/bin/shinken
PIDPATH=/var/run/shinken
PIDFILE=${PIDPATH}/${MODULE}
LANG=en_US.UTF8
opts="${opts} check"
eval DEBUGFILE="\${${_MODULE}DEBUGFILE}"
eval CONFIGFILE="\${${_MODULE}CFG}"
eval PIDFILE="\${${_MODULE}PID}"
SHINKENM="/usr/bin/shinken-${MODULE}"
if [ $MODULE = "arbiter" ]; then
CONFIGFILE="${CONFIGFILE} -c ${SHINKENSPECIFICCFG}"
fi
depend() {
need net
}
start() {
ebegin "${SVCNAME} ${MODULE} ${PIDFILE}"
start-stop-daemon --start --exec ${SHINKENM} --pidfile "${PIDFILE}" \
-- --config ${CONFIGFILE} --daemon
}
stop() {
local X RETVAL=0
ebegin "Stopping shinken application ${MODULE}"
start-stop-daemon --stop --exec ${SHINKENM} --pidfile ${PIDFILE}
eend $?
}
check() {
"$BIN/shinken-arbiter" -v -c "$SHINKENCFG" -c "$SHINKENSPECIFICCFG" $DEBUGCMD 2>&1
return $?
}