");
#print_r($glo_conditions);
#echo("");
echo('
|
Type |
Subtype |
Metric |
Operator |
Value |
Severity |
On |
Status |
|
');
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, '.$deleted.' FROM '.$table.' WHERE 1';
$args = array();
if (is_numeric($device_id))
{
$query .= " AND device_id = ?";
$args[] = $device_id;
}
if (is_numeric($entry['entity']))
{
$query .= " AND ".$type."_id = ?";
$args[] = $entry['entity'];
}
$entities_db = dbFetchRows($query, $args);
foreach ($entities_db as $entity_db)
{
// Is this entity marked as deleted?
if ($entity_db['deleted'] != "1")
{
$entities[] = $entity_db['id'];
}
}
return $entities;
}
foreach ($glo_conditions as $type => $subtypes)
{
foreach ($subtypes as $subtype => $metrics)
{
if (empty($subtype)) { $subtype = "*"; }
foreach ($metrics as $metric => $entries)
{
foreach ($entries as $entry_id => $entry)
{
if ($entry['enable'] == 1) { $enabled = '
'; } else { $enabled = '
'; }
echo('');
echo(' | '.$type.' | '.$subtype.' | '.$metric.' | '.htmlentities($entry['operator']).' | '.$entry['value'].' | '.$entry['severity'].' | '.$enabled.' | ');
echo(' | | ');
echo('
');
// Get which entities match this checker
$entities = get_entity_list($type, $subtype, $device['device_id'], $entry['entity']);
if (!empty($entities))
{
echo(' | ');
foreach ($entities as $entity)
{
echo(''.generate_entity_link($type, $entity)."");
}
echo(' |
');
}
}
}
}
}
echo('
');
?>