Merge branch 'master' of ssh://db.debian.org/git/dsa-nagios
authorStephen Gran <steve@lobefin.net>
Sun, 19 Feb 2012 20:13:44 +0000 (20:13 +0000)
committerStephen Gran <steve@lobefin.net>
Sun, 19 Feb 2012 20:13:44 +0000 (20:13 +0000)
config/nagios-master.cfg
dsa-nagios-checks/checks/dsa-check-packages
dsa-nagios-checks/checks/dsa-check-statusfile
dsa-nagios-checks/debian/changelog
dsa-nagios-checks/sbin/dsa-update-unowned-file-status

index 8eccb49..aac9011 100644 (file)
@@ -347,7 +347,7 @@ servers:
   mayer:
     address: 140.211.166.78
     parents: gw-osuosl
-    hostgroups: computers, buildd, hasbootfs, lenny
+    hostgroups: computers, buildd, hasbootfs, squeeze
 #  mayr:
 #    address: 140.211.166.58
 #    parents: gw-osuosl
@@ -522,7 +522,7 @@ servers:
   ancina:
     address: 157.193.39.13
     parents: gw-ghent
-    hostgroups: computers, buildd, hassrvfs, hasbootfs, incomingmailrelayed2025, xinetd-hosts, lenny
+    hostgroups: computers, buildd, hassrvfs, hasbootfs, incomingmailrelayed2025, xinetd-hosts, squeeze
     contacts: luk
 
   agnesi:
@@ -617,15 +617,15 @@ servers:
   corelli:
     address: 206.12.19.16
     parents: tchaikovsky
-    hostgroups: computers, buildd, lenny
+    hostgroups: computers, buildd, squeeze
   lucatelli:
     address: 206.12.19.15
     parents: tchaikovsky
-    hostgroups: computers, buildd, lenny
+    hostgroups: computers, buildd, squeeze
   rossini:
     address: 206.12.19.19
     parents: tchaikovsky
-    hostgroups: computers, dl585, acpid-hosts, service, squeeze
+    hostgroups: computers, dl585, acpid-hosts, service, squeeze, apache2-hosts
   salieri:
     address: 206.12.19.20
     parents: tchaikovsky
@@ -694,6 +694,18 @@ servers:
     address: 206.12.19.134
     parents: traetta
     hostgroups: computers, service, hasbootfs, kvmdomains, squeeze, xinetd-hosts, nfs-client, autofs
+  barriere:
+    address: 206.12.19.135
+    parents: traetta
+    hostgroups: computers, service, hasbootfs, kvmdomains, squeeze, hassrvfs
+  diabelli:
+    address: 206.12.19.136
+    parents: traetta
+    hostgroups: computers, service, hasbootfs, kvmdomains, squeeze, apache2-hosts
+  bizet:
+    address: 206.12.19.137
+    parents: traetta
+    hostgroups: computers, service, hasbootfs, kvmdomains, squeeze, hassrvfs, ftpd-hosts, rsyncd-hosts, heavy-exim, xinetd-hosts, apache2-hosts
 
   lebrun:
     address: 193.198.184.10
@@ -924,7 +936,11 @@ servers:
   sompek:
     address: 217.196.146.208
     parents: gw-conova
-    hostgroups: computers, buildd, hasbootfs, sw-raid, squeeze
+    hostgroups: computers, buildd, hassrvfs, sw-raid, squeeze, sparc
+  stadler:
+    address: 217.196.146.209
+    parents: gw-conova
+    hostgroups: computers, buildd, hassrvfs, sw-raid, squeeze, sparc
 
 #############################
 # host groups
@@ -1199,6 +1215,13 @@ services:
     servicegroups: diskspace
     nrpe: "/usr/lib/nagios/plugins/check_disk -X devpts -X proc -X linprocfs -X devfs -X fdescfs -X sysfs -X nfs 90 95"
     hostgroups: computers
+    excludehosts: sibelius
+  -
+    name: disk usage - all
+    servicegroups: diskspace
+    nrpe: "/usr/lib/nagios/plugins/check_disk -X devpts -X proc -X linprocfs -X devfs -X fdescfs -X sysfs -X nfs 95 98"
+    hosts: sibelius
+
   -
     name: disk usage on /
     servicegroups: diskspace
@@ -1286,47 +1309,47 @@ services:
   -
     name: disk usage on /srv/farm-snapshot/farm-01
     servicegroups: diskspace
-    nrpe: "/usr/lib/nagios/plugins/check_disk 90 95 /srv/farm-snapshot/farm-01"
+    nrpe: "/usr/lib/nagios/plugins/check_disk 95 98 /srv/farm-snapshot/farm-01"
     hosts: sibelius
   -
     name: disk usage on /srv/farm-snapshot/farm-23
     servicegroups: diskspace
-    nrpe: "/usr/lib/nagios/plugins/check_disk 90 95 /srv/farm-snapshot/farm-23"
+    nrpe: "/usr/lib/nagios/plugins/check_disk 95 98 /srv/farm-snapshot/farm-23"
     hosts: sibelius
   -
     name: disk usage on /srv/farm-snapshot/farm-45
     servicegroups: diskspace
-    nrpe: "/usr/lib/nagios/plugins/check_disk 90 95 /srv/farm-snapshot/farm-45"
+    nrpe: "/usr/lib/nagios/plugins/check_disk 95 98 /srv/farm-snapshot/farm-45"
     hosts: sibelius
   -
     name: disk usage on /srv/farm-snapshot/farm-67
     servicegroups: diskspace
-    nrpe: "/usr/lib/nagios/plugins/check_disk 90 95 /srv/farm-snapshot/farm-67"
+    nrpe: "/usr/lib/nagios/plugins/check_disk 95 98 /srv/farm-snapshot/farm-67"
     hosts: sibelius
   -
     name: disk usage on /srv/farm-snapshot/farm-89
     servicegroups: diskspace
-    nrpe: "/usr/lib/nagios/plugins/check_disk 90 95 /srv/farm-snapshot/farm-89"
+    nrpe: "/usr/lib/nagios/plugins/check_disk 95 98 /srv/farm-snapshot/farm-89"
     hosts: sibelius
   -
     name: disk usage on /srv/farm-snapshot/farm-ab
     servicegroups: diskspace
-    nrpe: "/usr/lib/nagios/plugins/check_disk 90 95 /srv/farm-snapshot/farm-ab"
+    nrpe: "/usr/lib/nagios/plugins/check_disk 95 98 /srv/farm-snapshot/farm-ab"
     hosts: sibelius
   -
     name: disk usage on /srv/farm-snapshot/farm-cd
     servicegroups: diskspace
-    nrpe: "/usr/lib/nagios/plugins/check_disk 90 95 /srv/farm-snapshot/farm-cd"
+    nrpe: "/usr/lib/nagios/plugins/check_disk 95 98 /srv/farm-snapshot/farm-cd"
     hosts: sibelius
   -
     name: disk usage on /srv/farm-snapshot/farm-f
     servicegroups: diskspace
-    nrpe: "/usr/lib/nagios/plugins/check_disk 85 95 /srv/farm-snapshot/farm-f"
+    nrpe: "/usr/lib/nagios/plugins/check_disk 95 85 /srv/farm-snapshot/farm-f"
     hosts: sibelius
   -
     name: disk usage on /srv/farm-snapshot/farm-e
     servicegroups: diskspace
-    nrpe: "/usr/lib/nagios/plugins/check_disk 85 95 /srv/farm-snapshot/farm-e"
+    nrpe: "/usr/lib/nagios/plugins/check_disk 95 85 /srv/farm-snapshot/farm-e"
     hosts: sibelius
   -
     name: disk usage on /srv/fossology.debian.net
@@ -2593,6 +2616,6 @@ services:
     hosts: giustini
   -
     name: event log
-    remotecheck: "/usr/lib/nagios/plugins/dsa-check-msa-eventlog --start=952 $HOSTADDRESS$ public"
+    remotecheck: "/usr/lib/nagios/plugins/dsa-check-msa-eventlog --start=2041 $HOSTADDRESS$ public"
     runfrom: dijkstra
     hosts: giustini
index 901c885..9a28c5a 100755 (executable)
@@ -225,45 +225,54 @@ my @reportform = (
          'listpackages' => 1,
          'long' => "%d local or obsolete packages: %s",
          'short' => "%d obs/loc",
+         'perf' => "obs_loc=%d;1;5;0",
          'status' => 'WARNING' },
        { 'key' => 'outofdate',
          'listpackages' => 1,
          'long' => "%d out of date packages: %s",
          'short' => "%d updates",
+         'perf' => "outdated=%d;1;5;0",
          'status' => 'WARNING' },
        { 'key' => 'current',
          'listpackages' => 0,
          'long' => "%d packages current.",
          'short' => "%d ok",
+         'perf' => "current=%d;;;0",
          'status' => 'OK' },
        { 'key' => 'obsolete-ignored',
          'listpackages' => 1,
          'long' => "%d whitelisted local or obsolete packages: %s",
          'short' => "%d obs/loc(ignored)",
+         'perf' => "obs_ign=%d;;;0",
          'status' => 'OK' },
        { 'key' => 'rc',
          'listpackages' => 1,
          'long' => "%d packages removed but not purged: %s",
          'short' => "%d rc",
+         'perf' => "rm_unprg=%d;;;0",
          'status' => 'OK' },
        { 'key' => 'hi',
          'listpackages' => 1,
          'long' => "%d packages on hold: %s",
          'short' => "%d hi",
+         'perf' => "hold=%d;;;0",
          'status' => 'OK' },
        { 'key' => 'pc',
          'listpackages' => 1,
          'long' => "%d packages requested to be purged but conffiles still installed: %s",
          'short' => "%d pc",
+         'perf' => "prg_conf=%d;1;;0",
          'status' => 'WARNING' },
        );
 
 my @longout;
+my @perfout;
 my @shortout;
 for my $form (@reportform) {
        my $pkgs = $packages->{$form->{'key'}};
        delete $packages->{$form->{'key'}};
        my $num = scalar keys %$pkgs;
+       push @perfout, sprintf($form->{'perf'}, $num);
        next unless ($num > 0);
        if ($form->{'listpackages'}) {
                my $list = join(", ", keys %$pkgs);
@@ -286,8 +295,10 @@ if (scalar keys %$packages) {
 
 my $shortout = $EXITCODE.": ".join(", ", @shortout);
 my $longout = join("\n", @longout);
+my $perfout = "|".join(" ", @perfout);
 
-print $shortout,"\n";
+print $shortout;
 print $longout,"\n";
+print $perfout,"\n";
 
 exit $CODE{$EXITCODE};
index a69d977..6ca691d 100755 (executable)
@@ -1,9 +1,9 @@
-#!/usr/bin/ruby
+#!/usr/bin/python
 
 # Relay the status of a check that was previously run and which stored
 # its result in a file to nagios.
 #
-# Copyright 2008 Peter Palfrader
+# Copyright 2008, 2012 Peter Palfrader
 #
 # Permission is hereby granted, free of charge, to any person obtaining
 # a copy of this software and associated documentation files (the
 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-require 'resolv'
-require 'optparse'
+import optparse
+import os
+import re
+import sys
+import time
 
-NAGIOS_STATUS = { "OK" => 0, "WARNING" => 1, "CRITICAL" => 2, "UNKNOWN" => 3 }
-UNITS_TO_SECONDS = { 's' => 1, 'm' => 60, 'h' => 60*60, 'd' => 24*60*60 }
+NAGIOS_STATUS = { "OK": 0, "WARNING": 1, "CRITICAL": 2, "UNKNOWN": 3 }
+UNITS_TO_SECONDS = { 's': 1, 'm': 60, 'h': 60*60, 'd': 24*60*60 }
 
-def show_help(parser, code=0, io=STDOUT)
-  program_name = File.basename($0, '.*')
-  io.puts "Usage: #{program_name} [options] <statusfile>"
-  io.puts parser.summarize
-  exit(code)
-end
+parser = optparse.OptionParser()
+parser.set_usage("%prog [options] <statusfile>")
+parser.add_option("-a", "--age", dest="age", metavar="AGE",
+    type="string", default="26h",
+    help="maximum age, in seconds (or use Nm, Nh or Nd) - default is 26h.")
+(options, args) = parser.parse_args()
 
-max_age = "26h"
-ARGV.options do |opts|
-        opts.on_tail("-h", "--help" , "Display this help screen")                                               { show_help(opts) }
-        opts.on("-a", "--age=AGE"  , String, "maximum age, in seconds (or use Nm, Nh or Nd) - default is 26h")  { |max_age| }
-        opts.parse!
-end
-show_help(ARGV.options, 1, STDERR) if ARGV.length != 1
+if len(args) != 1:
+    parser.print_help(file=sys.stderr)
+    sys.exit(1)
 
-statusfile = ARGV.shift
+statusfile = args[0]
 
 # find out what the max age is that we accept
-unless (m = /^([0-9]+)([smhd])?$/.match max_age)
-       STDERR.puts "Invalid age #{age}."
-       show_help(ARGV.options, 1, STDERR) if ARGV.length != 1
-end
-max_age = m[1].to_i * UNITS_TO_SECONDS[m[2] ? m[2] : 's']
+m = re.match('([0-9]+)([smhd])?$', options.age)
+if not m:
+    print >> sys.stderr, "Invalid age %s"%(options.age)
+    parser.print_help(file=sys.stderr)
+    sys.exit(1)
+(count, unit) = m.groups()
+if unit is None: unit = 's'
+max_age = int(count) * UNITS_TO_SECONDS[unit]
 
 # let's see if it exists
-unless File.exists? statusfile
-       puts "UNKNOWN: #{statusfile} does not exist."
-       exit NAGIOS_STATUS['UNKNOWN']
-end
+if not os.path.exists(statusfile):
+    print "UNKNOWN: %s does not exist."%(statusfile)
+    sys.exit(NAGIOS_STATUS['UNKNOWN'])
 
 
-mtime = File.stat(statusfile).mtime
-if mtime + max_age < Time.now
-       puts "WARNING: #{statusfile} is old: #{mtime}"
-       exit NAGIOS_STATUS['WARNING']
-end
+mtime = os.path.getmtime(statusfile)
+if mtime + max_age < time.time():
+    print "WARNING: %s is old: %.1f hours."%(statusfile, (time.time() - mtime)/3600)
+    sys.exit(NAGIOS_STATUS['WARNING'])
 
-status = File.new(statusfile)
-returnvalue = status.readline.chomp
+status = open(statusfile, "r")
+returnvalue = status.readline().strip()
 
-unless NAGIOS_STATUS.has_key? returnvalue
-       puts "UNKNOWN: #{statusfile} has invalid return value: #{returnvalue}"
-       exit NAGIOS_STATUS['UNKNOWN']
-end
+if not returnvalue in NAGIOS_STATUS:
+    print "UNKNOWN: %s has invalid return value: %s."%(statusfile, returnvalue)
+    sys.exit(NAGIOS_STATUS['UNKNOWN'])
 
-status.readlines.each do |line|
-       print line
-end
-exit NAGIOS_STATUS[returnvalue]
+for line in status:
+    print line,
+sys.exit(NAGIOS_STATUS[returnvalue])
+
+# vim:set et:
+# vim:set ts=4:
+# vim:set shiftwidth=4:
index 9b91082..f8df9f7 100644 (file)
@@ -5,8 +5,15 @@ dsa-nagios-checks (9X) Xnstable; urgency=low
     default size.
   * dsa-check-zone-rrsig-expiration-many: run checks in parallel and
     properly timeout long checks.
+  * dsa-nagios-checks: add perfdata (Alexander Reichle-Schmehl).
+  * dsa-check-statusfile: change shebang from ruby to python and fix syntax
+    errors.
 
- -- Peter Palfrader <weasel@debian.org>  Thu, 19 Jan 2012 13:06:26 +0100
+  [ Tollef Fog Heen ]  
+  * Make the unowned files check skip /proc.
+  * Limit the number of unowned files we register in the state file to 40.
+
+ -- Peter Palfrader <weasel@debian.org>  Wed, 08 Feb 2012 15:36:05 +0100
 
 dsa-nagios-checks (90) unstable; urgency=low
 
index 746d3b2..57f47f7 100755 (executable)
@@ -17,4 +17,4 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 # USA
 
-find / -nouser > /var/cache/dsa/nagios/nouser
+find / -path /proc -prune -o -nouser | head -n 40 > /var/cache/dsa/nagios/nouser