+dsa-nagios-nrpe-config (32) unstable; urgency=low
+
+ * Add dsa-check-udldap-freshness.
+
+ -- Peter Palfrader <weasel@debian.org> Wed, 16 Apr 2008 07:39:21 -0400
+
dsa-nagios-nrpe-config (31) unstable; urgency=low
* dsa-check-dabackup: Use last time's log file if backup is currently running.
install -m 755 dsa-check-raid-sw $(CURDIR)/debian/dsa-nagios-nrpe-config/usr/lib/nagios/plugins
install -m 755 dsa-check-da-in-aliases $(CURDIR)/debian/dsa-nagios-nrpe-config/usr/lib/nagios/plugins
install -m 755 dsa-check-dabackup $(CURDIR)/debian/dsa-nagios-nrpe-config/usr/lib/nagios/plugins
+ install -m 755 dsa-check-udldap-freshness $(CURDIR)/debian/dsa-nagios-nrpe-config/usr/lib/nagios/plugins
binary-indep: install
--- /dev/null
+#!/usr/bin/perl -w
+
+use strict;
+my %CODE = (
+ 'UNDEF' => -1,
+ 'OK' => 0,
+ 'WARNING' => 1,
+ 'CRITICAL' => 2,
+ 'UNKNOWN' => 3
+);
+
+my $f;
+
+$SIG{__DIE__ } = sub() {
+ print shift;
+ exit $CODE{'UNKNOWN'};
+};
+
+if ( -e "/var/lib/misc/thishost/passwd.tdb" ) {
+ $f = "/var/lib/misc/thishost/passwd.tdb";
+} else {
+ my $hostname = `hostname -f`;
+ chomp $hostname;
+ $hostname =~ m/^([a-z]+(?:\.[a-z]+)+)$/;
+ die "Weird hostname '$hostname'\n" unless defined $1;
+ $hostname = $1;
+ if ( -e "/var/lib/misc/$hostname/passwd.tdb" ) {
+ $f = "/var/lib/misc/$hostname/passwd.tdb";
+ };
+};
+
+die "Could not find passwd.tdb" unless defined $f;
+
+my @stat = stat($f) or die ("Cannot stat $f: $!\n");
+my $age = time - $stat[10];
+my $hage;
+if ($age > 48 * 3600) {
+ $hage = sprintf("%.1f days", $age / 24 / 3600);
+} elsif ($age > 3600) {
+ $hage = sprintf("%.1f hours", $age / 3600);
+} else {
+ $hage = sprintf("%d minutes", $age / 60);
+};
+
+if ($age > 60*60) {
+ print "WARNING: ud-ldap info is $hage old\n";
+ exit $CODE{'WARNING'};
+};
+print "OK: ud-ldap info is $hage old\n";
+exit $CODE{'OK'};