From 5db80a24a94e4361f80d591db2bb4a2e74c8d4cf Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Sat, 31 May 2008 23:22:05 +0000 Subject: [ 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. --- SiteSummary.pm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'SiteSummary.pm') diff --git a/SiteSummary.pm b/SiteSummary.pm index b6b449a..c37871a 100644 --- a/SiteSummary.pm +++ b/SiteSummary.pm @@ -82,6 +82,29 @@ sub get_hostname { return get_file_string($hostid, "/system/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() { + 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. # -- cgit v1.2.3