diff --git a/discovery.php b/discovery.php index 509d41a7a..10fb3bb29 100755 --- a/discovery.php +++ b/discovery.php @@ -68,7 +68,7 @@ while ($device = mysql_fetch_array($device_query)) { } - if($device['os'] == "IOS" || $device['os'] == "IOS XE") { + if($device['os'] == "IOS" || $device['os'] == "IOS XE" || $device['os'] == "CatOS") { include("includes/discovery/cisco-vlans.php"); include("includes/discovery/cisco-physical.php"); include("includes/discovery/bgp-peers.php"); diff --git a/html/graph.php b/html/graph.php index 8565596cc..2dd22d8ab 100644 --- a/html/graph.php +++ b/html/graph.php @@ -148,7 +148,8 @@ if($_GET['debug']) { $graph = cpugraphUnix ($hostname . "/cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } elseif($os == "IOS" || $os == "IOS XE") { $graph = graph_device_cpmCPU ($device_id, $graphfile, $from, $to, $width, $height, $title, $vertical); - #$graph = cpugraph ($hostname . "/cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + } elseif($os == "CatOS") { + $graph = cpugraph ($hostname . "/cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } elseif($os == "Windows") { $graph = cpugraphwin ($hostname . "/cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } elseif($os == "ProCurve") { @@ -183,7 +184,8 @@ if($_GET['debug']) { $graph = memgraphUnix ($hostname . "/mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } elseif($os == "IOS" || $os == "IOS XE") { $graph = graph_device_cempMemPool ($device_id, $graphfile, $from, $to, $width, $height, $title, $vertical); - #$graph = memgraph ($hostname . "/mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + } elseif($os == "CatOS") { + $graph = memgraph ($hostname . "/mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } elseif($os == "Windows") { } elseif($os == "ProCurve") { $graph = memgraphHP ($hostname . "/mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); diff --git a/html/includes/dev-overview-data.inc.php b/html/includes/dev-overview-data.inc.php index f2d45e59c..b4586476e 100644 --- a/html/includes/dev-overview-data.inc.php +++ b/html/includes/dev-overview-data.inc.php @@ -12,11 +12,13 @@ + if ($device['features']) { $device['features'] = "(".$device['features'].")"; } + echo("$ddev_img - + "); if($device['hardware']) {echo(" diff --git a/html/pages/device/graphs.inc.php b/html/pages/device/graphs.inc.php index 8c1fa4199..fbc446bab 100644 --- a/html/pages/device/graphs.inc.php +++ b/html/pages/device/graphs.inc.php @@ -168,6 +168,10 @@ while($device = mysql_fetch_array($device_query)) { echo("
"); } break; + + case "CatOS": + break; + case "IOS": case "IOS XE": break; diff --git a/html/pages/device/overview.inc.php b/html/pages/device/overview.inc.php index 0b687386b..173ba89ba 100644 --- a/html/pages/device/overview.inc.php +++ b/html/pages/device/overview.inc.php @@ -199,7 +199,7 @@ echo(" echo("
"); - $sql = "SELECT * FROM interfaces WHERE `device_id` = '" . $device['device_id'] . "'"; + $sql = "SELECT * FROM interfaces WHERE `device_id` = '" . $device['device_id'] . "' AND deleted != '1'"; $query = mysql_query($sql); while($data = mysql_fetch_array($query)) { $data = ifNameDescr($data); diff --git a/includes/discovery/cisco-physical.php b/includes/discovery/cisco-physical.php index 833c0f1d9..a7ba299ca 100755 --- a/includes/discovery/cisco-physical.php +++ b/includes/discovery/cisco-physical.php @@ -72,7 +72,7 @@ $sql .= " entSensorMeasuredEntity = '$entSensorMeasuredEntity'"; $sql .= " WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'"; } else { - echo("!$entSensorType"); + echo("!"); $sql = "UPDATE `entPhysical` SET entSensorType = '', entSensorScale = '', entSensorPrecision = '', entSensorMeasuredEntity = ''"; $sql .= " WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'"; } diff --git a/includes/discovery/interfaces.php b/includes/discovery/interfaces.php index 8602a6779..21ab26023 100755 --- a/includes/discovery/interfaces.php +++ b/includes/discovery/interfaces.php @@ -30,15 +30,12 @@ if(!strstr($entry, "irtual")) { $if = trim(strtolower($ifDescr)); $nullintf = 0; - foreach($config['bad_if'] as $bi) { - if (strstr($if, $bi)) { - $nullintf = 1; - } - } + foreach($config['bad_if'] as $bi) { if (strstr($if, $bi)) { $nullintf = 1; } } + if($device['os'] == "CatOS" && strstr($if, "vlan") ) { $nullintf = 1; } $ifDescr = fixifName($ifDescr); - if (preg_match('/serial[0-9]:/', $if)) { $nullintf = '1'; } + if (preg_match('/serial[0-9]:/', $if)) { $nullintf = 1; } if(!$config['allow_ng']) { - if (preg_match('/ng[0-9]+$/', $if)) { $nullintf = '1'; } + if (preg_match('/ng[0-9]+$/', $if)) { $nullintf = 1; } } if ($nullintf == 0) { if(mysql_result(mysql_query("SELECT COUNT(*) FROM `interfaces` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) == '0') { @@ -46,8 +43,8 @@ # Add Interface echo("+"); } else { - mysql_query("UPDATE `interfaces` SET `deleted` = '0', `ifDescr` = '$ifDescr' WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"); - if(mysql_affected_rows()) { + if($interface['deleted']) { + mysql_query("UPDATE `interfaces` SET `deleted` = '0' WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"); echo("*"); } else { echo("."); diff --git a/includes/osdiscovery/discover-catos.php b/includes/osdiscovery/discover-catos.php new file mode 100755 index 000000000..51798db15 --- /dev/null +++ b/includes/osdiscovery/discover-catos.php @@ -0,0 +1,9 @@ + diff --git a/includes/polling/interfaces.inc.php b/includes/polling/interfaces.inc.php index 955f22f87..d3643387b 100644 --- a/includes/polling/interfaces.inc.php +++ b/includes/polling/interfaces.inc.php @@ -38,7 +38,7 @@ while ($interface = mysql_fetch_array($interface_query)) { $ifDescr = trim(str_replace("\"", "", $ifDescr)); $ifDescr = trim($ifDescr); -# if(!$ifDescr) { $ifDescr = $ifName; } + if($config[ifname][$device[os]]) { $ifDescr = $ifName; } $rrdfile = $host_rrd . "/" . $interface['ifIndex'] . ".rrd"; @@ -64,20 +64,19 @@ while ($interface = mysql_fetch_array($interface_query)) { if( file_exists("includes/polling/interface-" . $device['os'] . ".php") ) { include("includes/polling/interface-" . $device['os'] . ".php"); } - if ( $interface['ifDescr'] != $ifDescr ) { + if ( $interface['ifDescr'] != $ifDescr && $ifDescr != "" ) { $update .= $seperator . "`ifDescr` = '$ifDescr'"; $seperator = ", "; mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $interface['device_id'] . "', '" . $interface['interface_id'] . "', NOW(), 'ifDescr -> $ifDescr')"); } - - if ( $interface['ifName'] != $ifName ) { + if ( $interface['ifName'] != $ifName && $ifName != "" ) { $update .= $seperator . "`ifName` = '$ifName'"; $seperator = ", "; mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $interface['device_id'] . "', '" . $interface['interface_id'] . "', NOW(), 'ifName -> $ifName')"); } - if ( $interface['ifAlias'] != $ifAlias ) { + if ( $interface['ifAlias'] != $ifAlias && $ifAlias != "" ) { $update .= $seperator . "`ifAlias` = '$ifAlias'"; $seperator = ", "; mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $interface['device_id'] . "', '" . $interface['interface_id'] . "', NOW(), 'ifAlias -> $ifAlias')"); @@ -98,7 +97,7 @@ while ($interface = mysql_fetch_array($interface_query)) { $update_query = "UPDATE `interfaces` SET "; $update_query .= $update; $update_query .= " WHERE `interface_id` = '" . $interface['interface_id'] . "'"; -# echo("Updating : " . $device['hostname'] . " $ifDescr\nSQL :$update_query\n\n"); + echo("Updating : " . $device['hostname'] . " $ifDescr\nSQL :$update_query\n\n"); $update_result = mysql_query($update_query); } else { # echo("Not Updating : " . $device['hostname'] ." $ifDescr ( " . $interface['ifDescr'] . " )\n\n"); diff --git a/includes/rewrites.php b/includes/rewrites.php index 29abc2af8..a7f9cba85 100644 --- a/includes/rewrites.php +++ b/includes/rewrites.php @@ -7,7 +7,8 @@ function formatMac($mac) { function ifNameDescr ($interface, $device) { - echo($device['os']); +# echo($device['os']); + if(!$config['ifname'][$device['os']]) { $interface['label'] = $interface['ifDescr']; } else { diff --git a/includes/static-config.php b/includes/static-config.php index ef8e9835d..e2c16ad36 100644 --- a/includes/static-config.php +++ b/includes/static-config.php @@ -4,6 +4,8 @@ $config['ifdescr']['IOS'] = true; $config['ifdescr']['IOS XE'] = true; $config['ifname']['ASA'] = true; +$config['ifname']['CatOS'] = true; + ## AFI / SAFI pairs for BGP (and other stuff, perhaps) $config['afi']['ipv4']['unicast'] = "IPv4"; diff --git a/poll-device.php b/poll-device.php index b66586feb..5295ae0dd 100755 --- a/poll-device.php +++ b/poll-device.php @@ -124,6 +124,10 @@ while ($device = mysql_fetch_array($device_query)) { include("includes/polling/device-ios.inc.php"); break; + case "CatOS": + include("includes/polling/device-catos.inc.php"); + break; + case "ProCurve": $sysDescr = str_replace(", ", ",", $sysDescr); list($hardware, $features, $version) = explode(",", $sysDescr); @@ -133,12 +137,15 @@ while ($device = mysql_fetch_array($device_query)) { } include("includes/polling/device-procurve.inc.php"); break; + case "BCM96348": include("includes/polling/adslline.inc.php"); break; + case "Snom": include("includes/polling/device-snom.inc.php"); break; + default: pollDevice(); }
Operating System" . $device['os'] . " " . $device['version'] . " ( " . $device['features'] . " )" . $device['os'] . " " . $device['version'] . " " . $device['features'] . "