git-svn-id: http://www.observium.org/svn/observer/trunk@480 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2009-10-05 12:47:16 +00:00
parent f2426873d5
commit b4c80a1c85
12 changed files with 45 additions and 22 deletions
+1 -1
View File
@@ -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-vlans.php");
include("includes/discovery/cisco-physical.php"); include("includes/discovery/cisco-physical.php");
include("includes/discovery/bgp-peers.php"); include("includes/discovery/bgp-peers.php");
+4 -2
View File
@@ -148,7 +148,8 @@ if($_GET['debug']) {
$graph = cpugraphUnix ($hostname . "/cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); $graph = cpugraphUnix ($hostname . "/cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
} elseif($os == "IOS" || $os == "IOS XE") { } elseif($os == "IOS" || $os == "IOS XE") {
$graph = graph_device_cpmCPU ($device_id, $graphfile, $from, $to, $width, $height, $title, $vertical); $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") { } elseif($os == "Windows") {
$graph = cpugraphwin ($hostname . "/cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); $graph = cpugraphwin ($hostname . "/cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
} elseif($os == "ProCurve") { } elseif($os == "ProCurve") {
@@ -183,7 +184,8 @@ if($_GET['debug']) {
$graph = memgraphUnix ($hostname . "/mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); $graph = memgraphUnix ($hostname . "/mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
} elseif($os == "IOS" || $os == "IOS XE") { } elseif($os == "IOS" || $os == "IOS XE") {
$graph = graph_device_cempMemPool ($device_id, $graphfile, $from, $to, $width, $height, $title, $vertical); $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 == "Windows") {
} elseif($os == "ProCurve") { } elseif($os == "ProCurve") {
$graph = memgraphHP ($hostname . "/mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); $graph = memgraphHP ($hostname . "/mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
+3 -1
View File
@@ -12,11 +12,13 @@
if ($device['features']) { $device['features'] = "(".$device['features'].")"; }
echo("$ddev_img echo("$ddev_img
<table width=100%> <table width=100%>
<tr> <tr>
<td class=list-bold>Operating System</td> <td class=list-bold>Operating System</td>
<td>" . $device['os'] . " " . $device['version'] . " ( " . $device['features'] . " )</td> <td>" . $device['os'] . " " . $device['version'] . " " . $device['features'] . " </td>
</tr>"); </tr>");
if($device['hardware']) {echo("<tr> if($device['hardware']) {echo("<tr>
+4
View File
@@ -168,6 +168,10 @@ while($device = mysql_fetch_array($device_query)) {
echo("<br />"); echo("<br />");
} }
break; break;
case "CatOS":
break;
case "IOS": case "IOS":
case "IOS XE": case "IOS XE":
break; break;
+1 -1
View File
@@ -199,7 +199,7 @@ echo("
echo("<div style='margin: 8px; font-size: 11px; font-weight: bold;'>"); echo("<div style='margin: 8px; font-size: 11px; font-weight: bold;'>");
$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); $query = mysql_query($sql);
while($data = mysql_fetch_array($query)) { while($data = mysql_fetch_array($query)) {
$data = ifNameDescr($data); $data = ifNameDescr($data);
+1 -1
View File
@@ -72,7 +72,7 @@
$sql .= " entSensorMeasuredEntity = '$entSensorMeasuredEntity'"; $sql .= " entSensorMeasuredEntity = '$entSensorMeasuredEntity'";
$sql .= " WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'"; $sql .= " WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'";
} else { } else {
echo("!$entSensorType"); echo("!");
$sql = "UPDATE `entPhysical` SET entSensorType = '', entSensorScale = '', entSensorPrecision = '', entSensorMeasuredEntity = ''"; $sql = "UPDATE `entPhysical` SET entSensorType = '', entSensorScale = '', entSensorPrecision = '', entSensorMeasuredEntity = ''";
$sql .= " WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'"; $sql .= " WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'";
} }
+6 -9
View File
@@ -30,15 +30,12 @@
if(!strstr($entry, "irtual")) { if(!strstr($entry, "irtual")) {
$if = trim(strtolower($ifDescr)); $if = trim(strtolower($ifDescr));
$nullintf = 0; $nullintf = 0;
foreach($config['bad_if'] as $bi) { foreach($config['bad_if'] as $bi) { if (strstr($if, $bi)) { $nullintf = 1; } }
if (strstr($if, $bi)) { if($device['os'] == "CatOS" && strstr($if, "vlan") ) { $nullintf = 1; }
$nullintf = 1;
}
}
$ifDescr = fixifName($ifDescr); $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(!$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 ($nullintf == 0) {
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `interfaces` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) == '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 # Add Interface
echo("+"); echo("+");
} else { } else {
mysql_query("UPDATE `interfaces` SET `deleted` = '0', `ifDescr` = '$ifDescr' WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"); if($interface['deleted']) {
if(mysql_affected_rows()) { mysql_query("UPDATE `interfaces` SET `deleted` = '0' WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'");
echo("*"); echo("*");
} else { } else {
echo("."); echo(".");
+9
View File
@@ -0,0 +1,9 @@
<?php
if(!$os) {
if(strstr($sysDescr, "Cisco Catalyst Operating System Software")) { $os = "CatOS"; }
}
?>
+5 -6
View File
@@ -38,7 +38,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
$ifDescr = trim(str_replace("\"", "", $ifDescr)); $ifDescr = trim(str_replace("\"", "", $ifDescr));
$ifDescr = trim($ifDescr); $ifDescr = trim($ifDescr);
# if(!$ifDescr) { $ifDescr = $ifName; } if($config[ifname][$device[os]]) { $ifDescr = $ifName; }
$rrdfile = $host_rrd . "/" . $interface['ifIndex'] . ".rrd"; $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( 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'"; $update .= $seperator . "`ifDescr` = '$ifDescr'";
$seperator = ", "; $seperator = ", ";
mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $interface['device_id'] . "', '" . $interface['interface_id'] . "', NOW(), 'ifDescr -> $ifDescr')"); mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $interface['device_id'] . "', '" . $interface['interface_id'] . "', NOW(), 'ifDescr -> $ifDescr')");
} }
if ( $interface['ifName'] != $ifName && $ifName != "" ) {
if ( $interface['ifName'] != $ifName ) {
$update .= $seperator . "`ifName` = '$ifName'"; $update .= $seperator . "`ifName` = '$ifName'";
$seperator = ", "; $seperator = ", ";
mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $interface['device_id'] . "', '" . $interface['interface_id'] . "', NOW(), 'ifName -> $ifName')"); 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'"; $update .= $seperator . "`ifAlias` = '$ifAlias'";
$seperator = ", "; $seperator = ", ";
mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $interface['device_id'] . "', '" . $interface['interface_id'] . "', NOW(), 'ifAlias -> $ifAlias')"); 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 `interfaces` SET ";
$update_query .= $update; $update_query .= $update;
$update_query .= " WHERE `interface_id` = '" . $interface['interface_id'] . "'"; $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); $update_result = mysql_query($update_query);
} else { } else {
# echo("Not Updating : " . $device['hostname'] ." $ifDescr ( " . $interface['ifDescr'] . " )\n\n"); # echo("Not Updating : " . $device['hostname'] ." $ifDescr ( " . $interface['ifDescr'] . " )\n\n");
+2 -1
View File
@@ -7,7 +7,8 @@ function formatMac($mac) {
function ifNameDescr ($interface, $device) { function ifNameDescr ($interface, $device) {
echo($device['os']); # echo($device['os']);
if(!$config['ifname'][$device['os']]) { if(!$config['ifname'][$device['os']]) {
$interface['label'] = $interface['ifDescr']; $interface['label'] = $interface['ifDescr'];
} else { } else {
+2
View File
@@ -4,6 +4,8 @@
$config['ifdescr']['IOS'] = true; $config['ifdescr']['IOS'] = true;
$config['ifdescr']['IOS XE'] = true; $config['ifdescr']['IOS XE'] = true;
$config['ifname']['ASA'] = true; $config['ifname']['ASA'] = true;
$config['ifname']['CatOS'] = true;
## AFI / SAFI pairs for BGP (and other stuff, perhaps) ## AFI / SAFI pairs for BGP (and other stuff, perhaps)
$config['afi']['ipv4']['unicast'] = "IPv4"; $config['afi']['ipv4']['unicast'] = "IPv4";
+7
View File
@@ -124,6 +124,10 @@ while ($device = mysql_fetch_array($device_query)) {
include("includes/polling/device-ios.inc.php"); include("includes/polling/device-ios.inc.php");
break; break;
case "CatOS":
include("includes/polling/device-catos.inc.php");
break;
case "ProCurve": case "ProCurve":
$sysDescr = str_replace(", ", ",", $sysDescr); $sysDescr = str_replace(", ", ",", $sysDescr);
list($hardware, $features, $version) = explode(",", $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"); include("includes/polling/device-procurve.inc.php");
break; break;
case "BCM96348": case "BCM96348":
include("includes/polling/adslline.inc.php"); include("includes/polling/adslline.inc.php");
break; break;
case "Snom": case "Snom":
include("includes/polling/device-snom.inc.php"); include("includes/polling/device-snom.inc.php");
break; break;
default: default:
pollDevice(); pollDevice();
} }