summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorIdares2015-08-05 17:56:11 +0200
committerIdares2015-08-05 17:56:11 +0200
commitce43a446091ed39485387193f2648a7d0dd10896 (patch)
tree42bebe300acb391b87135c8b0679a3a5632c8b2f
downloadaur-ce43a446091ed39485387193f2648a7d0dd10896.tar.gz
Initial import
-rw-r--r--.SRCINFO26
-rw-r--r--PKGBUILD81
-rw-r--r--nagios.install41
-rw-r--r--nagios.service11
4 files changed, 159 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..c21df4a8963d
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,26 @@
+pkgbase = nagios
+ pkgdesc = Nagios is an open source host, service and network monitoring program.
+ pkgver = 4.0.8
+ pkgrel = 1
+ url = http://www.nagios.org
+ install = nagios.install
+ arch = i686
+ arch = x86_64
+ license = GPL
+ depends = gd
+ depends = freetype2
+ depends = libtool
+ depends = glib2
+ optdepends = monitoring-plugins: a bundle of standard plugins
+ source = http://downloads.sourceforge.net/nagios/nagios-4.0.8.tar.gz
+ source = nagios.install
+ source = nagios.service
+ md5sums = 4bba4eef427cfb113fb513b6166a6af6
+ md5sums = e11fa7de430ed858269f82e179fc87ca
+ md5sums = 49e077f2d61ede589f55bfd03b597ab0
+ sha1sums = d49586db6905a8e58a082251d8f89ef5c2cab872
+ sha1sums = 04008cee208226e60b099550bd9ec7dc78cb1457
+ sha1sums = 0df0b4c6976c1562b03e261926b7c2cae6061595
+
+pkgname = nagios
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..1743ab2acf9d
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,81 @@
+# Maintainer: Idares <idares@seznam.cz>
+
+pkgname=nagios
+pkgver=4.0.8
+pkgrel=1
+pkgdesc="Nagios is an open source host, service and network monitoring program."
+license=('GPL')
+arch=('i686' 'x86_64')
+url="http://www.nagios.org"
+depends=('gd' 'freetype2' 'libtool' 'glib2')
+optdepends=('monitoring-plugins: a bundle of standard plugins')
+source=("http://downloads.sourceforge.net/nagios/$pkgname-$pkgver.tar.gz"
+ "nagios.install"
+ "nagios.service")
+install='nagios.install'
+
+_nagios_user="nagios"
+_nagios_group="nagios"
+_instdir="usr/share/nagios"
+_bindir="usr/bin"
+_vardir="var/nagios"
+_confdir="etc/nagios"
+_httpdconfdir="etc/webapps/$pkgname/"
+_checkresultdir="var/nagios/spool/checkresults"
+_perldir="$_instdir/bin"
+
+getent group $_nagios_group > /dev/null || _nagios_group=30
+getent passwd $_nagios_user > /dev/null || _nagios_user=30
+
+build() {
+ cd $srcdir/$pkgname-$pkgver
+
+ ./configure \
+ --with-nagios-user=$_nagios_user \
+ --with-nagios-group=$_nagios_group \
+ --prefix="/$_instdir" \
+ --bindir="/$_bindir" \
+ --localstatedir="/$_vardir" \
+ --sysconfdir="/$_confdir" \
+ --with-httpd-conf="/$_httpdconfdir" \
+ --with-checkresultdir="/$_checkresultdir" \
+ --enable-embedded-perl
+
+ make all
+}
+
+package() {
+ cd $srcdir/$pkgname-$pkgver
+
+ make \
+ prefix=$pkgdir/$_instdir \
+ BINDIR=$pkgdir/$_bindir \
+ LOGDIR=$pkgdir/$_vardir \
+ CFGDIR=$pkgdir/$_confdir \
+ HTTPD_CONF=$pkgdir/$_httpdconfdir \
+ CHECKRESULTDIR=$pkgdir/$_checkresultdir \
+ install install-config
+
+ install -D -m 755 daemon-init $pkgdir/etc/nagios/
+# install -D -m 644 sample-config/httpd.conf $pkgdir/$_httpdconfdir/nagios.conf
+ install -D -m 644 sample-config/httpd.conf $pkgdir/$_httpdconfdir/apache.example.conf
+ install -D -m 644 $srcdir/nagios.service $pkgdir/usr/lib/systemd/system/nagios.service
+
+ mkdir $pkgdir/var/nagios/rw
+ chown $_nagios_user.$_nagios_group $pkgdir/var/nagios/rw
+ chmod 755 $pkgdir/var/nagios/rw
+
+ chmod 755 $pkgdir/usr/bin
+ chmod 755 $pkgdir/usr/bin/nagios
+
+ find $pkgdir/etc/nagios -name '*cfg' -exec mv "{}" "{}.sample" \; > /dev/null
+
+}
+
+md5sums=('4bba4eef427cfb113fb513b6166a6af6'
+ 'e11fa7de430ed858269f82e179fc87ca'
+ '49e077f2d61ede589f55bfd03b597ab0')
+sha1sums=('d49586db6905a8e58a082251d8f89ef5c2cab872'
+ '04008cee208226e60b099550bd9ec7dc78cb1457'
+ '0df0b4c6976c1562b03e261926b7c2cae6061595')
+
diff --git a/nagios.install b/nagios.install
new file mode 100644
index 000000000000..36f038c0dd1f
--- /dev/null
+++ b/nagios.install
@@ -0,0 +1,41 @@
+# arg 1: the new package version
+
+post_install() {
+ cat <<EOM
+
+--> Sample config files are installed with .sample extension.
+--> Remember, these are *SAMPLE* config files. You'll need to read
+--> the documentation for more information on how to actually define
+--> services, hosts, etc. to fit your particular needs.
+
+EOM
+
+ getent group nagios > /dev/null || groupadd -g 30 nagios > /dev/null
+ getent passwd nagios > /dev/null || useradd -u 30 -g nagios -d /dev/null -s /bin/false nagios > /dev/null
+}
+
+pre_upgrade() {
+
+ _httpdconf="/etc/httpd/conf/extra/nagios.conf"
+ if [ -f $_httpdconf ]; then
+ cp $_httpdconf $_httpdconf.pacsave
+ fi
+
+}
+
+post_upgrade() {
+
+ post_install
+
+ find /var/nagios -user nobody -exec chown nagios.nagios {} \;
+ if [ -f /var/log/nagios.log ]; then
+ chown nagios /var/log/nagios.log
+ fi
+
+ _httpdconf="/etc/httpd/conf/extra/nagios.conf"
+ if [ ! -f $_httpdconf -a -f $_httpdconf.pacsave ]; then
+ cp $_httpdconf.pacsave $_httpdconf
+ fi
+
+}
+
diff --git a/nagios.service b/nagios.service
new file mode 100644
index 000000000000..69d6564019c9
--- /dev/null
+++ b/nagios.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Nagios Monitoring System
+After=network.target
+
+[Service]
+ExecStart=/usr/bin/nagios /etc/nagios/nagios.cfg
+ExecReload=/bin/kill -HUP $MAINPID
+KillMode=process
+
+[Install]
+WantedBy=multi-user.target