diff --git a/.SRCINFO b/.SRCINFO index 5d420d0..a3a290d 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,6 +1,6 @@ pkgbase = icinga2 pkgdesc = An open source host, service and network monitoring program - pkgver = 2.13.8 + pkgver = 2.13.9 pkgrel = 2 url = http://www.icinga.org install = icinga2.install @@ -50,13 +50,15 @@ pkgbase = icinga2 backup = etc/icinga2/scripts/mail-service-notification.sh backup = etc/icinga2/zones.conf backup = etc/logrotate.d/icinga2 - source = icinga2-2.13.8-x86_64.tar.gz::https://github.com/Icinga/icinga2/archive/v2.13.8.tar.gz + source = icinga2-2.13.9-x86_64.tar.gz::https://github.com/Icinga/icinga2/archive/v2.13.9.tar.gz source = icinga2.tmpfiles source = icinga2.sysusers source = openrc_icinga2 - sha256sums = 0b1974eff321141ccc7b6b7bad52070a81d8679674570ebdd2525e6f8443a4e2 + source = openrc_icinga2_conf + sha256sums = 852c7af74e321e58f8df52e834ca781b7b9eb2dc6833182d8b86aa7c5ec81afe sha256sums = 1302b333f49ead14f8808a379535971501d3a0c1ba02a7bf7b4406b7d27c754c sha256sums = 2f946a33ea50a3c4400a81acd778e6411ffe5e2257a98004288b84a64f382810 - sha256sums = 1495238a2248fe2690ce7b186c96b68a28868b76276d2d37e5ae2f1e25cd6dcd + sha256sums = 77c52109de6c05e87d8d285b7f16a09855296d67dbdcfc0bf33a42ee000eb3e3 + sha256sums = 88e057f14b07bdf6d4284ba6194ea1527188af6462526720a5fa14327287b667 pkgname = icinga2 diff --git a/PKGBUILD b/PKGBUILD index 52c6201..86101bd 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -3,7 +3,7 @@ # Contributor: bebehei pkgname=icinga2 -pkgver=2.13.8 +pkgver=2.13.9 pkgrel=2 pkgdesc="An open source host, service and network monitoring program" @@ -57,20 +57,23 @@ source=( "$pkgname.tmpfiles" "$pkgname.sysusers" "openrc_$pkgname" + "openrc_${pkgname}_conf" ) sha512sum=( - "c16ee7d4876a712da19aaf8c2e85093bd3a4e60bdb29471a33d1e5df3df43c0e9b3afab59f5bbf2b99d06f6c501d52a2759a4b7783f877f3a5c713f43fe683a5" + "dbdf1fb06b2cf3d7566194ed9f5883f05848cbc3f740a704f76868e985f2ac943389d56943f55bdba2900966c39472c6031bf032d815881fc64890c04de911dd" "51811add3f83df870f4b18ad97a6a9ccaf5be7ab4c0614b0d85cfccf5dc3e3debd7df42ecfe08c00a1b4d25e5b4326214f6a9c079fbf2886fc9e5a4c3b8ebbba" "875843000bf40cedffadee9ec0691d88173610befd653da06ea3828e2b1c5c36ddcb308bdba053f72c9311f8f023be044abb9dc41a712381cdf62e0e8434dd2e" - "17fd0f63d9fe6f7e947d5f7485c2115dacdc9f2208931d162cb1b4882e33e027ce51d5c67241154c347d4d87f8c67d5f641cfa8d1f687de51d4225fab761cea1" + "44c870fc44aebad5c4a106c301836f0b3c46c6fca8bd50d6833527cf33c4550b9781d7251821db8789aa41fb5f6eb26d2e3d5a18a38f940a93eee0c54c02ad59" + "f5cdec7d4fd00eeb56a14bd1ba3c8e1b3d137bc91d97633163c44c026fb9da6e8e5f1de468b64be598f3da9c85f15460e4941093905bc91864aceab60fb470f1" ) sha256sums=( - '0b1974eff321141ccc7b6b7bad52070a81d8679674570ebdd2525e6f8443a4e2' + '852c7af74e321e58f8df52e834ca781b7b9eb2dc6833182d8b86aa7c5ec81afe' '1302b333f49ead14f8808a379535971501d3a0c1ba02a7bf7b4406b7d27c754c' '2f946a33ea50a3c4400a81acd778e6411ffe5e2257a98004288b84a64f382810' - '1495238a2248fe2690ce7b186c96b68a28868b76276d2d37e5ae2f1e25cd6dcd' + '77c52109de6c05e87d8d285b7f16a09855296d67dbdcfc0bf33a42ee000eb3e3' + '88e057f14b07bdf6d4284ba6194ea1527188af6462526720a5fa14327287b667' ) build() { @@ -116,6 +119,8 @@ package() { # install openrc start-stop script sudo install -Dm755 "$srcdir/../openrc_$pkgname" "/etc/init.d/$pkgname" + # install openrc config file + sudo install -Dm755 "$srcdir/../openrc_${pkgname}_conf" "/etc/conf.d/$pkgname" # install syntax highlighting for vim and nano cd "$srcdir/$pkgname-$pkgver" diff --git a/README.md b/README.md new file mode 100644 index 0000000..6de02d7 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# aur build script for icinga + +update PKGBUILD + +makepkg --cleanbuild --syncdeps --force +makepkg --geninteg +makepkg --printsrcinfo > .SRCINFO diff --git a/icinga2.changelog b/icinga2.changelog index f1fb635..5286f05 100644 --- a/icinga2.changelog +++ b/icinga2.changelog @@ -1,6 +1,10 @@ 2.12.6-1 - New upstream version 2.12.6 +2.13.9-1 + - New upstream version 2.13.9 + - Update openrc init script + 2.12.3-2 - Port for ArtixLinux (systemd-less) diff --git a/openrc_icinga2 b/openrc_icinga2 index e9bdc21..a514435 100755 --- a/openrc_icinga2 +++ b/openrc_icinga2 @@ -1,188 +1,138 @@ -#!/bin/sh -# -# chkconfig: 35 90 12 -# description: Icinga 2 -# -### BEGIN INIT INFO -# Provides: icinga2 -# Required-Start: $remote_fs $syslog $network -# Required-Stop: $remote_fs $syslog $network -# Should-Start: mysql postgresql -# Should-Stop: mysql postgresql -# Default-Start: 2 3 5 -# Default-Stop: 0 1 6 -# Short-Description: icinga2 host/service/network monitoring and management system -# Description: Icinga 2 is a monitoring and management system for hosts, services and networks. -### END INIT INFO - -# Get function from functions library -if [ -f /etc/rc.d/init.d/functions ]; then - . /etc/rc.d/init.d/functions -elif [ -f /etc/init.d/functions ]; then - . /etc/init.d/functions -fi - -# load system specific defines -SYSCONFIGFILE=/etc/conf.d/icinga2 -if [ -f $SYSCONFIGFILE ]; then - . $SYSCONFIGFILE -else - echo "Couldn't load system specific defines from $SYSCONFIGFILE. Using defaults." -fi - -# Set defaults, to overwrite see "/etc/conf.d/icinga2" - -: ${ICINGA2_USER:="icinga"} -: ${ICINGA2_GROUP:="icinga"} -: ${ICINGA2_COMMAND_GROUP:="icingacmd"} -: ${DAEMON:="/usr/bin/icinga2"} -: ${ICINGA2_CONFIG_FILE:="/etc/icinga2/icinga2.conf"} -: ${ICINGA2_ERROR_LOG:=/var/log/icinga2/error.log} -: ${ICINGA2_STARTUP_LOG:=/var/log/icinga2/startup.log} -: ${ICINGA2_PID_FILE:="/run/icinga2/icinga2.pid"} - -# Load extra environment variables -if [ -f /etc/default/icinga2 ]; then - . /etc/default/icinga2 -fi - -test -x $DAEMON || exit 5 - -if [ ! -e $ICINGA2_CONFIG_FILE ]; then - echo "Config file '$ICINGA2_CONFIG_FILE' does not exist." - exit 6 -fi - -getent passwd $ICINGA2_USER >/dev/null 2>&1 || (echo "Icinga user '$ICINGA2_USER' does not exist. Exiting." && exit 6) -getent group $ICINGA2_GROUP >/dev/null 2>&1 || (echo "Icinga group '$ICINGA2_GROUP' does not exist. Exiting." && exit 6) -getent group $ICINGA2_COMMAND_GROUP >/dev/null 2>&1 || (echo "Icinga command group '$ICINGA2_COMMAND_GROUP' does not exist. Exiting." && exit 6) +#!/usr/bin/openrc-run + +description="Icinga 2 is a monitoring and management system for hosts, services and networks." + +extra_commands="checkconfig" +extra_started_commands="reload" + +depend() { + need net + after network +} + +start_pre() { + + if [ ! -e $ICINGA2_CONFIG_FILE ]; then + eerror "Config file '$ICINGA2_CONFIG_FILE' does not exist." + exit 6 + fi + + getent passwd $ICINGA2_USER >/dev/null 2>&1 || (echo "Icinga user '$ICINGA2_USER' does not exist. Exiting." && exit 6) + getent group $ICINGA2_GROUP >/dev/null 2>&1 || (echo "Icinga group '$ICINGA2_GROUP' does not exist. Exiting." && exit 6) + getent group $ICINGA2_COMMAND_GROUP >/dev/null 2>&1 || (echo "Icinga command group '$ICINGA2_COMMAND_GROUP' does not exist. Exiting." && exit 6) + + if [ "${RC_CMD}" = "restart" ] ; then + checkconfig || return $? + fi +} # Start Icinga 2 start() { - printf "Starting Icinga 2: " - /usr/lib/icinga2/prepare-dirs "$SYSCONFIGFILE" - - if ! $DAEMON daemon -c $ICINGA2_CONFIG_FILE -d -e $ICINGA2_ERROR_LOG > $ICINGA2_STARTUP_LOG 2>&1; then - echo "Error starting Icinga. Check '$ICINGA2_STARTUP_LOG' for details." - exit 1 - else - echo "Done" - fi + ebegin "Starting Icinga 2: " + + /usr/lib/icinga2/prepare-dirs "$SYSCONFIGFILE" + + if ! $DAEMON daemon --config $ICINGA2_CONFIG_FILE --daemonize --errorlog $ICINGA2_ERROR_LOG > $ICINGA2_STARTUP_LOG 2>&1 + then + eerror "Error starting Icinga. Check '$ICINGA2_STARTUP_LOG' for details." + eend 1 + else + einfo "Done" + fi } # Restart Icinga 2 stop() { - printf "Stopping Icinga 2: " - - if [ ! -e $ICINGA2_PID_FILE ]; then - echo "The PID file '$ICINGA2_PID_FILE' does not exist." - if [ "x$1" = "xnofail" ]; then - return - else - exit 7 - fi - fi - - pid=`cat $ICINGA2_PID_FILE` - - if icinga2 internal signal -s SIGINT -p $pid >/dev/null 2>&1; then - for i in 1 2 3 4 5 6 7 8 9 10; do - if ! icinga2 internal signal -s SIGCHLD -p $pid >/dev/null 2>&1; then - break - fi - - printf '.' - sleep 3 - done - fi - - if icinga2 internal signal -s SIGCHLD -p $pid >/dev/null 2>&1; then - icinga2 internal signal -s SIGKILL -p $pid >/dev/null 2>&1 - fi - - echo "Done" + ebegin "Stopping Icinga 2: " + + if [ ! -e $ICINGA2_PID_FILE ] + then + eerror "The PID file '$ICINGA2_PID_FILE' does not exist." + if [ "x$1" = "xnofail" ] + then + return + else + eend 7 + fi + fi + + pid=$(cat $ICINGA2_PID_FILE) + + if icinga2 internal signal -s SIGINT -p $pid >/dev/null 2>&1 + then + for i in $(seq 1 10); do + if ! icinga2 internal signal -s SIGCHLD -p $pid >/dev/null 2>&1 + then + break + fi + sleep 3 + done + fi + + if icinga2 internal signal -s SIGCHLD -p $pid >/dev/null 2>&1 + then + icinga2 internal signal -s SIGKILL -p $pid >/dev/null 2>&1 + fi + + eend $? } # Reload Icinga 2 reload() { - exec /usr/lib/icinga2/safe-reload "$SYSCONFIGFILE" + + checkconfig || return $? + ebegin "Reloading ${RC_SVCNAME}" + exec /usr/lib/icinga2/safe-reload "$SYSCONFIGFILE" + eend $? } # Check the Icinga 2 configuration checkconfig() { - printf "Checking configuration: " - - if ! $DAEMON daemon -c $ICINGA2_CONFIG_FILE -C > $ICINGA2_STARTUP_LOG 2>&1; then - if [ "x$1" = "x" ]; then - cat $ICINGA2_STARTUP_LOG - echo "Icinga 2 detected configuration errors. Check '$ICINGA2_STARTUP_LOG' for details." - exit 1 - else - echo "Not "$1"ing Icinga 2 due to configuration errors. Check '$ICINGA2_STARTUP_LOG' for details." - if [ "x$2" = "xfail" ]; then - exit 1 - fi - fi - fi - - echo "Done" - # no arguments requires full output - if [ "x$1" = "x" ]; then - cat $ICINGA2_STARTUP_LOG - fi + ebegin "Checking configuration: " + + if ! $DAEMON daemon --config $ICINGA2_CONFIG_FILE --validate > $ICINGA2_STARTUP_LOG 2>&1 + then + if [ "x$1" = "x" ] + then + cat $ICINGA2_STARTUP_LOG + einfo "Icinga 2 detected configuration errors. Check '$ICINGA2_STARTUP_LOG' for details." + eend 1 + else + einfo "Not "$1"ing Icinga 2 due to configuration errors. Check '$ICINGA2_STARTUP_LOG' for details." + if [ "x$2" = "xfail" ] + then + eend 1 + fi + fi + fi + + einfo "Done" + # no arguments requires full output + if [ "x$1" = "x" ] + then + cat $ICINGA2_STARTUP_LOG + fi } # Print status for Icinga 2 status() { - printf "Icinga 2 status: " - - if [ ! -e $ICINGA2_PID_FILE ]; then - echo "Not running" - exit 3 - fi - - pid=`cat $ICINGA2_PID_FILE` - if icinga2 internal signal -s SIGCHLD -p $pid >/dev/null 2>&1; then - echo "Running" - else - echo "Not running" - exit 3 - fi + + ebegin "Icinga 2 status: " + + if [ ! -e $ICINGA2_PID_FILE ] + then + eerror "Not running" + eend 3 + fi + + pid=`cat $ICINGA2_PID_FILE` + if icinga2 internal signal -s SIGCHLD -p $pid >/dev/null 2>&1 + then + einfo "Running" + else + eerror "Not running" + eend 3 + fi } -### main logic ### -case "$1" in - start) - checkconfig start fail - start - ;; - stop) - stop - ;; - status) - status - ;; - restart) - checkconfig restart fail - stop nofail - start - ;; - condrestart) - STATUS=$(status > /dev/null 2>&1) - if [ $? != 0 ]; then exit 0; fi - checkconfig restart fail - stop nofail - start - ;; - reload) - reload - ;; - checkconfig) - checkconfig - ;; - *) - echo "Usage: $0 {start|stop|restart|reload|checkconfig|status}" - exit 3 -esac - -exit 0 +# exit 0 diff --git a/openrc_icinga2_conf b/openrc_icinga2_conf new file mode 100644 index 0000000..ee91334 --- /dev/null +++ b/openrc_icinga2_conf @@ -0,0 +1,17 @@ +#This is the default environment Icinga 2 runs with. +#Make your changes here. + +DAEMON=/usr/bin/icinga2 + +ICINGA2_CACHE_DIR=/var/cache/icinga2 +ICINGA2_COMMAND_GROUP=icingacmd +ICINGA2_CONFIG_FILE=/etc/icinga2/icinga2.conf +ICINGA2_ERROR_LOG=/var/log/icinga2/error.log +ICINGA2_GROUP=icinga +ICINGA2_INIT_RUN_DIR=/run/icinga2 +ICINGA2_LOG=/var/log/icinga2/icinga2.log +ICINGA2_LOG_DIR=/var/log/icinga2 +ICINGA2_PID_FILE=/run/icinga2/icinga2.pid +ICINGA2_STARTUP_LOG=/var/log/icinga2/startup.log +ICINGA2_USER="icinga" +ICINGA2_USER=icinga