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

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-physical.php");
include("includes/discovery/bgp-peers.php");

View File

@@ -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);

View File

@@ -12,11 +12,13 @@
if ($device['features']) { $device['features'] = "(".$device['features'].")"; }
echo("$ddev_img
<table width=100%>
<tr>
<td class=list-bold>Operating System</td>
<td>" . $device['os'] . " " . $device['version'] . " ( " . $device['features'] . " )</td>
<td>" . $device['os'] . " " . $device['version'] . " " . $device['features'] . " </td>
</tr>");
if($device['hardware']) {echo("<tr>

View File

@@ -168,6 +168,10 @@ while($device = mysql_fetch_array($device_query)) {
echo("<br />");
}
break;
case "CatOS":
break;
case "IOS":
case "IOS XE":
break;

View File

@@ -199,7 +199,7 @@ echo("
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);
while($data = mysql_fetch_array($query)) {
$data = ifNameDescr($data);

View File

@@ -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'";
}

View File

@@ -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(".");

View File

@@ -0,0 +1,9 @@
<?php
if(!$os) {
if(strstr($sysDescr, "Cisco Catalyst Operating System Software")) { $os = "CatOS"; }
}
?>

View File

@@ -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");

View File

@@ -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 {

View File

@@ -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";

View File

@@ -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();
}