3am code -> 3pm code

git-svn-id: http://www.observium.org/svn/observer/trunk@2178 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-04-27 13:51:30 +00:00
parent 6ac8b1ff80
commit 591ad81078
4 changed files with 51 additions and 32 deletions

View File

@@ -153,9 +153,9 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
if ($links > 10) ### Unflatten if there are more than 10 links. beyond that it gets messy
{
$maptool = 'unflatten -f -l 5 | twopi';
$maptool = 'unflatten -f -l 5 | dot';
} else {
$maptool = 'twopi';
$maptool = 'dot';
}
if ($where == '') { $maptool = 'neato -Gpack'; }

View File

@@ -1,4 +1,4 @@
<center>
<object data="map.php?device=<?php echo($device['device_id']); ?>&format=svg" type="image/svg+xml" style="width: 100%; height:1000px;">
<object data="map.php?device=<?php echo($device['device_id']); ?>&format=svg" type="image/svg+xml" style="width: 100%; height:100%">
</object>
</center>

View File

@@ -127,6 +127,10 @@ $config['overview_show_sysDescr'] = true;
### Poller/Discovery Modules
$config['enable_bgp'] = 1; # Enable BGP session collection and display
$config['enable_rip'] = 1; # Enable RIP session collection and display
$config['enable_ospf'] = 1; # Enable OSPF session collection and display
$config['enable_isis'] = 1; # Enable ISIS session collection and display
$config['enable_eigrp'] = 1; # Enable EIGRP session collection and display
$config['enable_syslog'] = 0; # Enable Syslog
$config['enable_inventory'] = 1; # Enable Inventory
$config['enable_pseudowires'] = 1; # Enable Pseudowires

View File

@@ -3,6 +3,8 @@
echo("OSPF: ");
echo("Processes: ");
$ospf_instance_count = 0;
$ospf_oids_db = array('ospfRouterId', 'ospfAdminStat', 'ospfVersionNumber', 'ospfAreaBdrRtrStatus', 'ospfASBdrRtrStatus',
'ospfExternLsaCount', 'ospfExternLsaCksumSum', 'ospfTOSSupport', 'ospfOriginateNewLsas', 'ospfRxNewLsas',
'ospfExtLsdbLimit', 'ospfMulticastExtensions', 'ospfExitOverflowInterval', 'ospfDemandExtensions');
@@ -11,7 +13,7 @@ $ospf_oids_db = array('ospfRouterId', 'ospfAdminStat', 'ospfVersionNumber', 'osp
$query = mysql_query("SELECT * FROM `ospf_instances` WHERE `device_id` = '".$device['device_id']."'");
while($entry = mysql_fetch_assoc($query))
{
$ospf[$entry['ospf_instances_id']] = $entry;
$ospf[$entry['ospf_instance_id']] = $entry;
}
### Pull data from device
@@ -21,17 +23,22 @@ foreach($ospf_data as $ospf_instances => $ospf_entry)
### If the entry doesn't already exist in the prebuilt array, insert into the database and put into the array
if(!isset($ospf[$ospf_instances]))
{
mysql_query("INSERT INTO `ospf_instances` (`device_id`, `ospf_instances_id`) VALUES ('".$device['device_id']."','".$ospf_instances."') ");
$query = "INSERT INTO `ospf_instances` (`device_id`, `ospf_instance_id`) VALUES ('".$device['device_id']."','".$ospf_instances."')";
echo($query);
mysql_query($query);
echo(mysql_error());
echo("+");
$entry = mysql_fetch_assoc(mysql_query("SELECT * FROM `ospf_instances` WHERE `device_id` = '".$device['device_id']."' AND `ospf_instances_id` = '".$ospf_instances."'"));
$ospf[$entry['ospf_instances_id']] = $entry;
$entry = mysql_fetch_assoc(mysql_query("SELECT * FROM `ospf_instances` WHERE `device_id` = '".$device['device_id']."' AND `ospf_instance_id` = '".$ospf_instances."'"));
$ospf[$entry['ospf_instance_id']] = $entry;
}
}
### Loop array of entries and update
if (is_array($ospf)){ foreach($ospf as $ospf_db)
if (is_array($ospf))
{
$ospf_poll = $ospf_data[$ospf_db['ospf_instances_id']];
foreach($ospf as $ospf_db)
{
$ospf_poll = $ospf_data[$ospf_db['ospf_instance_id']];
foreach ($ospf_oids_db as $oid)
{ // Loop the OIDs
if ($ospf_db[$oid] != $ospf_poll[$oid])
@@ -42,8 +49,10 @@ if (is_array($ospf)){ foreach($ospf as $ospf_db)
}
if($update)
{
mysql_query("UPDATE `ospf_instances` SET `ospf_instances_id` = '".$ospf_db['ospf_instances_id']."'".$update." WHERE `device_id` = '".$device['device_id']."' AND `ospf_instances_id` = '".$ospf_instances."'");
echo("UPDATE `ospf_instances` SET `ospf_instances_id` = '".$ospf_db['ospf_instances_id']."'".$update." WHERE `device_id` = '".$device['device_id']."' AND `ospf_instances_id` = '".$ospf_instances."'");
$query = "UPDATE `ospf_instances` SET `ospf_instance_id` = '".$ospf_db['ospf_instance_id']."'".$update." WHERE `device_id` = '".$device['device_id']."' AND `ospf_instance_id` = '".$ospf_instances."'";
echo($query);
mysql_query($query);
echo(mysql_error());
echo("U");
unset($update);
} else {
@@ -51,7 +60,8 @@ if (is_array($ospf)){ foreach($ospf as $ospf_db)
}
unset($ospf_poll);
unset($ospf_db);
}}
}
}
unset($ospf_data);
unset($ospf);
@@ -140,8 +150,13 @@ foreach($ospf_ports_poll as $ospf_port_id => $ospf_port)
}
}
if($debug) {
echo("\nPolled: ");
print_r($ospf_ports_poll);
echo("Database: ");
print_r($ospf_ports_db);
echo("\n");
}
### Loop array of entries and update
if (is_array($ospf_ports_db)){
foreach($ospf_ports_db as $ospf_port_db)
@@ -151,9 +166,9 @@ if (is_array($ospf_ports_db)){
if($ospf_port_poll['ospfAddressLessIf'])
{
$ospf_port_poll['interface_id'] = mysql_result(mysql_query("SELECT `interface_id` FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '".$ospf_port_poll['ospfAddressLessIf']."'"),0);
$ospf_port_poll['interface_id'] = @mysql_result(mysql_query("SELECT `interface_id` FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '".$ospf_port_poll['ospfAddressLessIf']."'"),0);
} else {
$ospf_port_poll['interface_id'] = mysql_result(mysql_query("SELECT A.`interface_id` FROM ipv4_addresses AS A, ports AS I WHERE A.ipv4_address = '".$ospf_port_poll['ospfIfIpAddress']."' AND I.interface_id = A.interface_id AND I.device_id = '".$device['device_id']."'"),0);
$ospf_port_poll['interface_id'] = @mysql_result(mysql_query("SELECT A.`interface_id` FROM ipv4_addresses AS A, ports AS I WHERE A.ipv4_address = '".$ospf_port_poll['ospfIfIpAddress']."' AND I.interface_id = A.interface_id AND I.device_id = '".$device['device_id']."'"),0);
}
foreach ($ospf_port_oids as $oid)