Subject: [alpine-devel] testing aport for nagios with stack issues.

From: "Carlo Landmeter" <[email-masked]>
Date: Thu, 05 Feb 2009 09:58:16 +0000

see attached patch.

carlo

From 516d286162280ea3670b135efb1ac76cf5c5799a Mon Sep 17 00:00:00 2001
From: Carlo Landmeter <[email-masked]>
Date: Thu, 5 Feb 2009 09:56:57 +0000
Subject: [PATCH] testing/nagios: new testing aport.

---
 testing/nagios/APKBUILD             |   55 +++++++++++++++++++++++++++++++++++
 testing/nagios/lighttpd-nagios.conf |   29 ++++++++++++++++++
 testing/nagios/nagios.confd         |    9 ++++++
 testing/nagios/nagios.initd         |   38 ++++++++++++++++++++++++
 4 files changed, 131 insertions(+), 0 deletions(-)
 create mode 100644 testing/nagios/APKBUILD
 create mode 100644 testing/nagios/lighttpd-nagios.conf
 create mode 100644 testing/nagios/nagios.confd
 create mode 100644 testing/nagios/nagios.initd

diff --git a/testing/nagios/APKBUILD b/testing/nagios/APKBUILD
new file mode 100644
index 0000000..ede82bb
--- /dev/null
+++ b/testing/nagios/APKBUILD
@@ -0,0 +1,55 @@
+# Contributor: Carlo Landmeter <clandmeter at gmail>
+# Maintainer: Carlo Landmeter <clandmeter at gmail>
+pkgname=nagios
+pkgver=3.1.0
+pkgrel=0
+pkgdesc="Popular monitoring tool"
+url="http://www.nagios.org/"
+license="GPL-2"
+depends="gd perl"
+makedepends="gd-dev pkgconfig perl-dev"
+source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
+nagios.confd
+nagios.initd
+lighttpd-nagios.conf"
+subpackages="${pkgname}-web"
+
+build() {
+	cd "$srcdir/$pkgname-$pkgver"
+
+	./configure --prefix=/usr \
+		--sysconfdir=/etc/nagios \
+		--mandir=/usr/share/man \
+		--infodir=/usr/share/info \
+		--datadir=/usr/share/nagios \
+		--localstatedir=/var \
+		--bindir=/usr/sbin \
+		--sbindir=/usr/lib/nagios/cgi-bin \
+		--datadir=/usr/share/nagios/htdocs \
+		--libexecdir=/usr/lib/nagios/plugins \
+		--localstatedir=/var/nagios \
+		--with-nagios-user=nobody \
+		--with-nagios-group=nobody \
+		--enable-embedded-perl \
+		--with-perlcache
+	make all || return 1
+	make DESTDIR="$pkgdir" install
+	make DESTDIR="$pkgdir" install-config
+	make DESTDIR="$pkgdir" install-commandmode
+
+	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+	install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
+}
+
+
+web() {
+	#depends="php lighttpd"
+	mkdir -p "$subpkgdir"/usr
+	mv "$pkgdir"/usr/share "$subpkgdir"/usr/
+	install -m644 -D "$srcdir"/lighttpd-nagios.conf "$subpkgdir"/etc/lighttpd-nagios.conf
+}
+
+md5sums="02d3b0e13f772481d0ac9e00bdc3e979  nagios-3.1.0.tar.gz
+431dfe7403323e247a88b97beade5d78  nagios.confd
+73fe73c8e31b8a59b5f3206bc90a74e8  nagios.initd
+d63c36f47d26f1f71ae2faf272eec640  lighttpd-nagios.conf"
diff --git a/testing/nagios/lighttpd-nagios.conf b/testing/nagios/lighttpd-nagios.conf
new file mode 100644
index 0000000..cb7081d
--- /dev/null
+++ b/testing/nagios/lighttpd-nagios.conf
@@ -0,0 +1,29 @@
+###
+# Sample nagios lighttpd config
+###
+
+server.modules += ("mod_cgi")
+server.modules += ("mod_auth")
+server.modules += ("mod_alias")
+
+auth.require += ( "/nagios" =>
+  (
+    "method"  => "digest",
+    "realm"   => "nagios",
+    "require" => "valid-user"
+  )
+)
+
+$HTTP["url"] =~ "^/nagios/cgi-bin/" {
+  dir-listing.activate = "disable"
+  cgi.assign = (
+    ".pl"  => "/usr/bin/perl",
+    ".cgi" => ""
+  )
+}
+
+alias.url += (
+  "/nagios/cgi-bin" => "/usr/lib/nagios/cgi-bin",
+  "/nagios"         => "/usr/share/nagios/htdocs"
+)
+
diff --git a/testing/nagios/nagios.confd b/testing/nagios/nagios.confd
new file mode 100644
index 0000000..0abb80c
--- /dev/null
+++ b/testing/nagios/nagios.confd
@@ -0,0 +1,9 @@
+# Sample conf.d file for alpine linux
+
+#
+# Specify daemon $OPTS here.
+#
+
+OPTS=""
+USER="nobody"
+GROUP="nobody"
diff --git a/testing/nagios/nagios.initd b/testing/nagios/nagios.initd
new file mode 100644
index 0000000..ce44103
--- /dev/null
+++ b/testing/nagios/nagios.initd
@@ -0,0 +1,38 @@
+#!/sbin/runscript
+
+# Sample init.d file for alpine linux.
+
+NAME=nagios
+DAEMON=/usr/sbin/$NAME
+
+depend() {
+	need net
+}
+
+start() {
+	ebegin "Starting ${NAME}"
+		start-stop-daemon --start --quiet --background \
+			--make-pidfile --pidfile /var/run/${NAME}.pid \
+			--exec ${DAEMON} -- ${OPTS} /etc/nagios/nagios.cfg
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping ${NAME}"
+		start-stop-daemon --stop --quiet \
+			--exec ${DAEMON} \
+			--pidfile /var/run/${NAME}.pid \
+	eend $?
+}
+
+reload() {
+	ebegin "Reloading ${NAME}"
+	if ! service_started "${NAME}" ; then
+		eend 1 "${NAME} is not started"
+		return 1
+	fi
+	start-stop-daemon --stop --oknodo --signal HUP \
+		--exec ${DAEMON} --pidfile /var/run/${NAME}.pid
+	eend $?
+}
+
-- 
1.6.1