fix os on old cisco kit. a bit.

git-svn-id: http://www.observium.org/svn/observer/trunk@2677 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-10-10 15:40:54 +00:00
parent dbd337a2d9
commit 7932686fea
5 changed files with 24 additions and 9 deletions

View File

@@ -6,3 +6,4 @@ ALTER TABLE `ports` ADD UNIQUE `device_ifIndex` ( `device_id` , `ifIndex` );
ALTER TABLE `devices` CHANGE `port` `port` SMALLINT( 5 ) UNSIGNED NOT NULL DEFAULT '161';
CREATE TABLE IF NOT EXISTS `ipsec_tunnels` ( `tunnel_id` int(11) NOT NULL AUTO_INCREMENT, `device_id` int(11) NOT NULL, `peer_port` int(11) NOT NULL, `peer_addr` varchar(64) COLLATE utf8_unicode_ci NOT NULL, `local_addr` varchar(64) COLLATE utf8_unicode_ci NOT NULL, `local_port` int(11) NOT NULL, `tunnel_name` varchar(96) COLLATE utf8_unicode_ci NOT NULL, `tunnel_status` varchar(11) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`tunnel_id`), UNIQUE KEY `unique_index` (`device_id`,`peer_addr`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
ALTER TABLE `syslog` ADD INDEX ( `program` );
ALTER TABLE `devices` ADD `sysObjectID` VARCHAR( 64 ) NULL DEFAULT NULL AFTER `bgpLocalAs`;

View File

@@ -39,7 +39,7 @@ if (isset($_GET['device'])) { $where = "WHERE device_id = ".mres($_GET['device']
if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
{
$map = 'digraph G { sep=0.01; size="120,50.5"; pack=100; bgcolor=transparent; splines=true; overlap=scale; concentrate=0; epsilon=0.001; rankdir=0;
$map = 'digraph G { sep=0.01; size="12,5.5"; pack=100; bgcolor=transparent; splines=true; overlap=scale; concentrate=0; epsilon=0.001; rankdir=0;
node [ fontname="helvetica", fontstyle=bold, style=filled, color=white, fillcolor=lightgrey, overlap=false];
edge [ bgcolor=white, fontname="helvetica", fontstyle=bold, arrowhead=dot, arrowtail=dot];
graph [bgcolor=transparent];
@@ -145,10 +145,10 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
$map .= "
};";
# if ($_GET['debug'] == 1)
# {
# echo("<pre>$map</pre>");exit();
# }
if ($_GET['debug'] == 1)
{
echo("<pre>$map</pre>");exit();
}
switch ($_GET['format'])
{
@@ -161,16 +161,16 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
if ($links > 30) ### Unflatten if there are more than 10 links. beyond that it gets messy
{
$maptool = $config['unflatten'] . ' -f -l 5 | ' . $config['neato'];
$maptool = $config['unflatten'] . ' -f -l 5 | ' . $config['sfdp'] . ' -Gpack -Gcharset=latin1 -Gsize=11,9';
} else {
$maptool = $config['neato'];
$maptool = $config['dot'];
}
# if ($where == '') { $maptool = $config['sfdp'] . ' -Gpack -Gcharset=latin1 -Gsize=200,200'; }
# if ($where == '') { $maptool = $config['sfdp'] . ' -Gpack -Gcharset=latin1 -Gsize=20,20'; }
$descriptorspec = array(0 => array("pipe", "r"),1 => array("pipe", "w") );
$process = proc_open($maptool.' -T'.$_GET['format'],$descriptorspec,$pipes);
$process = proc_open($maptool.' -T'.$_GET['format'],$descriptorspec,$pipes);
if (is_resource($process)) {
fwrite($pipes[0], "$map");

View File

@@ -1,7 +1,12 @@
<?php
$poll_device['sysDescr'] = str_replace("IOS (tm)", "IOS (tm),", $poll_device['sysDescr']);
$poll_device['sysDescr'] = str_replace(") RELEASE", "), RELEASE", $poll_device['sysDescr']);
echo("\n".$poll_device['sysDescr']."\n");
list(,$features,$version) = explode(",", $poll_device['sysDescr']);
$version = str_replace(" Version ", "", $version);
list(,$features) = explode("(", $features);
list(,$features) = explode("-", $features);
@@ -34,6 +39,10 @@ list($version) = explode(",", $version);
# $ciscomodel = str_replace("\"","",$ciscomodel);
# if ($ciscomodel) { $hardware = $ciscomodel; unset($ciscomodel); }
if($hardware == "") { $hardware = snmp_get($device, "sysObjectID.0", "-Osqv", "SNMPv2-MIB:CISCO-PRODUCTS-MIB"); }
if(isset($cisco_hardware_oids[$poll_device['sysObjectID']])) { $hardware = $cisco_hardware_oids[$poll_device['sysObjectID']]; }
if (strpos($poll_device['sysDescr'], "IOS XR")) {
list(,$version) = explode(",", $poll_device['sysDescr']);
$version = trim($version);

View File

@@ -17,6 +17,7 @@
foreach (array_keys($snmpdata[0]) as $key) { $poll_device[$key] = $snmpdata[0][$key]; }
$poll_device['sysDescr'] = snmp_get($device, "sysDescr.0", "-Oqv", "SNMPv2-MIB");
$poll_device['sysObjectID'] = snmp_get($device, "sysObjectID.0", "-Oqvn", "SNMPv2-MIB");
$poll_device['sysName'] = strtolower($poll_device['sysName']);

View File

@@ -132,6 +132,10 @@ $rewrite_junose_hardware = array(
'juniSsx1440' => 'SSX-1440',
);
$rewrite_cisco_hardware = array(
'.1.3.6.1.4.1.9.1.275' => 'C2948G-L3',
);
$rewrite_ftos_hardware = array (
'.1.3.6.1.4.1.6027.1.1.1'=> 'E1200',
'.1.3.6.1.4.1.6027.1.1.2'=> 'E600',