From a87c12b4c1a2359d60f45219764457335675dce7 Mon Sep 17 00:00:00 2001 From: Micha Glave Date: Tue, 5 Jul 2011 23:19:40 +0200 Subject: [PATCH] first working ebuild of shinken. (v 0.6.5) --- net-analyzer/shinken/Manifest | 5 + .../shinken/files/shinken-0.6.5.patch | 89 +++++++++++++++++ net-analyzer/shinken/files/shinken.confd | 95 +++++++++++++++++++ net-analyzer/shinken/files/shinken.initd | 43 +++++++++ net-analyzer/shinken/shinken-0.6.5.ebuild | 74 +++++++++++++++ 5 files changed, 306 insertions(+) create mode 100644 net-analyzer/shinken/Manifest create mode 100644 net-analyzer/shinken/files/shinken-0.6.5.patch create mode 100644 net-analyzer/shinken/files/shinken.confd create mode 100644 net-analyzer/shinken/files/shinken.initd create mode 100644 net-analyzer/shinken/shinken-0.6.5.ebuild diff --git a/net-analyzer/shinken/Manifest b/net-analyzer/shinken/Manifest new file mode 100644 index 0000000..0ae7cc7 --- /dev/null +++ b/net-analyzer/shinken/Manifest @@ -0,0 +1,5 @@ +AUX shinken-0.6.5.patch 3589 RMD160 7802b76e7c6fddcc107f00036e50c50c59410091 SHA1 db996f12068f1b0ff16625abedee38ac34e2c867 SHA256 c60e0ba3ac9f2fc2cf3becbf26d6b9477983fe68e8dabecf05245592898d088d +AUX shinken.confd 2041 RMD160 618a2fa8ba16c052445d23f136a6ac7b685e89bb SHA1 22c2eb50379cb604055bef76cdfc443d7514436a SHA256 512d72af135fb74678f0ad42c5cd8d5125de3c77c2adcba7317c3fed316db6f3 +AUX shinken.initd 1032 RMD160 5b54862ad20a0a99f4f06cf25f0b192220d9f949 SHA1 1e49b43e1041da45535b577882036341f8d4b39f SHA256 0c60299d88218ec8f7c6937c93fa84fc6f72cb498d0b85ead80fcf9bfc793579 +DIST shinken-0.6.5.tar.gz 5155015 RMD160 73d3646d092aa0d92474b31257b8c73c252dbc19 SHA1 62ee08fb290570484cb50979ed75791cd83a6a18 SHA256 ff08fb8a9ec669732316d3b2bd4423572efc2123482cbb8128b71c08aad64deb +EBUILD shinken-0.6.5.ebuild 1522 RMD160 7d5e19d269835a33d560f57db538c681807f0316 SHA1 2d8121e9a46a3d7723d6685e40aca489bdca8f66 SHA256 d17731fcfc116998c3e8a217ba257b833d83329648cc14d2bd2cf782d917a0a9 diff --git a/net-analyzer/shinken/files/shinken-0.6.5.patch b/net-analyzer/shinken/files/shinken-0.6.5.patch new file mode 100644 index 0000000..283955d --- /dev/null +++ b/net-analyzer/shinken/files/shinken-0.6.5.patch @@ -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'] + ), + diff --git a/net-analyzer/shinken/files/shinken.confd b/net-analyzer/shinken/files/shinken.confd new file mode 100644 index 0000000..ef7cc2a --- /dev/null +++ b/net-analyzer/shinken/files/shinken.confd @@ -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 + diff --git a/net-analyzer/shinken/files/shinken.initd b/net-analyzer/shinken/files/shinken.initd new file mode 100644 index 0000000..310078d --- /dev/null +++ b/net-analyzer/shinken/files/shinken.initd @@ -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 $? +} diff --git a/net-analyzer/shinken/shinken-0.6.5.ebuild b/net-analyzer/shinken/shinken-0.6.5.ebuild new file mode 100644 index 0000000..c35ce1b --- /dev/null +++ b/net-analyzer/shinken/shinken-0.6.5.ebuild @@ -0,0 +1,74 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/www-apps/shinken/shinken-0.12.2.ebuild,v 1.4 2011/03/15 21:34:31 xarthisius Exp $ + +EAPI=3 +PYTHON_DEPEND="2:2.6" +SUPPORT_PYTHON_ABIS="1" +RESTRICT_PYTHON_ABIS="3.* *-jython" + +inherit distutils eutils python + +DESCRIPTION="Shinken is a new monitoring tool written in Python and compatible with Nagios." +HOMEPAGE="http://shinken-monitoring.org/" +SRC_URI="http://shinken-monitoring.org/pub/${P}.tar.gz" + +LICENSE="AGPLv3" +SLOT="0" +IUSE="livestat" + +KEYWORDS="~amd64 ~x86" + + +RDEPEND=" + dev-python/pyro:3 + livestat? ( dev-python/simplejson + dev-python/pysqlite ) + " +DEPEND="${RDEPEND}" + +SHINKENMODULES="scheduler poller reactionner broker arbiter" + +src_unpack() { + unpack ${A} + cd ${S} + epatch "${FILESDIR}/${P}.patch" + rm bin/*.py +} + +pkg_setup() { + python_pkg_setup + enewgroup shinken + enewuser shinken -1 -1 -1 shinken +} + +src_prepare() { +# python_convert_shebangs -r 2 . + distutils_src_prepare +} + +src_install() { + distutils_src_install + # remove windows-specific configs + rm ${D}/etc/${PN}/*-windows.ini + + keepdir /var/lib/${PN} + fowners shinken:shinken "/var/lib/${PN}" + fperms 750 "/var/lib/${PN}" + keepdir /var/run/${PN} + newconfd ${FILESDIR}/${PN}.confd ${PN} + newinitd ${FILESDIR}/${PN}.initd ${PN} + cd ${D}/etc/init.d + for mod in ${SHINKENMODULES}; do + ln -s ${PN} ${PN}.${mod} || die + done +} + +pkg_postinst() { + distutils_pkg_postinst +} + +pkg_postrm() { + distutils_pkg_postrm +} +