diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2016-11-26 18:03:24 +0100 |
---|---|---|
committer | Petter Reinholdtsen <pere@hungry.com> | 2016-11-26 18:03:24 +0100 |
commit | 73b95020cb796d845e81487bbd83ec582e9ea9e1 (patch) | |
tree | 029fb57d28af5a5204bb769fc3eefb81dc306d1f /sitesummary-nodes | |
parent | c4d9af4af5739cd280a1817c6aa7ab5d37e8266b (diff) | |
download | sitesummary-73b95020cb796d845e81487bbd83ec582e9ea9e1.tar.gz sitesummary-73b95020cb796d845e81487bbd83ec582e9ea9e1.tar.bz2 sitesummary-73b95020cb796d845e81487bbd83ec582e9ea9e1.tar.xz |
Adjust parser for collected information to handle the new ifconfig output format (Closes: #832342).
Diffstat (limited to 'sitesummary-nodes')
-rwxr-xr-x | sitesummary-nodes | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sitesummary-nodes b/sitesummary-nodes index a889fe7..a554fa9 100755 --- a/sitesummary-nodes +++ b/sitesummary-nodes @@ -145,7 +145,17 @@ sub is_remote_nagios_client { sub get_switch_info { my $hostid = shift; my %switch = (); - for my $if (qw(eth0 eth1)) { + my $ifconfigoutput = get_filepath_current($hostid, "/system/ifconfig-a"); + my %ifs; + open(IFCONFIG, $ifconfigoutput) || return (); + while (<IFCONFIG>) { + chomp; + $ifs{$1} = 1 + if (m/^(\w+)\s+Link encap:Ethernet HWaddr (\S+)/ + || m/^(\w+): flags=\S+<UP,BROADCAST/); + } + close (IFCONFIG); + for my $if (sort keys %ifs) { my $path = get_filepath_current($hostid, "/system/cdpr.$if"); my ($id, $addr); if (open(my $fh, $path)) { |