Merge branch 'master' of ssh://db.debian.org/git/dsa-nagios
authorPeter Palfrader <peter@palfrader.org>
Tue, 1 Mar 2011 17:22:30 +0000 (18:22 +0100)
committerPeter Palfrader <peter@palfrader.org>
Tue, 1 Mar 2011 17:22:30 +0000 (18:22 +0100)
* 'master' of ssh://db.debian.org/git/dsa-nagios:
  fix typo
  add faw, add gw for santoro Signed-off-by: Martin Zobel-Helas <zobel@debian.org>
  add santoro, yes, i know we need to fix the gw Signed-off-by: Martin Zobel-Helas <zobel@debian.org>
  piatti to squeeze
  I can't believe that has ever worked
  kassia squeeze Signed-off-by: Martin Zobel-Helas <zobel@debian.org>
  tchaikovsky to squeeze
  scelsi to squeeze
  rossini now squeeze
  typo Signed-off-by: Martin Zobel-Helas <zobel@debian.org>
  rem has a new IP Signed-off-by: Martin Zobel-Helas <zobel@debian.org>
  arne on squeeze
  oops, bad steve writing bad yaml
  new check for mail queue size on heavy_exim
  except it has a different hostgroup name
  kokkonen has apache now
  make nagios shut up Signed-off-by: Martin Zobel-Helas <zobel@debian.org>
  englund has apache now

config/nagios-master.cfg
dsa-nagios-checks/checks/dsa-check-resolver [new file with mode: 0755]
dsa-nagios-checks/debian/changelog
dsa-nagios-checks/debian/copyright

index d74c6e2..e7fbc78 100644 (file)
@@ -1695,6 +1695,11 @@ services:
     depends: process - postfix - master
     normal_check_interval: 120
 
+  -
+    name: setup - local resolver
+    nrpe: "/usr/lib/nagios/plugins/dsa-check-resolver www.debian.org www.google.com"
+    hostgroups: computers
+    normal_check_interval: 60
 
   -
     name: setup - dsa config
diff --git a/dsa-nagios-checks/checks/dsa-check-resolver b/dsa-nagios-checks/checks/dsa-check-resolver
new file mode 100755 (executable)
index 0000000..f05d6a6
--- /dev/null
@@ -0,0 +1,77 @@
+#!/usr/bin/python
+
+# Copyright 2011 Peter Palfrader
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+import datetime
+import socket
+import optparse
+import sys
+
+parser = optparse.OptionParser()
+parser.set_usage("%prog <hostname> [<hostname> ..]")
+parser.add_option("-t", "--timeout", dest="timeout", metavar="TIMEOUT",
+  type="int", default=500,
+  help="Resolve timeout in msecs [500].")
+(options, args) = parser.parse_args()
+
+if len(args) == 0:
+    parser.print_help()
+    sys.exit(4)
+
+def check(hostname):
+    now = datetime.datetime.now()
+    try:
+        socket.gethostbyname(hostname)
+    except:
+        return None
+    then = datetime.datetime.now()
+
+    td = then - now
+    msecs = td.microseconds/1000 + (td.seconds + td.days * 24 * 3600) * 1000
+    return msecs
+
+msg = []
+ret = 0
+oklist = []
+slowlist = []
+faillist = []
+for hostname in args:
+    time = check(hostname)
+    if time is None:
+        faillist.append(hostname)
+        ret = 2
+    elif time > options.timeout:
+        slowlist.append(hostname)
+        ret = max(ret, 1)
+    else:
+        oklist.append(hostname)
+
+if len(faillist) > 0: msg.append("FAILED: %s"%(', '.join(faillist)))
+if len(slowlist) > 0: msg.append("SLOW: %s"%(', '.join(slowlist)))
+if len(oklist) > 0: msg.append("OK: %s"%(', '.join(oklist)))
+
+print '; '.join(msg)
+sys.exit(ret)
+
+# vim:set et:
+# vim:set ts=4:
+# vim:set shiftwidth=4:
index c0c55f9..ebf3090 100644 (file)
@@ -1,5 +1,11 @@
 dsa-nagios-checks (8x) xnstable; urgency=low
 
+  * 
+
+ -- Peter Palfrader <weasel@debian.org>  Tue, 01 Mar 2011 18:11:55 +0100
+
+dsa-nagios-checks (88) unstable; urgency=low
+
   * dsa-check-hpacucli
     - Also accept 'Unknown, 3.0GBPS' as a valid transfer speed in addition
       to '3.0GBPS, Unknown'.
@@ -21,8 +27,9 @@ dsa-nagios-checks (8x) xnstable; urgency=low
     that do not say 'Yes' in the present-line.
   * dsa-check-udldap-freshness: Also check age of /var/lib/misc/passwd.db
     in addition to /var/lib/misc/thishost/passwd.tdb.
+  * Add dsa-check-resolver.
 
- -- Peter Palfrader <weasel@debian.org>  Mon, 24 Jan 2011 16:26:44 +0100
+ -- Peter Palfrader <weasel@debian.org>  Tue, 01 Mar 2011 18:10:25 +0100
 
 dsa-nagios-checks (87) unstable; urgency=low
 
index b6f8bdd..9e11e5f 100644 (file)
@@ -105,3 +105,8 @@ dsa-check-raid-megaraid:
 dsa-check-backuppg:
   Copyright: 2010 Peter Palfrader
   License: MIT
+
+########################################################################
+dsa-check-resolver:
+  Copyright: 2011 Peter Palfrader
+  License: MIT