Permalink
Browse files

Things learnt since first release: Some switch manufacturers suck at …

…SNMP alias names. Stick with Cisco, yo. Really really hate sanitising like this.
  • Loading branch information...
1 parent f698bd5 commit f89301a10d0d0d195efefa71a20f0abe88d8ffc9 @lozzd committed Nov 4, 2011
Showing with 11 additions and 6 deletions.
  1. +11 −6 poller_child.php
View
@@ -44,11 +44,6 @@
foreach($ifEntry as $intid => $thisint) {
logline("{$pollprettyhost} - Starting interface loop for interface index {$intid} ({$thisint[2]})", 1, $verbose);
- # Sanitise the name
- $intname = str_replace("/", "-", $thisint[2]);
- $intname = str_replace(" ", "-", $intname);
- $thisint['name'] = $intname;
-
# Check if the interface is up. No point graphing down interfaces.
if (($thisint[7] == "1") && ($thisint['8'] == "1")) {
@@ -66,7 +61,17 @@
$thisint['inbroadcast'] = $ifXEntry[$intid][9];
$thisint['outbroadcast'] = $ifXEntry[$intid][13];
$thisint['alias'] = $ifXEntry[$intid][18];
-
+
+ # Sanitise the name
+ $intname = str_replace("/", "-", $thisint[2]);
+ $intname = str_replace(" ", "-", $intname);
+ $intname = str_replace(":", "-", $intname);
+ $intname = str_replace('"', "", $intname);
+ $thisint['name'] = $intname;
+
+ # Sanitise the alias
+ $thisint['alias'] = str_replace('"', "", $thisint['alias']);
+
logline("{$pollprettyhost} - {$intname} - Description for {$intname} is {$thisint['alias']}.", 2, $verbose);

0 comments on commit f89301a

Please sign in to comment.