diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2008-05-31 23:22:05 +0000 |
---|---|---|
committer | Petter Reinholdtsen <pere@hungry.com> | 2008-05-31 23:22:05 +0000 |
commit | 5db80a24a94e4361f80d591db2bb4a2e74c8d4cf (patch) | |
tree | 280f53ca8cf62afdfa588c927a3677169016cf6c | |
parent | 179067aa60b11af15adb43a12b88fb7150d5d01b (diff) | |
download | sitesummary-5db80a24a94e4361f80d591db2bb4a2e74c8d4cf.tar.gz sitesummary-5db80a24a94e4361f80d591db2bb4a2e74c8d4cf.tar.bz2 sitesummary-5db80a24a94e4361f80d591db2bb4a2e74c8d4cf.tar.xz |
[ Petter Reinholdtsen ]
* Updated sitesummary-nodes:
- Use IP address as hostname if the provided hostname is bogus
or missing in DNS.
- Ignore filesystem types autofs, binfmt_misc, iso9660, nfsd and usbfs
when generating nagios checks.
-rw-r--r-- | SiteSummary.pm | 23 | ||||
-rw-r--r-- | debian/changelog | 11 | ||||
-rwxr-xr-x | sitesummary-nodes | 17 |
3 files changed, 50 insertions, 1 deletions
diff --git a/SiteSummary.pm b/SiteSummary.pm index b6b449a..c37871a 100644 --- a/SiteSummary.pm +++ b/SiteSummary.pm @@ -83,6 +83,29 @@ sub get_hostname { } # +# Return the IP address on the primary network interface +# +sub get_primary_ip_address { + my $hostid = shift; + my $path = get_filepath_current($hostid, "/system/ifconfig-a"); + # XXX Not implemented + my $ip; + if (open (FILE, $path)) { + while(<FILE>) { + chomp; + if (m/inet addr:(\S+)\s+/) { + $ip = $1; + last; + } + } + close(FILE); + return $ip; + } else { + return undef; + } +} + +# # Return Linux kernel version for the machines using Linux. # sub get_linux_kernel_ver { diff --git a/debian/changelog b/debian/changelog index c2ffd9e..3c45a3a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +sitesummary (0.0.38) UNRELEASED; urgency=low + + [ Petter Reinholdtsen ] + * Updated sitesummary-nodes: + - Use IP address as hostname if the provided hostname is bogus + or missing in DNS. + - Ignore filesystem types autofs, binfmt_misc, iso9660, nfsd and usbfs + when generating nagios checks. + + -- Petter Reinholdtsen <pere@debian.org> Sun, 1 Jun 2008 01:19:50 +0200 + sitesummary (0.0.37) unstable; urgency=low [ Morten Werner Forsbring ] diff --git a/sitesummary-nodes b/sitesummary-nodes index 2d235c7..013be62 100755 --- a/sitesummary-nodes +++ b/sitesummary-nodes @@ -24,9 +24,19 @@ if ($opts{'m'}) { print_list(); } +sub in_dns { + my $hostname = shift; + my $packed_ip = gethostbyname($hostname); + return defined $packed_ip; +} + sub handle_host { my $hostid = shift; my $hostname = get_hostname($hostid); + # Use IP address as hostname if the provided hostname is bogus or + # missing in DNS. + $hostname = get_primary_ip_address($hostid) + if (! in_dns($hostname) || "localhost" eq $hostname); $hostnames{$hostname} = $hostid; } @@ -155,11 +165,16 @@ EOF my ($dev, $partition, $fs, $opts) = split; next if (exists $checked{$partition}); next if ($fs eq "devpts" || + $fs eq "autofs" || + $fs eq "binfmt_misc" || + $fs eq "iso9660" || + $fs eq "nfsd" || $fs eq "proc" || $fs eq "rootfs" || $fs eq "rpc_pipefs" || $fs eq "sysfs" || - $fs eq "tmpfs"); + $fs eq "tmpfs" || + $fs eq "usbfs"); $checked{$partition} = 1; my $warn = 10; |