aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-09-26 21:19:26 +0200
committerJakub Jirutka <jakub@jirutka.cz>2017-09-26 21:20:11 +0200
commit111e1703a0b8deff86d928b7d87972fdbc6200cb (patch)
treee5ba691a28e83563c4745835b9e756af7e4c398a
parentb9587abdcaf5412957f83c2583a4e56b09ba1936 (diff)
main/nagios-plugins: add plugin check_openrc
-rw-r--r--main/nagios-plugins/APKBUILD15
-rw-r--r--main/nagios-plugins/check_openrc11
2 files changed, 21 insertions, 5 deletions
diff --git a/main/nagios-plugins/APKBUILD b/main/nagios-plugins/APKBUILD
index 485d2dc0d26..a80f177f189 100644
--- a/main/nagios-plugins/APKBUILD
+++ b/main/nagios-plugins/APKBUILD
@@ -3,7 +3,7 @@
# Maintainer: Jeff Bilyk <jbilyk@gmail.com>
pkgname=nagios-plugins
pkgver=2.2.1
-pkgrel=0
+pkgrel=1
pkgdesc="Plugins for Nagios to check services on hosts"
url="https://nagios-plugins.org"
arch="all"
@@ -26,7 +26,8 @@ install="$pkgname.post-upgrade"
pkgusers="nagios"
pkggroups="nagios"
options="suid"
-source="https://www.nagios-plugins.org/download/$pkgname-$pkgver.tar.gz"
+source="https://www.nagios-plugins.org/download/$pkgname-$pkgver.tar.gz
+ check_openrc"
builddir="$srcdir/$pkgname-$pkgver"
_plugins_dir="/usr/lib/nagios/plugins"
@@ -34,8 +35,9 @@ _plugins_dir="/usr/lib/nagios/plugins"
# Note: Split function takes $name*, so ntp must be before nt etc.
_plugins="breeze by_ssh cluster dbi dhcp dig disk_smb disk dns dummy file_age
fping hpjd http icmp ide_smart ifoperstatus ifstatus ircd ldap load log
- mailq mrtgtraf mrtg mysql nagios ntp nt nwstat overcr pgsql ping procs
- radius real rpc sensors smtp snmp ssh swap time ups uptime users wave"
+ mailq mrtgtraf mrtg mysql nagios ntp nt nwstat openrc overcr pgsql ping
+ procs radius real rpc sensors smtp snmp ssh swap time ups uptime users
+ wave"
for _sub in $_plugins; do
subpackages="$subpackages $pkgname-$_sub:_plugin"
done
@@ -74,6 +76,8 @@ package() {
make DESTDIR="$pkgdir" install
+ install -m 755 "$srcdir"/check_openrc "$pkgdir/$_plugins_dir"/
+
# Remove plugins that are useless or doesn't work on Alpine.
local name; for name in apt flexlm oracle; do
rm "$pkgdir/$_plugins_dir"/check_$name
@@ -133,4 +137,5 @@ _all() {
return $retval
}
-sha512sums="6ffe313a56a305b382f62abc0f0958d7078f9050e1340f30721d6e6f71944b57b1650e90e6835c35dd7c9f3f4b4cee9f235b8382b0811db30b3729daaafc9bc3 nagios-plugins-2.2.1.tar.gz"
+sha512sums="6ffe313a56a305b382f62abc0f0958d7078f9050e1340f30721d6e6f71944b57b1650e90e6835c35dd7c9f3f4b4cee9f235b8382b0811db30b3729daaafc9bc3 nagios-plugins-2.2.1.tar.gz
+12d87542631494df1c961e547c19107a025829509e174e8208111736141c12e20dbf490c55d487af39d47cefca5507cd98c973b7b20ae3f961dcbfd167195d8e check_openrc"
diff --git a/main/nagios-plugins/check_openrc b/main/nagios-plugins/check_openrc
new file mode 100644
index 00000000000..b21d6baebf7
--- /dev/null
+++ b/main/nagios-plugins/check_openrc
@@ -0,0 +1,11 @@
+#!/bin/sh
+# vim: set ts=4:
+
+crashed=$(sudo rc-status --crashed)
+
+if [ -n "$crashed" ]; then
+ echo "CRITICAL - crashed services: ${crashed//$'\n'/, }"
+ exit 2
+else
+ echo 'OK'
+fi