]> arthur.barton.de Git - nagcollect.git/commitdiff
Merge branch 'master' of /srv/git/nagcollect
authorAlexander Barton <alex@barton.de>
Mon, 21 Nov 2011 10:51:18 +0000 (11:51 +0100)
committerAlexander Barton <alex@barton.de>
Mon, 21 Nov 2011 10:51:18 +0000 (11:51 +0100)
* 'master' of /srv/git/nagcollect:
  Update ChangeLog for release 3
  Update README and INSTALL to describe active service checks
  Fix error message of wrapper script for active checks
  New make target "install-plugins"
  Use new make targets "server", "client", and "plugins"
  New make target "plugins" to generate active check scripts
  Add wrapper script for calling test scripts as active service checks
  Add .gitignore file
  Add "nagcollecttest" script
  RAID.tst: suppress warning and error messages

.gitignore [new file with mode: 0644]
ChangeLog
INSTALL
Makefile
README
client/bin/nagcollecttest [new file with mode: 0755]
client/lib/tests/RAID.tst
client/lib/wrapper/wrapper-bottom.sh [new file with mode: 0644]
client/lib/wrapper/wrapper-top.sh [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..0607a68
--- /dev/null
@@ -0,0 +1 @@
+client/lib/nagios/
index c7d4c89c6510a95bcde6f7302851cff6d6b3bc2b..2f65ca576f3538b7a03699078edb1a57c2991218 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,6 @@
 
              NagCollect: Nagios Data Collector for Passive Checks
-           Copyright (c)2009-2010 Alexander Barton, alex@barton.de
+           Copyright (c)2009-2011 Alexander Barton, alex@barton.de
 
              NagCollect is free software and published under the
                    terms of the GNU General Public License.
@@ -8,6 +8,28 @@
                                   ChangeLog
 
 
+NagCollect Release 3 (2011-11-21)
+
+  - RAID.tst: only check RAID on Linux when /proc/md is readable
+  - Uptime.tst: uptime "<n> hrs" is critical, because <1 day!
+  - Set /usr/local/lib/nagcollect to "world readable" after update
+  - Uptime.tst: handle "<n> mins", "1 hr", and "* secs"
+  - RAID.tst: fix wrong variable name in status text output
+  - Disks.tst: Only check read-write volumes
+  - Don't exclude "." when extracting test scripts
+  - RAID.tst: Add support for Apple hardware RAID cards
+  - DiskErrors.tst: exclude false positive I/O error of mdworker
+  - Rename de.barton.nagcollect to de.barton.nagcollect.plist
+  - HardwareInfo.tst: new test to display Apple hardware serial numbers
+  - DiskErrors.tst: dont't assume "encoder error" as disk I/O error
+  - Add CRON configuration file
+  - Add Makefile for installing the client on Linux
+  - HardwareInfo.tst: New test to display DMI/SMBIOS hardware information
+  - RAID.tst: suppress warning and error messages
+  - Add "nagcollecttest" script
+  - Add wrapper script for calling test scripts as active service checks
+  - Use new make targets "server", "client", "plugins", "install-plugins"
+
 NagCollect Release 2.1 (2010-09-01)
 
   - Uptime.tst: detect new uptime string "<n> hrs"
diff --git a/INSTALL b/INSTALL
index f167143140465fd6bb9b05f4578d163b8b34a7ad..5e61bc3a0b1d01814460fa9c3a860b5e6f2035bb 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,6 +1,6 @@
 
              NagCollect: Nagios Data Collector for Passive Checks
-           Copyright (c)2009-2010 Alexander Barton, alex@barton.de
+           Copyright (c)2009-2011 Alexander Barton, alex@barton.de
 
              NagCollect is free software and published under the
                    terms of the GNU General Public License.
@@ -39,3 +39,12 @@ periodic execution, which "make install-client" does on this platform:
 
 - Start: sudo launchctl load -w /Library/LaunchDaemons/de.barton.nagcollect
 - Stop:  sudo launchctl unload -w /Library/LaunchDaemons/de.barton.nagcollect
+
+
+Plugins (active checks)
+~~~~~~~~~~~~~~~~~~~~~~~
+
+1. Run "make install-plugins".
+
+The plugins will be build (generated using the passive service checks and
+a wrapper script) and installed into /usr/local/lib/nagios/plugins/.
index ef19ad4bb63a68d53f99b8bf2673378e99a080d3..ba9bd211da4e64cd58e2e0f9daddbb96cd6d3b4d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 #
 # NagCollect -- Nagios Data Collector for Passive Checks
-# Copyright (c)2009-2010 Alexander Barton, alex@barton.de
+# Copyright (c)2009-2011 Alexander Barton, alex@barton.de
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -9,20 +9,21 @@
 # Please read the file COPYING, README and AUTHORS for more information.
 #
 
-all:
+all: server client plugins
 
 clean:
        find . -name .DS_Store -delete
+       rm -rf client/lib/nagios
 
 distclean: clean
 
 install:
-       @echo " ** Use make targets 'install-client', 'install-server' and 'install-all'"
-       @echo " ** to install client and/or server components!"
+       @echo " ** Use make targets 'install-client', 'install-server', 'install-plugins'
+       @echo " ** or 'install-all' to install client, server and or plugin components!"
 
-install-all: install-server install-client
+install-all: install-server install-client install-plugins
 
-install-server:
+install-server: server
        install -d -o nagios -g nagios -m 750 /var/lib/nagios3/collect
        [ -r /etc/nagios3/system.cfg ] || \
         install -D -o nagios -g root -m 640 -p \
@@ -39,7 +40,7 @@ install-server:
        [ -r contrib/Makefile.`uname` ] \
                && make -f contrib/Makefile.`uname` "install-server" || true
 
-install-client:
+install-client: client
        install -d -o 0 -g 0 -m 755 /usr/local/sbin
        install -c -o 0 -g 0 -m 755 -p \
                client/bin/nagcollect /usr/local/sbin/nagcollect
@@ -59,6 +60,14 @@ install-client:
        [ -r contrib/Makefile.`uname` ] \
                && make -f contrib/Makefile.`uname` "install-client" || true
 
+install-plugins: plugins
+       install -d -o 0 -g 0 -m 755 /usr/local/lib/nagios/plugins
+       (cd client/lib/nagios/plugins; find . -name 'check_nc_*' | \
+        while read x; do \
+         install -o 0 -g 0 -m 755 "$$x" "/usr/local/lib/nagios/plugins/$$x"; \
+        done \
+       )
+
 check:
 
 dist: distclean
@@ -70,6 +79,24 @@ dist: distclean
 
 distcheck: check dist
 
+server:
+
+client:
+
+plugins:
+       mkdir -p client/lib/nagios/plugins
+       (cd client/lib/tests; (ls -1 *.tst; ls -1 `uname`/*.tst) | \
+        while read x; do \
+               name="check_nc_`basename "$$x" | cut -d'.' -f1 | tr '[A-Z]' '[a-z]'`"; \
+               dest="../nagios/plugins/$$name"; \
+               echo " * $$x -> $$name"; \
+               cat "../wrapper/wrapper-top.sh" >"$$dest"; \
+               cat "$$x" >>"$$dest"; \
+               cat "../wrapper/wrapper-bottom.sh" >>"$$dest"; \
+               chmod 755 "$$dest"; \
+        done \
+       )
+
 osxpkg:
        rel=`grep "^NagCollect " ChangeLog|awk "{print \\\$$3 }"|head -n 1`; \
         rm -rf "../NagCollect-R$${rel}.mpkg" \
@@ -88,6 +115,7 @@ nagcollecttestscripts:
         -C client/lib/tests .
 
 .PHONY: all install install-all install-server install-client \
-       clean distclean check dist distcheck nagcollecttestscripts
+       install-plugins clean distclean check dist distcheck server client \
+       plugins osxpkg osxdmg nagcollecttestscripts
 
 # -eof-
diff --git a/README b/README
index b12d7cdb3094b2560c9f6ebf293c5267c18c0234..8b7e876b53fce3149acd5198855dc99c40bc8787 100644 (file)
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 
              NagCollect: Nagios Data Collector for Passive Checks
-              Copyright (c)2009 Alexander Barton, alex@barton.de
+           Copyright (c)2009-2011 Alexander Barton, alex@barton.de
 
              NagCollect is free software and published under the
                    terms of the GNU General Public License.
@@ -12,4 +12,7 @@ NagCollect is a bunch of PHP and shell scripts to enhance Nagios3 to better
 handle passive host and service checks. It consists of some scripts that must
 be installed on the server and others that must run on the clients.
 
+In addition, the passive service checks can be used as active check scripts
+using a wrapper script included in this distribution.
+
 See the file INSTALL for details.
diff --git a/client/bin/nagcollecttest b/client/bin/nagcollecttest
new file mode 100755 (executable)
index 0000000..e31644f
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/bash
+#
+# NagCollect -- Nagios Data Collector for Passive Checks
+# Copyright (c)2009-2011 Alexander Barton, alex@barton.de
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# Please read the file COPYING, README and AUTHORS for more information.
+#
+
+NAME=`basename "$0"`
+MAXTIME=300
+
+if [ $# -ne 1 ]; then
+       echo "Usage: $NAME <scriptname>"
+       exit 2
+fi
+if [ `id -u` -ne 0 ]; then
+       echo "$NAME must be run as root!"
+       exit 2
+fi
+
+if [ -r /usr/local/lib/nagcollect/"$1.tst" ]; then
+       tst=/usr/local/lib/nagcollect/"$1.tst"
+elif [ -r /usr/local/lib/nagcollect/`uname`/"$1.tst" ]; then
+       tst=/usr/local/lib/nagcollect/`uname`/"$1.tst"
+else
+       echo "$NAME: script \"$1\" not found!"
+       exit 2
+fi
+
+SERVICE=""; STATUS=""; TEXT=""
+echo "Checking \"$tst\" ..."
+. "$tst"
+echo "RESULT: $SERVICE=$STATUS \"$TEXT\""
+
+# -eof-
index 074113d65c648164268c1f200687a88ac5b3054e..d814588d4f83dd27316e8e84b84d97502850f525 100644 (file)
@@ -5,7 +5,7 @@ SERVICE="RAID_p"
 
 if [ `uname` = "Darwin" ]; then
        tmp=`mktemp "/tmp/$$.XXXX"`
-       LC_ALL=C diskutil checkRAID >"$tmp"
+       LC_ALL=C diskutil checkRAID >"$tmp" 2>/dev/null
        if [ $? -eq 0 ]; then
                # Apple Software-RAID detected
                statusString1=`grep "^Status:" "$tmp" | uniq`
@@ -20,7 +20,7 @@ if [ `uname` = "Darwin" ]; then
                        TEXT="OK - RAID status is good."
                fi
        fi
-       LC_ALL=C raidutil list status | grep "RAID " >"$tmp"
+       LC_ALL=C raidutil list status 2>/dev/null | grep "RAID " >"$tmp"
        if [ $? -eq 0 ]; then
                # Apple Hardware-RAID detected
                declare -i good=0
diff --git a/client/lib/wrapper/wrapper-bottom.sh b/client/lib/wrapper/wrapper-bottom.sh
new file mode 100644 (file)
index 0000000..e298c0d
--- /dev/null
@@ -0,0 +1,12 @@
+
+# BEGIN: wrapper-bottom.sh
+
+if [ -z "$TEXT" -o -z "$STATUS" ]; then
+       echo "Test script failed! Check not supported on this system?"
+       exit 3
+fi
+
+echo "$TEXT"
+exit "$STATUS"
+
+# -eof-
diff --git a/client/lib/wrapper/wrapper-top.sh b/client/lib/wrapper/wrapper-top.sh
new file mode 100644 (file)
index 0000000..a6040cd
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+#
+# NagCollect -- Nagios Data Collector for Passive Checks
+# Copyright (c)2009-2011 Alexander Barton, alex@barton.de
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# Please read the file COPYING, README and AUTHORS for more information.
+#
+# Wrapper script for active service checks :-)
+#
+
+SERVICE=""; STATUS=""; TEXT=""
+
+# END: wrapper-top.sh
+