some database updates (adding some _deleted fields) and fix links table.

git-svn-id: http://www.observium.org/svn/observer/trunk@3199 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2012-05-17 10:33:56 +00:00
parent 5d148bab86
commit 2880cf8f23
4 changed files with 17 additions and 7 deletions

View File

@ -357,7 +357,9 @@ function generate_entity_link($type, $entity, $text = NULL, $graph_type=NULL)
$link = generate_port_link($entity, $text, $graph_type);
break;
case "storage":
$url = generate_url(array('page' => 'device', 'device' => $entity['device_id'], 'tab' => 'health', 'metric' => 'storage'));
if(empty($text)) { $text = $entity['storage_descr']; }
$link = generate_link($text, array('page' => 'device', 'device' => $entity['device_id'], 'tab' => 'health', 'metric' => 'storage'));
break;
default:
$link = $entity[$type.'_id'];
}

View File

@ -37,7 +37,7 @@ foreach ($devices as $device)
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . safename($int['ifIndex'] . ".rrd");
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $port['label'];
$rrd_list[$i]['descr_in'] = $port['label'];
$rrd_list[$i]['descr_in'] = $device['hostname'];
$rrd_list[$i]['descr_out'] = $port['ifAlias'];
$rrd_list[$i]['ds_in'] = $ds_in;
$rrd_list[$i]['ds_out'] = $ds_out;

View File

@ -23,8 +23,9 @@ echo('<table cellspacing="0" cellpadding=5 class="sortable" width="100%">
function get_entity_list($type, $subtype = "*", $device_id = "*", $entry)
{
if($type == "storage") { $table = $type; } else { $table = $type.'s'; }
if($type == "port") { $deleted = "deleted"; } else { $deleted = $type.'_deleted'; }
$query = 'SELECT '.$type.'_id AS id FROM '.$table.' WHERE 1';
$query = 'SELECT '.$type.'_id AS id, '.$deleted.' FROM '.$table.' WHERE 1';
$args = array();
if(is_numeric($device_id))
@ -43,7 +44,9 @@ function get_entity_list($type, $subtype = "*", $device_id = "*", $entry)
foreach($entities_db as $entity_db)
{
$entities[] = $entity_db['id'];
/// Is this entity marked as deleted?
if($entity_db['deleted'] != "1")
$entities[] = $entity_db['id'];
}
return $entities;
}
@ -68,12 +71,12 @@ foreach($glo_conditions as $type => $subtypes)
if(!empty($entities))
{
echo('<tr class=list><td></td><td colspan=9><strong>Entities: </strong>');
echo('<tr class=list><td></td><td colspan=9><strong>');
foreach($entities as $entity)
{
echo(generate_entity_link($type, $entity)." ");
echo('<span style="padding:3px 5px; margin: 0px 3px; background-color: #e5e5e5;">'.generate_entity_link($type, $entity)."</span>");
}
echo('</td></tr>');
echo('</strong></td></tr>');
}
}
}

5
sql-schema/023.sql Normal file
View File

@ -0,0 +1,5 @@
ALTER TABLE `storage` ADD `storage_deleted` BOOL NOT NULL DEFAULT '0';
ALTER TABLE `links` CHANGE `local_interface_id` `local_port_id` INT( 11 ) NULL DEFAULT NULL;
ALTER TABLE `links` CHANGE `remote_interface_id` `remote_port_id` INT( 11 ) NULL DEFAULT NULL;
ALTER TABLE `sensors` ADD `sensor_deleted` BOOL NOT NULL DEFAULT '0' AFTER `sensor_id`;
ALTER TABLE `mempools` ADD `mempool_deleted` BOOL NOT NULL DEFAULT '0';