diff options
author | Francesco Colista <fcolista@alpinelinux.org> | 2016-04-22 18:10:05 +0000 |
---|---|---|
committer | Francesco Colista <fcolista@alpinelinux.org> | 2016-04-22 18:10:05 +0000 |
commit | 96cdb8e9e6b70a355eea850624277ed687d4be12 (patch) | |
tree | 5f72857eab3591469dca0af8caadb2e88210a2d8 /community/icinga2 | |
parent | 32fee060aae12a19444d059777c107f86076d549 (diff) | |
download | aports-96cdb8e9e6b70a355eea850624277ed687d4be12.tar.bz2 aports-96cdb8e9e6b70a355eea850624277ed687d4be12.tar.xz |
community/icinga2: moved from testing
Diffstat (limited to 'community/icinga2')
-rw-r--r-- | community/icinga2/APKBUILD | 118 | ||||
-rw-r--r-- | community/icinga2/icinga2.initd | 84 | ||||
-rw-r--r-- | community/icinga2/icinga2.post-install | 5 | ||||
-rw-r--r-- | community/icinga2/icinga2.pre-install | 6 |
4 files changed, 213 insertions, 0 deletions
diff --git a/community/icinga2/APKBUILD b/community/icinga2/APKBUILD new file mode 100644 index 0000000000..a1b5cbcc5b --- /dev/null +++ b/community/icinga2/APKBUILD @@ -0,0 +1,118 @@ +# Contributor: Francesco Colista <fcolista@alpinelinux.org> +# Maintainer: Francesco Colista <fcolista@alpinelinux.org> +pkgname=icinga2 +pkgver=2.4.7 +pkgrel=0 +pkgdesc="An open source host, service and network monitoring program" +url="http://www.icinga.org" +arch="all" +license="GPL" +depends="monitoring-plugins" +depends_dev="" +makedepends="$depends_dev cmake bison flex boost-dev yajl + postgresql-dev mariadb-dev openssl-dev" +install="$pkgname.pre-install $pkgname.post-install" +pkgusers="icinga" +pkggroups="icinga" +subpackages="$pkgname-doc $pkgname-bash-completion:bashcomp" +source="$pkgname-$pkgver.tar.gz::https://github.com/Icinga/$pkgname/archive/v$pkgver.tar.gz + $pkgname.initd" + +_builddir="$srcdir/$pkgname-$pkgver" +prepare() { + local i + cd "$_builddir" + for i in $source; do + case $i in + *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; + esac + done + mkdir -p build +} + +build() { + cd "$_builddir"/build + cmake "$srcdir/$pkgname-$pkgver" \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_SYSCONFDIR=/etc \ + -DICINGA2_RUNDIR=/run \ + -DCMAKE_INSTALL_SBINDIR=/usr/sbin \ + -DCMAKE_INSTALL_LIBDIR=/usr/lib \ + -DCMAKE_INSTALL_LOCALSTATEDIR=/var \ + -DICINGA2_SYSCONFIGFILE=/etc/icinga2 \ + -DICINGA2_PLUGINDIR=/usr/lib/monitoring-plugins \ + -DICINGA2_USER=$pkgusers \ + -DICINGA2_GROUP=${pkggroups}cmd \ + -DICINGA2_COMMAND_USER=$pkgusers \ + -DICINGA2_COMMAND_GROUP=${pkggroups}cmd \ + -DINSTALL_SYSTEMD_SERVICE_AND_INITSCRIPT=no + make || return 1 +} + +package() { + cd "$_builddir"/build + make DESTDIR="$pkgdir" install + mv "$pkgdir/etc/icinga2/conf.d" "$pkgdir/etc/icinga2/conf.d.example" + mkdir "$pkgdir/etc/icinga2/conf.d" + rm "$pkgdir/etc/icinga2/features-enabled/checker.conf" + rm "$pkgdir/etc/icinga2/features-enabled/mainlog.conf" + rm "$pkgdir/etc/icinga2/features-enabled/notification.conf" + rm -r "$pkgdir/run" + mkdir -p "$pkgdir/usr/lib/tmpfiles.d" + cat > "$pkgdir/usr/lib/tmpfiles.d/icinga2.conf" <<- EOF +d /run/icinga2 0750 icinga icingacmd - +d /run/icinga2/cmd 2750 icinga icingacmd - +EOF + cd .. + + install -Dm644 tools/syntax/vim/ftdetect/icinga2.vim "$pkgdir/usr/share/vim/vimfiles/ftdetect/icinga2.vim" + install -Dm644 tools/syntax/vim/syntax/icinga2.vim "$pkgdir/usr/share/vim/vimfiles/syntax/icinga2.vim" + install -Dm644 tools/syntax/nano/icinga2.nanorc "$pkgdir/usr/share/nano/icinga2.nanorc" + + chmod 750 "$pkgdir/etc/icinga2" \ + "$pkgdir/var/lib/icinga2" \ + "$pkgdir/var/spool/icinga2" \ + "$pkgdir/var/cache/icinga2" \ + "$pkgdir/var/log/icinga2" + + rm "$pkgdir"/etc/init.d/$pkgname + + chown -R $pkgusers:$pkggroups "$pkgdir"/etc/icinga2 + chown -R $pkgusers:$pkggroups "$pkgdir"/var/lib/icinga2 + chown $pkgusers:$pkggroups "$pkgdir"/var/spool/icinga2 + chown $pkgusers:$pkggroups "$pkgdir"/var/cache/icinga2/perfdata + chown -R $pkgusers:${pkggroups}cmd "$pkgdir"/var/cache/icinga2 + chown -R $pkgusers:${pkggroups}cmd "$pkgdir"/var/log/icinga2 + + install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname + cat >"$pkgdir"/usr/share/doc/$pkgname/README.alpine <<EOF + +Add the web server user to the icingacmd group in order to grant it write +permissions to the external command pipe and livestatus socket: + +For nginx, as example: + # adduser nginx icingacmd + +For Apache: + # adduser apache icingacmd + +For lighttpd: + # adduser lighttpd icingacmd +EOF +} + +bashcomp() { + depends="bash" + pkgdesc="Bash completions for $pkgname" + arch="noarch" + mkdir -p "$subpkgdir"/usr/share/bash-completion/completions + mv "$pkgdir"/etc/bash_completion.d/$pkgname "$subpkgdir"/usr/share/bash-completion/completions/$pkgname +} + + +md5sums="cd393ac62a754cc34f858eca0b706b15 icinga2-2.4.7.tar.gz +11d269affec451c7153a617929314bf9 icinga2.initd" +sha256sums="db00c3bf1be5b18a477953f39df467039521d4f00826951d5c6de43cef96acd9 icinga2-2.4.7.tar.gz +bdd669692d016116f8e1f623c9d145f73864a5637cdebde4ad8eaa4c3a9cc13e icinga2.initd" +sha512sums="2674eca10af63d59d640d9e9c2af6dc22381669fc8defbf11b4cd388fa3b63fb838ee09fd98a3d6bff6816a108ed025fc113cce55e481497c714b7df8def9d2d icinga2-2.4.7.tar.gz +f368ea15be7054503924696129fe6b413f9a5cb5344af89f9a0f84df98ac7ef8ab135de60845deced55a982b6b037ce1a00b437189c78fcab981d1e3babec2d5 icinga2.initd" diff --git a/community/icinga2/icinga2.initd b/community/icinga2/icinga2.initd new file mode 100644 index 0000000000..8fb13162e3 --- /dev/null +++ b/community/icinga2/icinga2.initd @@ -0,0 +1,84 @@ +#!/sbin/openrc-run +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +extra_started_commands="reload" + +DAEMON="/usr/sbin/icinga2" +ICINGA2_ERROR_LOG="/var/log/icinga2/error.log" +ICINGA2_STARTUP_LOG="/var/log/icinga2/startup.log" +ICINGA2_LOG="/var/log/icinga2/icinga2.log" +ICINGA2_CONFIG_FILE="/etc/icinga2/icinga2.conf" +ICINGA2_RUN_DIR="/run/icinga2" +ICINGA2_STATE_DIR="/var/cache/icinga2" +ICINGA2_CMD_DIR="${ICINGA2_RUN_DIR}/cmd" +ICINGA2_PID_FILE="${ICINGA2_RUN_DIR}/icinga2.pid" +ICINGA2_DAEMON_ARGS="daemon -c $ICINGA2_CONFIG_FILE -e $ICINGA2_ERROR_LOG -d" + +depend() { + need net +} + +checkconfig() { + if [ ! -e "$ICINGA2_CONFIG_FILE" ]; then + ewarn "Config file '$ICINGA2_CONFIG_FILE' does not exist." + eend 1 + fi + + ICINGA2_USER=$($DAEMON variable get --current RunAsUser) + if [ $? != 0 ]; then + eerror "Could not fetch RunAsUser variable: '$ICINGA2_USER'." + return 1 + fi + ICINGA2_GROUP=$($DAEMON variable get --current RunAsGroup) + if [ $? != 0 ]; then + eerror "Could not fetch RunAsGroup variable: '$ICINGA2_GROUP'." + return 1 + fi + + checkpath -d -m 0750 -o $ICINGA2_USER:$ICINGA2_GROUP $ICINGA2_RUN_DIR + checkpath -d -m 0750 -o $ICINGA2_USER:$ICINGA2_GROUP $ICINGA2_STATE_DIR + checkpath -d -m 2750 -o $ICINGA2_USER:$ICINGA2_GROUP $ICINGA2_CMD_DIR + + if ! $DAEMON daemon -c $ICINGA2_CONFIG_FILE -C > $ICINGA2_STARTUP_LOG 2>&1; then + eerror "Icinga2 detected configuration errors. Check '$ICINGA2_STARTUP_LOG' for details." + return 1 + fi +} + +start() { + checkconfig || return 1 + + ebegin "Starting icinga2" + start-stop-daemon --start --exec "${DAEMON}" \ + --pidfile "${ICINGA2_PID_FILE}" \ + -- $ICINGA2_DAEMON_ARGS > $ICINGA2_STARTUP_LOG 2>&1 + local retval=$? + if [ $retval -ne 0 ]; then + ewarn "Error starting icinga2. '$ICINGA2_STARTUP_LOG' for details." + fi + eend $retval +} + +stop() { + ebegin "Stopping icinga2" + start-stop-daemon \ + --stop \ + --pidfile $ICINGA2_PID_FILE \ + --retry "SIGTERM/15 SIGKILL/30" \ + --progress + eend $? +} + +reload() { + checkconfig || return 1 + + ebegin "Reloading icinga2" + start-stop-daemon --signal HUP --pidfile "$ICINGA2_PID_FILE" + + local retval=$? + if [ $retval -ne 0 ]; then + ewarn "Error reloading icinga2." + fi + eend $retval +} diff --git a/community/icinga2/icinga2.post-install b/community/icinga2/icinga2.post-install new file mode 100644 index 0000000000..9222e0492c --- /dev/null +++ b/community/icinga2/icinga2.post-install @@ -0,0 +1,5 @@ +#!/bin/sh +/usr/bin/icinga2 feature enable checker &> /dev/null +/usr/bin/icinga2 feature enable mainlog &> /dev/null +/usr/bin/icinga2 feature enable notification &> /dev/null +exit 0 diff --git a/community/icinga2/icinga2.pre-install b/community/icinga2/icinga2.pre-install new file mode 100644 index 0000000000..cd2a432c44 --- /dev/null +++ b/community/icinga2/icinga2.pre-install @@ -0,0 +1,6 @@ +#!/bin/sh +addgroup icinga 2>/dev/null +addgroup icingacmd 2>/dev/null +adduser -S -G icinga -H -h /var/spool/icinga2 -s /sbin/nologin -D icinga 2>/dev/null +adduser icinga icingacmd 2>/dev/null 2>/dev/null +exit 0 |