lots of updates!

git-svn-id: http://www.observium.org/svn/observer/trunk@330 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2008-12-09 13:55:41 +00:00
parent d05d9722b2
commit 737d9bad63
12 changed files with 67 additions and 38 deletions

View File

@@ -11,7 +11,7 @@ include("config.php");
include("includes/functions.php");
include("includes/cdp.inc.php");
$device_query = mysql_query("SELECT * FROM `devices` WHERE `status` = '1' AND `os` = 'IOS' ORDER BY `device_id` DESC");
$device_query = mysql_query("SELECT * FROM `devices` WHERE `status` = '1' AND (`os` = 'IOS' OR `os` = 'IOS XE') ORDER BY `device_id` DESC");
while ($device = mysql_fetch_array($device_query)) {

View File

@@ -56,7 +56,7 @@ while ($device = mysql_fetch_array($device_query)) {
}
if($device['os'] == "IOS") {
if($device['os'] == "IOS" || $device['os'] == "IOS XE") {
include("includes/discovery/cisco-vlans.php");
include("includes/discovery/cisco-physical.php");
include("includes/discovery/bgp-peers.php");

View File

@@ -4,23 +4,19 @@
if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }
if(!$entry['processed']) { $entry = process_syslog($entry, 1); }
if(!$entry['deleted']) {
$entry['hostname'] = gethostbyid($entry['device_id']);
if(!$entry['deleted']) {
echo("<tr style=\"background-color: $bg\">
<td width=0></td>");
echo("<td class=syslog width=125>" . $entry['date'] . "</td>");
$entry['hostname'] = shorthost($entry['hostname'], 20);
# $entry['hostname'] = shorthost(gethostbyid($entry['host']), 20);
if($_GET['page'] != "device") {
echo("<td width=160><strong>".generatedevicelink($entry)."</strong></td>");
}
echo(" <td class=syslog>
<strong>" . $entry['program'] . " : </strong>
" . htmlspecialchars($entry['msg']) . "

View File

@@ -4,8 +4,8 @@
$i = "1";
if($_GET['view'] == "alerted") {
$where = "";
if($_GET['view'] == "alerts") {
$where = "AND B.bgpPeerAdminStatus = 'start' AND B.bgpPeerState != 'established'";
} elseif ($_GET['view'] == "external") {
$where = "AND D.bgpLocalAs != B.bgpPeerRemoteAs";
} elseif ($_GET['view'] == "internal") {

View File

@@ -11,6 +11,6 @@ $dographs = 1;
if(!$_GET['type']) { $_GET['type'] = "bits"; }
include("pages/device/dev-ifs.inc");
include("pages/device/ifs.inc.php");
?>

View File

@@ -1,8 +1,8 @@
<meta http-equiv="refresh" content="60">
<div style="background-color: #eeeeee; padding: 10px;">
<form id="form1" name="form1" method="post" action="">
<form method="post" action="">
<label><strong>Search</strong>
<input type="text" name="search" id="search" />
<input type="text" name="string" id="string" value="<?php echo($_POST['string']); ?>" />
</label>
<label>
<strong>Program</strong>
@@ -11,7 +11,9 @@
<?php
$query = mysql_query("SELECT `program` FROM `syslog` GROUP BY `program` ORDER BY `program`");
while($data = mysql_fetch_array($query)) {
echo("<option value='".$data['program']."'>".$data['program']."</option>");
echo("<option value='".$data['program']."'");
if($data['program'] == $_POST['program']) { echo("selected"); }
echo(">".$data['program']."</option>");
}
?>
</select>
@@ -24,6 +26,8 @@
$query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`");
while($data = mysql_fetch_array($query)) {
echo("<option value='".$data['device_id']."'");
if($data['device_id'] == $_POST['device']) { echo("selected"); }
echo(">".$data['hostname']."</option>");
}
@@ -38,7 +42,19 @@
<?
$sql = "SELECT *, DATE_FORMAT(datetime, '%D %b %T') AS date from syslog ORDER BY datetime DESC LIMIT 1000";
if($_POST['string']) {
$where = " AND S.msg LIKE '%".$_POST['string']."%'";
}
if($_POST['program']) {
$where .= " AND S.program = '".$_POST['program']."'";
}
if($_POST['device']) {
$where .= " AND D.device_id = '".$_POST['device']."'";
}
$sql = "SELECT *, DATE_FORMAT(datetime, '%D %b %T') AS date from syslog AS S, devices AS D WHERE S.device_id = D.device_id $where ORDER BY datetime DESC LIMIT 1000";
$query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=2 width=100%>");
while($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc"); }

View File

@@ -24,7 +24,7 @@
$peerlist[] = $device['device_id'] ." $peer_ip";
$astext = trim(str_replace("\"", "", shell_exec("/usr/bin/dig +short AS$peer_as.asn.cymru.com TXT | cut -d '|' -f 5")));
$astext = trim(str_replace("\"", "", shell_exec("/usr/bin/dig +short AS$peer_as.asn.cymru.com TXT | cut -d '|' -f 5 | sed s/\\\"//g")));
#echo(str_pad($peer_ip, 32). str_pad($astext, 32) . " $peer_as ");

View File

@@ -264,9 +264,10 @@ function generateiflink($interface, $text=0,$type=bits)
if(!$type) { $type = 'bits'; }
$class = ifclass($interface['ifOperStatus'], $interface['ifAdminStatus']);
$graph_url = "graph.php?if=" . $interface['interface_id'] . "&from=$day&to=$now&width=400&height=120&type=" . $type;
$link = "<a class=$class href='?page=interface&id=" . $interface['interface_id'] . "' ";
$link .= "onmouseover=\"return overlib('<div class=list-large>" . $interface['hostname'] . " - " . fixifName($interface['ifDescr']) . "</div><div>";
$link .= $interface['ifAlias'] . "</div><img src=\'$graph_url\'>'".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">$text</a>";
$link = "<a class=$class href='?page=interface&id=" . $interface['interface_id'] . "' ";
$link .= "onmouseover=\" return overlib('<img src=\'$graph_url\'>', CAPTION, '<span class=list-large>" . $interface['hostname'] . " - " . fixifName($interface['ifDescr']) . "</span>' ";
$link .= $config['overlib_defaults'].");\" onmouseout=\"return nd();\" >$text</a>";
return $link;
}

View File

@@ -5,6 +5,7 @@ if(!$os) {
if(strstr($sysDescr, "Cisco Internetwork Operating System Software")) { $os = "IOS"; }
if(strstr($sysDescr, "IOS (tm)")) { $os = "IOS"; }
if(strstr($sysDescr, "Cisco IOS Software")) { $os = "IOS"; }
if(strstr($sysDescr, "IOS-XE")) { $os = "IOS XE"; }
}

View File

@@ -16,24 +16,37 @@
if(is_file($Ocpurrd) && !is_file($cpurrd)) { rename($Ocpurrd, $cpurrd); echo("Moving $Ocpurrd to $cpurrd"); }
if(is_file($Omemrrd) && !is_file($memrrd)) { rename($Omemrrd, $memrrd); echo("Moving $Omemrrd to $memrrd"); }
$version = str_replace("Cisco IOS Software,", "", $sysDescr);
$version = str_replace("IOS (tm) ", "", $version);
$version = str_replace(",RELEASE SOFTWARE", "", $version);
$version = str_replace(",MAINTENANCE INTERIM SOFTWARE", "", $version);
$version = str_replace("Version ","", $version);
$version = str_replace("Cisco Internetwork Operating System Software", "", $version);
$version = trim($version);
list($version) = explode("\n", $version);
$version = preg_replace("/^[A-Za-z0-9\ \_]*\(([A-Za-z0-9\-\_]*)\), (.+), .*/", "\\1|\\2", $version);
$version = str_replace("-M|", "|", $version);
$version = str_replace("-", "|", $version);
list($hardware, $features, $version) = explode("|", $version);
$features = fixIOSFeatures($features);
#$hardware = fixIOSHardware($hardware);
if(strstr($ciscomodel, "OID")){ unset($ciscomodel); }
if(!strstr($ciscomodel, " ") && strlen($ciscomodel) >= '3') {
$hardware = $ciscomodel;
}
$version = str_replace("Cisco IOS Software,", "", $sysDescr);
$version = str_replace("IOS (tm) ", "", $version);
$version = str_replace(",RELEASE SOFTWARE", "", $version);
$version = str_replace(",MAINTENANCE INTERIM SOFTWARE", "", $version);
$version = str_replace("Version ","", $version);
$version = str_replace("Cisco Internetwork Operating System Software", "", $version);
$version = trim($version);
list($version) = explode("\n", $version);
$version = preg_replace("/^[A-Za-z0-9\ \_]*\(([A-Za-z0-9\-\_]*)\), (.+), .*/", "\\1|\\2", $version);
$version = str_replace("-M|", "|", $version);
$version = str_replace("-", "|", $version);
list($hardware, $features, $version) = explode("|", $version);
$features = fixIOSFeatures($features);
#$hardware = fixIOSHardware($hardware);
if(strstr($ciscomodel, "OID")){ unset($ciscomodel); }
if(!strstr($ciscomodel, " ") && strlen($ciscomodel) >= '3') {
$hardware = $ciscomodel;
}
if($device['os'] == "IOS XE") {
list(,$features,$version) = explode(",", $sysDescr);
$version = str_replace(" Version ", "", $version);
$features = str_replace(" IOS-XE Software (", "", $features);
$features = str_replace("-M", "", $features);
$features = str_replace(")", "", $features);
$features = str_replace("PPC_LINUX_IOSD-", "", $features);
$features = fixIOSFeatures($features);
}
list ($cpu5m, $cpu5s) = explode("\n", `snmpget -O qv -v2c -c $community $hostname 1.3.6.1.4.1.9.2.1.58.0 1.3.6.1.4.1.9.2.1.56.0`);
$cpu5m = $cpu5m + 0;

View File

@@ -89,6 +89,7 @@ CISCO-IETF-ISIS-MIB CISCO-IETF-ISIS-MIB.my
CISCO-TCPOFFLOAD-MIB CISCO-TCPOFFLOAD-MIB.my
CISCO-STACK-MIB CISCO-STACK-MIB.my
NETSCREEN-SMI NS-SMI.mib
LLDP-MIB LLDP-MIB.my
NETSCREEN-VPN-GATEWAY-MIB NS-VPN-GW.mib
NETSCREEN-SCHEDULE-MIB NS-SCHEDULE.mib
NETSCREEN-SET-WEB-MIB NS-SET-WEB.mib

View File

@@ -59,7 +59,7 @@ while ($device = mysql_fetch_array($device_query)) {
$snmp_cmd = $config['snmpget'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'];
$snmp_cmd .= " $uptimeoid sysLocation.0 sysContact.0";
#$snmp_cmd .= " | grep -v 'Cisco Internetwork Operating System Software'";
if($device['os'] == "IOS") {
if($device['os'] == "IOS" || $device['os'] == "IOS XE") {
$snmp_cmdb = $config['snmpget'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'];
$snmp_cmdb .= " .1.3.6.1.2.1.47.1.1.1.1.13.1";
$snmp_cmdb .= " | grep -v 'Cisco Internetwork Operating System Software'";
@@ -111,6 +111,7 @@ while ($device = mysql_fetch_array($device_query)) {
break;
case "IOS":
case "IOS XE":
include("includes/polling/device-ios.inc.php");
break;