]> git.etc.gen.nz Git - spong.git/commitdiff
displays the interface alias, hide fileds that don't display anything useful (patch...
authorJan Willamowius <jan@willamowius.de>
Tue, 4 Oct 2005 09:43:23 +0000 (09:43 +0000)
committerJan Willamowius <jan@willamowius.de>
Tue, 4 Oct 2005 09:43:23 +0000 (09:43 +0000)
src/lib/Spong/Network/plugins/check_interfaces

index a5e780a4624e59ac4f10c8af6aaaee00146208c7..e98aeb3f257e498a0cbe6dd540e737c9dc352125 100644 (file)
@@ -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<MIBII ifTable> table along with the interface
-description (I<ifDesc>), type (I<ifType>), administrative status
-(I<ifAdminStatus>) and operational status (I<ifOperStatus>). Otherwise this
+description (I<ifDesc>), alias (I<ifAlias>). Otherwise this
 field will have a detailed description of the cause of an error.
 
 =back