From 737d9bad6372879a5c3dd60a2e7de9c417c63f8b Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Tue, 9 Dec 2008 13:55:41 +0000 Subject: [PATCH] lots of updates! git-svn-id: http://www.observium.org/svn/observer/trunk@330 61d68cd4-352d-0410-923a-c4978735b2b8 --- discover-cdp.php | 2 +- discovery.php | 2 +- html/includes/print-syslog.inc | 8 ++--- html/pages/bgp.php | 4 +-- html/pages/device/ifgraphs.inc.php | 2 +- html/pages/syslog.php | 24 ++++++++++--- includes/discovery/bgp-peers.php | 2 +- includes/functions.php | 7 ++-- includes/osdiscovery/discover-ios.php | 1 + includes/polling/device-ios.inc.php | 49 +++++++++++++++++---------- mibs/.index | 1 + poll-device.php | 3 +- 12 files changed, 67 insertions(+), 38 deletions(-) diff --git a/discover-cdp.php b/discover-cdp.php index 1218f13be..1322d473e 100755 --- a/discover-cdp.php +++ b/discover-cdp.php @@ -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)) { diff --git a/discovery.php b/discovery.php index 0393d68c1..e5b012bc9 100755 --- a/discovery.php +++ b/discovery.php @@ -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"); diff --git a/html/includes/print-syslog.inc b/html/includes/print-syslog.inc index 5d17cfe67..a002591cd 100644 --- a/html/includes/print-syslog.inc +++ b/html/includes/print-syslog.inc @@ -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(" "); echo("" . $entry['date'] . ""); - $entry['hostname'] = shorthost($entry['hostname'], 20); +# $entry['hostname'] = shorthost(gethostbyid($entry['host']), 20); if($_GET['page'] != "device") { echo("".generatedevicelink($entry).""); } - echo(" " . $entry['program'] . " : " . htmlspecialchars($entry['msg']) . " diff --git a/html/pages/bgp.php b/html/pages/bgp.php index a9970853f..a16157e22 100644 --- a/html/pages/bgp.php +++ b/html/pages/bgp.php @@ -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") { diff --git a/html/pages/device/ifgraphs.inc.php b/html/pages/device/ifgraphs.inc.php index 21c3c872f..bde86d102 100644 --- a/html/pages/device/ifgraphs.inc.php +++ b/html/pages/device/ifgraphs.inc.php @@ -11,6 +11,6 @@ $dographs = 1; if(!$_GET['type']) { $_GET['type'] = "bits"; } -include("pages/device/dev-ifs.inc"); +include("pages/device/ifs.inc.php"); ?> diff --git a/html/pages/syslog.php b/html/pages/syslog.php index 453e98c1b..a36fa5a9a 100644 --- a/html/pages/syslog.php +++ b/html/pages/syslog.php @@ -1,8 +1,8 @@
-
+
"; - $link .= $interface['ifAlias'] . "
'".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">$text"; + $link = "', CAPTION, '" . $interface['hostname'] . " - " . fixifName($interface['ifDescr']) . "' "; + $link .= $config['overlib_defaults'].");\" onmouseout=\"return nd();\" >$text"; + return $link; } diff --git a/includes/osdiscovery/discover-ios.php b/includes/osdiscovery/discover-ios.php index afa5a41ff..a383af694 100755 --- a/includes/osdiscovery/discover-ios.php +++ b/includes/osdiscovery/discover-ios.php @@ -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"; } } diff --git a/includes/polling/device-ios.inc.php b/includes/polling/device-ios.inc.php index 7723a5c97..369049ac4 100755 --- a/includes/polling/device-ios.inc.php +++ b/includes/polling/device-ios.inc.php @@ -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; diff --git a/mibs/.index b/mibs/.index index fafbba3c7..8f8e10489 100644 --- a/mibs/.index +++ b/mibs/.index @@ -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 diff --git a/poll-device.php b/poll-device.php index 862469c78..41fca95f3 100755 --- a/poll-device.php +++ b/poll-device.php @@ -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;