minisyntaxfix + add rewrite for EX3300

git-svn-id: http://www.observium.org/svn/observer/trunk@3203 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2012-05-18 10:10:46 +00:00
parent 32f7259c7b
commit 931f405b77
2 changed files with 17 additions and 14 deletions

View File

@@ -22,19 +22,19 @@ echo('<table cellspacing="0" cellpadding=5 class="sortable" width="100%">
function get_entity_list($type, $subtype = "*", $device_id = "*", $entry) function get_entity_list($type, $subtype = "*", $device_id = "*", $entry)
{ {
if($type == "storage") { $table = $type; } else { $table = $type.'s'; } if ($type == "storage") { $table = $type; } else { $table = $type.'s'; }
if($type == "port") { $deleted = "deleted"; } else { $deleted = $type.'_deleted'; } if ($type == "port") { $deleted = "deleted"; } else { $deleted = $type.'_deleted'; }
$query = 'SELECT '.$type.'_id AS id, '.$deleted.' FROM '.$table.' WHERE 1'; $query = 'SELECT '.$type.'_id AS id, '.$deleted.' FROM '.$table.' WHERE 1';
$args = array(); $args = array();
if(is_numeric($device_id)) if (is_numeric($device_id))
{ {
$query .= " AND device_id = ?"; $query .= " AND device_id = ?";
$args[] = $device_id; $args[] = $device_id;
} }
if(is_numeric($entry['entity'])) if (is_numeric($entry['entity']))
{ {
$query .= " AND ".$type."_id = ?"; $query .= " AND ".$type."_id = ?";
$args[] = $entry['entity']; $args[] = $entry['entity'];
@@ -42,25 +42,27 @@ function get_entity_list($type, $subtype = "*", $device_id = "*", $entry)
$entities_db = dbFetchRows($query, $args); $entities_db = dbFetchRows($query, $args);
foreach($entities_db as $entity_db) foreach ($entities_db as $entity_db)
{ {
/// Is this entity marked as deleted? /// Is this entity marked as deleted?
if($entity_db['deleted'] != "1") if ($entity_db['deleted'] != "1")
{
$entities[] = $entity_db['id']; $entities[] = $entity_db['id'];
}
} }
return $entities; return $entities;
} }
foreach($glo_conditions as $type => $subtypes) foreach ($glo_conditions as $type => $subtypes)
{ {
foreach($subtypes as $subtype => $metrics) foreach ($subtypes as $subtype => $metrics)
{ {
if(empty($subtype)) { $subtype = "*"; } if (empty($subtype)) { $subtype = "*"; }
foreach($metrics as $metric => $entries) foreach ($metrics as $metric => $entries)
{ {
foreach($entries as $entry_id => $entry) foreach ($entries as $entry_id => $entry)
{ {
if($entry['enable'] == 1) { $enabled = '<img align=absmiddle src="images/16/tick.png" />'; } else { $enabled = '<img align=absmiddle src="images/16/stop.png" />'; } if ($entry['enable'] == 1) { $enabled = '<img align=absmiddle src="images/16/tick.png" />'; } else { $enabled = '<img align=absmiddle src="images/16/stop.png" />'; }
echo('<tr class=list>'); echo('<tr class=list>');
echo('<td></td><td><strong>'.$type.'</strong></td><td>'.$subtype.'</td><td>'.$metric.'</td><td>'.htmlentities($entry['operator']).'</td><td>'.$entry['value'].'</td><td>'.$entry['severity'].'</td><td>'.$enabled.'</td>'); echo('<td></td><td><strong>'.$type.'</strong></td><td>'.$subtype.'</td><td>'.$metric.'</td><td>'.htmlentities($entry['operator']).'</td><td>'.$entry['value'].'</td><td>'.$entry['severity'].'</td><td>'.$enabled.'</td>');
echo('<td></td><td></td>'); echo('<td></td><td></td>');
@@ -69,10 +71,10 @@ foreach($glo_conditions as $type => $subtypes)
/// Get which entities match this checker /// Get which entities match this checker
$entities = get_entity_list($type, $subtype, $device['device_id'], $entry['entity']); $entities = get_entity_list($type, $subtype, $device['device_id'], $entry['entity']);
if(!empty($entities)) if (!empty($entities))
{ {
echo('<tr class=list><td></td><td colspan=9><strong>'); echo('<tr class=list><td></td><td colspan=9><strong>');
foreach($entities as $entity) foreach ($entities as $entity)
{ {
echo('<span style="padding:3px 5px; margin: 0px 3px; background-color: #e5e5e5;">'.generate_entity_link($type, $entity)."</span>"); echo('<span style="padding:3px 5px; margin: 0px 3px; background-color: #e5e5e5;">'.generate_entity_link($type, $entity)."</span>");
} }

View File

@@ -176,6 +176,7 @@ $rewrite_junos_hardware = array(
'jnxProductNameSRX5600' => 'SRX5600', 'jnxProductNameSRX5600' => 'SRX5600',
'jnxProductNameMX240' => 'MX240', 'jnxProductNameMX240' => 'MX240',
'jnxProductNameEX3200' => 'EX3200', 'jnxProductNameEX3200' => 'EX3200',
'jnxProductNameEX3300' => 'EX3300',
'jnxProductNameEX4200' => 'EX4200', 'jnxProductNameEX4200' => 'EX4200',
'jnxProductNameEX8208' => 'EX8208', 'jnxProductNameEX8208' => 'EX8208',
'jnxProductNameEX8216' => 'EX8216', 'jnxProductNameEX8216' => 'EX8216',