diff options
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)) { |