From 6ba3f88c0270d29dcd080aea6113026abbf87fc3 Mon Sep 17 00:00:00 2001 From: Jan Willamowius Date: Tue, 4 Oct 2005 09:43:23 +0000 Subject: [PATCH] displays the interface alias, hide fileds that don't display anything useful (patch by Toivo Pedaste) --- .../Spong/Network/plugins/check_interfaces | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/lib/Spong/Network/plugins/check_interfaces b/src/lib/Spong/Network/plugins/check_interfaces index a5e780a..e98aeb3 100644 --- a/src/lib/Spong/Network/plugins/check_interfaces +++ b/src/lib/Spong/Network/plugins/check_interfaces @@ -73,22 +73,26 @@ sub check_interfaces { return ($color, $summary, $message ); } - my (%sifdesc, %siftype, %sifadminstatus, %sifoperstatusi, $res); + my (%sifdesc, %sifalias, %siftype, %sifadminstatus, %sifoperstatusi, $res); $res = $snmp_session->map_table ([ [1,3,6,1,2,1,2,2,1,1], # ifIndex [1,3,6,1,2,1,2,2,1,2], # ifDescr [1,3,6,1,2,1,2,2,1,3], # ifType [1,3,6,1,2,1,2,2,1,7], # ifAdminStatus - [1,3,6,1,2,1,2,2,1,8] # ifOperStatus - ], + [1,3,6,1,2,1,2,2,1,8], # ifOperStatus + [1,3,6,1,2,1,31,1,1,1,1], # ifname + [1,3,6,1,2,1,31,1,1,1,18], # ifalias + ], sub ($@) { - my ($rowindex,$index,$ifdescr,$iftype,$ifadminstatus,$ifoperstatus) = @_; + my ($rowindex,$index,$ifdescr,$iftype,$ifadminstatus,$ifoperstatus,$ifname,$ifalias) = @_; - grep (defined $_ && ($_=pretty_print $_), ($index,$ifdescr,$iftype,$ifadminstatus,$ifoperstatus)); - debug("interfaces - seen $ifdescr",8); + grep (defined $_ && ($_=pretty_print $_), ($index,$ifdescr,$iftype,$ifadminstatus, + $ifoperstatus,$ifname,$ifalias)); + debug("interfaces - seen $ifdescr, $ifname, $ifalias",8); $sifdesc{$index} = $ifdescr; $siftype{$index} = $iftype; + $sifalias{$index} = $ifalias; $sifadminstatus{$index} = $ifadminstatus; $sifoperstatus{$index} = $ifoperstatus; }); @@ -127,11 +131,14 @@ sub check_interfaces { $redcount++ unless $skip; if (!$skip) { - $message .= "interface $index status:\n"; + $message .= "interface $index down:\n"; $message .= "\tifDescr: $sifdesc{$index}\n"; - $message .= "\tifType: $siftype{$index}\n"; - $message .= "\tifAdminStatus: $sifadminstatus{$index}\n"; - $message .= "\tifOperStatus: $sifoperstatus{$index}\n"; + if ($sifalias{$index}) { + $message .= "\tifAlias: $sifalias{$index}\n"; + } +# $message .= "\tifType: $siftype{$index}\n"; +# $message .= "\tifAdminStatus: $sifadminstatus{$index}\n"; +# $message .= "\tifOperStatus: $sifoperstatus{$index}\n"; } } } @@ -177,10 +184,9 @@ anamoly is. =item Detail Message Field -In normal opereration the detail message field will have a list of all of the +In normal opereration the detail message field will have a list of down network interfaces in the I table along with the interface -description (I), type (I), administrative status -(I) and operational status (I). Otherwise this +description (I), alias (I). Otherwise this field will have a detailed description of the cause of an error. =back -- 2.30.2