new version shinken-1.0.1 (much cleaner)

This commit is contained in:
Micha Glave 2012-04-12 17:09:45 +02:00
parent e732d30474
commit 315aa4c526
4 changed files with 86 additions and 61 deletions

View File

@ -1,5 +1,7 @@
AUX shinken-0.6.5.patch 4004 RMD160 5e96245063b4ecf078387ea5e544e660b69589e5 SHA1 7a74294471276b24b8717252bb71a0eeb99ed16f SHA256 f76cf0a99d8787f80ba498acbd5aeb6651a588fc5f75c4d765d572400f3ea053 AUX shinken-0.6.5.patch 4004 RMD160 5e96245063b4ecf078387ea5e544e660b69589e5 SHA1 7a74294471276b24b8717252bb71a0eeb99ed16f SHA256 f76cf0a99d8787f80ba498acbd5aeb6651a588fc5f75c4d765d572400f3ea053
AUX shinken.confd 2020 RMD160 5e4ecd7efbbab180dfde7bec1534d49c73beee2c SHA1 9617d65200fc4184e2a36adf28b335d355f69629 SHA256 6134be270eda7aec06cf2f7140af3bb60e132c0bd27cffebe5a55a5cf3bf215a AUX shinken.confd 1983 RMD160 4158fd08841fce97f4f756d153f2be9e2b67f59f SHA1 6222d9738db7efecdf62bc46a5344ff5ae8fa2ad SHA256 30b17ec488faf4a6060789dea554e65771687971bf7615d8b1087da431520752
AUX shinken.initd 1280 RMD160 cca8a389b0fffeb2d32a5195603a2ef39ac5fdc8 SHA1 145ac4d202957fd03bd36fb35fdb38c6cf33a741 SHA256 421088d443a52bebc5966a59040ae8b05da6f3ae8c952a44295e1c99a20c1bfe AUX shinken.initd 1410 RMD160 e4bffd0de22d0c57ef4ae114ca87eea4013a1f9d SHA1 5ca19b7a903424e232c3601c1d5df7b30ee0ba75 SHA256 55dd1d5d393876c256722fab5185123b9aef38fe8a496a6148c3f843ce818ee0
DIST shinken-0.6.5.tar.gz 5155015 RMD160 73d3646d092aa0d92474b31257b8c73c252dbc19 SHA1 62ee08fb290570484cb50979ed75791cd83a6a18 SHA256 ff08fb8a9ec669732316d3b2bd4423572efc2123482cbb8128b71c08aad64deb DIST shinken-0.6.5.tar.gz 5155015 RMD160 73d3646d092aa0d92474b31257b8c73c252dbc19 SHA1 62ee08fb290570484cb50979ed75791cd83a6a18 SHA256 ff08fb8a9ec669732316d3b2bd4423572efc2123482cbb8128b71c08aad64deb
DIST shinken-1.0.1.tar.gz 8039760 RMD160 caae07573bdc040925e7854cc39c148f42a45626 SHA1 cf11d54160e9ee3725443ca6afc6be2c55532a72 SHA256 811da51e80f2b32a2c6d0114ce90efe9e091aefd82489d21df35e0426f99fbfb
EBUILD shinken-0.6.5.ebuild 2249 RMD160 ee5355d1400511324c46b873fbae179cca91cf51 SHA1 c988e695fbba38e11de13ca226fb82fab0020b9c SHA256 9db817725f738f8243ffa4f731e896ed3b9cbb674270fabdcb3e25c8d784e622 EBUILD shinken-0.6.5.ebuild 2249 RMD160 ee5355d1400511324c46b873fbae179cca91cf51 SHA1 c988e695fbba38e11de13ca226fb82fab0020b9c SHA256 9db817725f738f8243ffa4f731e896ed3b9cbb674270fabdcb3e25c8d784e622
EBUILD shinken-1.0.1.ebuild 2530 RMD160 aec9439672470a67d8baf7dd39c321fc8cce7e84 SHA1 43c8d30fecd6e3428c8fcc694753e7fa95635a66 SHA256 4686cb66a7555e0fd2beed9f70a543337ddd33fd4377e4bd4fb6f46e721b98fc

View File

@ -1,7 +1,7 @@
# /etc/conf.d/shinken # /etc/conf.d/shinken
# location of the nagios configuration file # location of the nagios configuration file
SHINKENCFG="/etc/shinken/nagios.cfg" ARBITERCFG="/etc/shinken/nagios.cfg"
# We got 2 configs because tools like Centreon don't generate all # We got 2 configs because tools like Centreon don't generate all
#configuration (only the shinken.cfg part) #configuration (only the shinken.cfg part)
@ -11,14 +11,9 @@ SHINKENSPECIFICCFG="/etc/shinken/shinken-specific.cfg"
ARBITERDAEMON="/usr/bin/shinken-arbiter" ARBITERDAEMON="/usr/bin/shinken-arbiter"
#The ARBITER PID #The ARBITER PID
if [ -r $SHINKENCFG ] ; then ARBITERPID="/var/run/shinken/arbiterd.pid"
tmppid=`grep 'lock_file=' $SHINKENCFG | grep -v '#' | tail -n 1 | awk -F '=' '{print $2}'`
ARBITERPID=${tmppid-/var/lib/shinken/arbiterd.pid}
else
ARBITERPID="/var/lib/shinken/arbiterd.pid"
fi
ARBITERDEBUGFILE="/var/lib/shinken/arbiter-debug.log" ARBITERDEBUGFILE="/var/log/shinken/arbiter-debug.log"
###SCHEDULER PART ###SCHEDULER PART
@ -29,9 +24,9 @@ SCHEDULERCFG="/etc/shinken/schedulerd.ini"
SCHEDULERDAEMON="/usr/bin/shinken-scheduler" SCHEDULERDAEMON="/usr/bin/shinken-scheduler"
#The SCHEDULER PID #The SCHEDULER PID
SCHEDULERPID="/var/lib/shinken/schedulerd.pid" SCHEDULERPID="/var/run/shinken/schedulerd.pid"
SCHEDULERDEBUGFILE="/var/lib/shinken/scheduler-debug.log" SCHEDULERDEBUGFILE="/var/log/shinken/scheduler-debug.log"
###POLLER PART ###POLLER PART
# location of the poller daemon configuration # location of the poller daemon configuration
@ -41,9 +36,9 @@ POLLERCFG="/etc/shinken/pollerd.ini"
POLLERDAEMON="/usr/bin/shinken-poller" POLLERDAEMON="/usr/bin/shinken-poller"
#The poller pid #The poller pid
POLLERPID="/var/lib/shinken/pollerd.pid" POLLERPID="/var/run/shinken/pollerd.pid"
POLLERDEBUGFILE="/var/lib/shinken/poller-debug.log" POLLERDEBUGFILE="/var/log/shinken/poller-debug.log"
###REACTIONNER PART ###REACTIONNER PART
@ -54,9 +49,9 @@ REACTIONNERCFG="/etc/shinken/reactionnerd.ini"
REACTIONNERDAEMON="/usr/bin/shinken-reactionner" REACTIONNERDAEMON="/usr/bin/shinken-reactionner"
#The reactionner pid #The reactionner pid
REACTIONNERPID="/var/lib/shinken/reactionnerd.pid" REACTIONNERPID="/var/run/shinken/reactionnerd.pid"
REACTIONNERDEBUGFILE="/var/lib/shinken/reactionner-debug.log" REACTIONNERDEBUGFILE="/var/log/shinken/reactionner-debug.log"
###BROKER PART ###BROKER PART
@ -67,9 +62,9 @@ BROKERCFG="/etc/shinken/brokerd.ini"
BROKERDAEMON="/usr/bin/shinken-broker" BROKERDAEMON="/usr/bin/shinken-broker"
#The broker pid #The broker pid
BROKERPID="/var/lib/shinken/brokerd.pid" BROKERPID="/var/run/shinken/brokerd.pid"
BROKERDEBUGFILE="/var/lib/shinken/broker-debug.log" BROKERDEBUGFILE="/var/log/shinken/broker-debug.log"
###RECEIVER PART ###RECEIVER PART
@ -80,9 +75,9 @@ RECEIVERCFG="/etc/shinken/receiverd.ini"
RECEIVERDAEMON="/usr/bin/shinken-receiver" RECEIVERDAEMON="/usr/bin/shinken-receiver"
#The broker pid #The broker pid
RECEIVERPID="/var/lib/shinken/receiverd.pid" RECEIVERPID="/var/run/shinken/receiverd.pid"
RECEIVERDEBUGFILE="/var/lib/shinken/receiver-debug.log" RECEIVERDEBUGFILE="/var/log/shinken/receiver-debug.log"
# nicelevel to run nagios daemon with # nicelevel to run nagios daemon with
NICENESS=5 NICENESS=5

View File

@ -1,5 +1,5 @@
#!/sbin/runscript #!/sbin/runscript
# Copyright 1999-2010 Gentoo Foundation # Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# $Header: $ # $Header: $
@ -10,16 +10,21 @@ PIDPATH=${PIDPATH:-/var/run/shinken}
PIDFILE=${PIDPATH}/${MODULE} PIDFILE=${PIDPATH}/${MODULE}
LANG=en_US.UTF8 LANG=en_US.UTF8
opts="${opts} check" extra_commands="check"
eval DEBUGFILE="\${${_MODULE}DEBUGFILE}" eval DEBUGFILE="\${${_MODULE}DEBUGFILE}"
eval CONFIGFILE="\${${_MODULE}CFG}" eval CONFIGFILE="\${${_MODULE}CFG}"
eval PIDFILE="\${${_MODULE}PID}" eval PIDFILE="\${${_MODULE}PID}"
SHINKENM="/usr/bin/shinken-${MODULE}" SHINKENM="/usr/bin/shinken-${MODULE}"
if [ $MODULE = "arbiter" ]; then
CONFIGFILE="${SHINKENCFG} --config ${SHINKENSPECIFICCFG}"
fi
NEED="net" NEED="net"
PIDFILE=$(grep '^pidfile=' ${CONFIGFILE} | awk -F= '{ print $2 }')
if [ -r "${CONFIGFILE}" ] ; then
tmppid=`grep 'pidfile=' ${CONFIGFILE} | grep -v '#' | tail -n 1 | awk -F '=' '{print $2}'`
PIDFILE=${tmppid:-$PIDFILE}
fi
if [ $MODULE = "arbiter" ]; then
CONFIGFILE="${CONFIGFILE} --config ${SHINKENSPECIFICCFG}"
fi
depend() { depend() {
need net need net
@ -30,8 +35,8 @@ start() {
ebegin "all shinken-services started" ebegin "all shinken-services started"
return 0 return 0
fi fi
ebegin "starting shinken ${MODULE}" ebegin "Starting shinken ${MODULE}"
start-stop-daemon --start --exec ${SHINKENM} --pidfile ${PIDFILE} \ start-stop-daemon --start --exec ${SHINKENM} --quiet --pidfile ${PIDFILE} \
-- --config ${CONFIGFILE} --daemon -- --config ${CONFIGFILE} --daemon
eend $? eend $?
} }
@ -42,11 +47,11 @@ stop() {
return 0 return 0
fi fi
ebegin "Stopping shinken ${MODULE}" ebegin "Stopping shinken ${MODULE}"
start-stop-daemon --stop --exec ${SHINKENM} --pidfile ${PIDFILE} start-stop-daemon --stop --exec ${SHINKENM} --quiet --pidfile ${PIDFILE}
eend $? eend $?
} }
check() { check() {
"$BIN/shinken-arbiter" -v -c "$SHINKENCFG" -c "$SHINKENSPECIFICCFG" $DEBUGCMD 2>&1 "/usr/bin/shinken-arbiter" -v --config "${ARBITERCFG}" --config "${SHINKENSPECIFICCFG}" $DEBUGCMD 2>&1
return $? return $?
} }

View File

@ -14,53 +14,55 @@ SRC_URI="http://shinken-monitoring.org/pub/${P}.tar.gz"
LICENSE="AGPLv3" LICENSE="AGPLv3"
SLOT="0" SLOT="0"
IUSE="livestat" IUSE="livestat +arbiter broker poller reactionner receiver scheduler"
KEYWORDS="~amd64 ~x86" KEYWORDS="~amd64 ~x86"
RDEPEND=" RDEPEND="
dev-python/pyro:3 dev-python/pyro:3
livestat? ( dev-python/simplejson livestat? ( dev-python/simplejson
dev-python/pysqlite ) dev-python/pysqlite )
poller? ( net-analyzer/nagios-plugins )
" "
DEPEND="${RDEPEND} DEPEND="${RDEPEND}
!net-analyzer/nagios" !net-analyzer/nagios"
SHINKENMODULES="scheduler poller reactionner broker" SHINKENMODULES="arbiter broker poller reactionner receiver scheduler"
src_unpack() { src_configure() {
unpack ${A} local -i modnum=0
cd ${S}
epatch "${FILESDIR}/${P}.patch" for mod in ${SHINKENMODULES}; do
if use $mod; then
let modnum++
fi
done
if [[ "${modnum}" -lt 1 ]]; then
eerror
eerror "No shinken module selected, aborting...."
ewarn "Supported modules are ${SHINKENMODULES}"
eerror
fi
} }
pkg_setup() { src_compile() {
python_pkg_setup elog "nothing to compile."
enewgroup shinken
enewuser shinken -1 -1 -1 shinken
}
src_prepare() {
# remove unneded doubletts
rm bin/*.py
# fixing path
sed -i \
-e "s:^\(# \?\)\?local_log=\(%(workdir)s/\)\?\(.\+\):local_log=/var/log/${PN}/\3:" \
-e "s:^\(# \?\)\?workdir=\(.\+\):local_log=/var/lib/${PN}:" \
-e "s:^\(# \?\)\?pidfile=\(%(workdir)s/\)\?\(.\+\):pidfile=/var/run/${PN}/\3:" \
-e "s:^\(# \?\)\?user=\([^ ]\+\)\(.\+\)\?:user=\2:" \
-e "s:^\(# \?\)\?group=\([^ ]\+\)\(.\+\)\?:group=\2:" \
etc/*d.ini || die
} }
src_install() { src_install() {
distutils_src_install distutils_src_install --root=${D}
# remove windows-specific configs # remove windows-specific configs
rm ${D}/etc/${PN}/*-windows.ini
rm -rf ${D}$(python_get_sitedir)/skonf rm -rf ${D}$(python_get_sitedir)/skonf
keepdir /var/lib/${PN} # remove windows-specific configs
rm ${D}etc/${PN}/*-windows.ini
rm ${D}etc/${PN}/*-windows.cfg
# cleanup files not needed.
rm ${D}etc/init.d/*
rm -rf ${D}etc/default
keepdir "/var/lib/${PN}"
fowners shinken:shinken "/var/lib/${PN}" fowners shinken:shinken "/var/lib/${PN}"
fperms 750 "/var/lib/${PN}" fperms 750 "/var/lib/${PN}"
keepdir "/var/run/${PN}" keepdir "/var/run/${PN}"
@ -72,16 +74,37 @@ src_install() {
insinto "/usr/lib/nagios/plugins" insinto "/usr/lib/nagios/plugins"
doins libexec/*.sh libexec/*.py doins libexec/*.sh libexec/*.py
dobin bin/nagios dobin bin/nagios
manpages="scheduler receiver reactionner poller discovery broker arbiter"
for mod in ${SHINKENMODULES}; do
if ! use $mod; then
rm -f ${D}/etc/${PN}/${mod}d.ini
[ $mod != 'arbiter' ] && rm -f ${D}/usr/bin/${PN}-${mod}
fi
done
manpages="discovery"
for mod in ${SHINKENMODULES}; do
if use $mod; then
manpages="${manpages} $mod"
fi
done
for mod in $manpages; do for mod in $manpages; do
newman for_debian/man/shinken-${mod}.8shinken shinken-${mod}.8 newman doc/man/shinken-${mod}.8shinken shinken-${mod}.8
done done
newconfd ${FILESDIR}/${PN}.confd ${PN} newconfd ${FILESDIR}/${PN}.confd ${PN}
newinitd ${FILESDIR}/${PN}.initd ${PN}.arbiter newinitd ${FILESDIR}/${PN}.initd ${PN}
cd ${D}/etc/init.d cd ${D}/etc/init.d
for mod in ${SHINKENMODULES}; do for mod in ${SHINKENMODULES}; do
ln -s ${PN}.arbiter ${PN}.${mod} || die if use $mod; then
ln -s ${PN} ${PN}.${mod} || die
fi
done done
} }
pkg_setup() {
python_pkg_setup
enewgroup shinken
enewuser shinken -1 -1 -1 shinken
}