diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2011-12-24 05:27:58 +0000 |
---|---|---|
committer | Petter Reinholdtsen <pere@hungry.com> | 2011-12-24 05:27:58 +0000 |
commit | dd16d2508f8660cd55abe365ffc0a232c487100c (patch) | |
tree | be1ed09d7781cf1d6e7a22e447e6982d88b0ff50 /sitesummary-collector.cgi | |
parent | 42459853003bd47a1e4eeb5fc85874a8222637b0 (diff) | |
download | sitesummary-dd16d2508f8660cd55abe365ffc0a232c487100c.tar.gz sitesummary-dd16d2508f8660cd55abe365ffc0a232c487100c.tar.bz2 sitesummary-dd16d2508f8660cd55abe365ffc0a232c487100c.tar.xz |
Rewrite code to recognise a remote Nagios client to use host ID
to allow a Nagios server to be another Nagios servers client.
Diffstat (limited to 'sitesummary-collector.cgi')
-rw-r--r-- | sitesummary-collector.cgi | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/sitesummary-collector.cgi b/sitesummary-collector.cgi index 06acf4c..5d3ddd1 100644 --- a/sitesummary-collector.cgi +++ b/sitesummary-collector.cgi @@ -11,6 +11,7 @@ use CGI; use POSIX qw(strftime); use Socket; use Sys::Syslog; +use SiteSummary; my $basedir = "/var/lib/sitesummary"; my $handlerdir = "/usr/lib/sitesummary/handler.d"; @@ -93,20 +94,7 @@ unlink $savefile; exit 0; sub extract_unique_id { - my $eth0mac; - my $eth1mac; - my $eth2mac; - open(IFCONFIG, "system/ifconfig-a") || die "Unable to read ifconfig-a"; - while (<IFCONFIG>) { - chomp; - $eth0mac = $1 if (m/^eth0\s+Link encap:Ethernet HWaddr (\S+)/); - $eth1mac = $1 if (m/^eth1\s+Link encap:Ethernet HWaddr (\S+)/); - $eth2mac = $1 if (m/^eth2\s+Link encap:Ethernet HWaddr (\S+)/); - } - close (IFCONFIG); - #print STDERR "MAC: $eth0mac\n"; - my $mac = $eth0mac || $eth1mac || $eth2mac || "unknown"; - return lc("ether-$mac"); + return get_unique_ether_id("system/ifconfig-a") || die "Unable to read ifconfig-a"; } sub process_entry { |