$entitysensor['dBm'] = "dbm"; if (is_array($oids)) { foreach ($oids as $index => $entry) { #echo("[" . $entry['entPhySensorType'] . "|" . $entry['entPhySensorValue']. "|" . $index . "]"); if ($entitysensor[$entry['entPhySensorType']] && is_numeric($entry['entPhySensorValue']) && is_numeric($index)) { $entPhysicalIndex = $index; $oid = ".1.3.6.1.2.1.99.1.1.1.4." . $index; $current = $entry['entPhySensorValue']; #ENTITY-SENSOR-MIB::entPhySensorUnitsDisplay.11 = STRING: "C" $descr = $entity_array[$index]['entPhysicalName']; # if ($descr || $device['os'] == "iosxr") if ($descr) { $descr = rewrite_entity_descr($descr); } else { $descr = $entity_array[$index]['entPhysicalDescr']; $descr = rewrite_entity_descr($descr); } $thisisnotbullshit = TRUE; $type = $entitysensor[$entry['entPhySensorType']]; // FIXME this stuff is foul if ($entry['entPhySensorScale'] == "nano") { $divisor = "1000000000"; $multiplier = "1"; } if ($entry['entPhySensorScale'] == "micro") { $divisor = "1000000"; $multiplier = "1"; } if ($entry['entPhySensorScale'] == "milli") { $divisor = "1000"; $multiplier = "1";
<div class="col-md-12 "> <div class="panel panel-default panel-condensed"> <div class="panel-heading"> '; echo '<a href="device/device=' . $device['device_id'] . '/tab=health/metric=processor/">'; echo "<img src='images/icons/processor.png'> <strong>Processors</strong></a>"; echo '</div> <table class="table table-hover table-condensed table-striped">'; $graph_array = array(); $graph_array['to'] = $config['time']['now']; $graph_array['type'] = 'processor_usage'; $graph_array['from'] = $config['time']['day']; $graph_array['legend'] = 'no'; $totalPercent = 0; foreach ($processors as $proc) { $text_descr = rewrite_entity_descr($proc['processor_descr']); $percent = $proc['processor_usage']; if ($config['cpu_details_overview'] === true) { $background = get_percentage_colours($percent); $graph_array['id'] = $proc['processor_id']; //Generate tooltip graphs $graph_array['height'] = '100'; $graph_array['width'] = '210'; $link_array = $graph_array; $link_array['page'] = 'graphs'; unset($link_array['height'], $link_array['width'], $link_array['legend']); $link = generate_url($link_array); $overlib_content = generate_overlib_content($graph_array, $device['hostname'] . ' - ' . $text_descr); //Generate the minigraph $graph_array['width'] = 80; $graph_array['height'] = 20;
$entitysensor['watt'] = 'power'; $entitysensor['hertz'] = 'freq'; $entitysensor['percentRH'] = 'humidity'; $entitysensor['rpm'] = 'fanspeed'; $entitysensor['celsius'] = 'temperature'; $entitysensor['watts'] = 'power'; $entitysensor['dBm'] = 'dbm'; if (is_array($oids)) { foreach ($oids as $index => $entry) { // echo("[" . $entry['entSensorType'] . "|" . $entry['entSensorValue']. "|" . $index . "]"); if ($entitysensor[$entry['entSensorType']] && is_numeric($entry['entSensorValue']) && is_numeric($index)) { $entPhysicalIndex = $index; if ($entity_array[$index]['entPhysicalName'] || $device['os'] == 'iosxr') { $descr = rewrite_entity_descr($entity_array[$index]['entPhysicalName']); } else { $descr = rewrite_entity_descr($entity_array[$index]['entPhysicalDescr']); } // Set description based on measured entity if it exists if (is_numeric($entry['entSensorMeasuredEntity']) && $entry['entSensorMeasuredEntity']) { $measured_descr = $entity_array[$entry['entSensorMeasuredEntity']]['entPhysicalName']; if (!$measured_descr) { $measured_descr = $entity_array[$entry['entSensorMeasuredEntity']]['entPhysicalDescr']; } $descr = $measured_descr . ' - ' . $descr; } // Bit dirty also, clean later $descr = str_replace('Temp: ', '', $descr); $descr = str_ireplace('temperature ', '', $descr); $oid = '.1.3.6.1.4.1.9.9.91.1.1.1.1.4.' . $index; $current = $entry['entSensorValue']; $type = $entitysensor[$entry['entSensorType']];
<?php $graph_type = "processor_usage"; echo "<div style='margin-top: 5px; padding: 0px;'>"; echo '<table class="table table-striped-two table-condensed">'; $i = '1'; $sql = "SELECT *, `processors`.`processor_id` as `processor_id`"; $sql .= " FROM `processors`"; $sql .= " LEFT JOIN `processors-state` ON `processors`.processor_id = `processors-state`.processor_id"; $sql .= " WHERE `device_id` = ?"; foreach (dbFetchRows($sql, array($device['device_id'])) as $proc) { $proc_url = "device/device=" . $device['device_id'] . "/tab=health/metric=processor/"; $mini_url = "graph.php?id=" . $proc['processor_id'] . "&type=" . $graph_type . "&from=" . $config['time']['day'] . "&to=" . $config['time']['now'] . "&width=80&height=20&bg=f4f4f4"; $text_descr = $proc['processor_descr']; $text_descr = rewrite_entity_descr($text_descr); $proc_popup = "onmouseover=\"return overlib('<div class=entity-title>" . $device['hostname'] . " - " . $text_descr; $proc_popup .= "</div><img src=\\'graph.php?id=" . $proc['processor_id'] . "&type=" . $graph_type . "&from=" . $config['time']['month'] . "&to=" . $config['time']['now'] . "&width=400&height=125\\'>"; $proc_popup .= "', RIGHT" . $config['overlib_defaults'] . ");\" onmouseout=\"return nd();\""; $percent = round($proc['processor_usage']); $background = get_percentage_colours($percent); echo "<tr>\n <td class=strong><a href='" . $proc_url . "' {$proc_popup}>" . $text_descr . "</a></td>\n <td width=90><a href='" . $proc_url . "' {$proc_popup}><img src='{$mini_url}'></a></td>\n <td width=200><a href='" . $proc_url . "' {$proc_popup}>\n " . print_percentage_bar(400, 20, $percent, $percent . "%", "ffffff", $background['left'], 100 - $percent . "%", "ffffff", $background['right']) . "\n </a></td>\n </tr>"; echo "<tr><td colspan=5>"; $graph_array['id'] = $proc['processor_id']; $graph_array['type'] = $graph_type; include "includes/print-graphrow.inc.php"; } echo "</table>"; echo "</div>";
// FIXME css alternating colours foreach (dbFetchRows('SELECT * FROM `mempools` WHERE device_id = ?', array($device['device_id'])) as $mempool) { if (!is_integer($i / 2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } if ($config['memcached']['enable'] === true) { $state = $memcache->get('mempool-' . $mempool['mempool_id'] . '-state'); d_echo($state); if (is_array($state)) { $mempool = array_merge($mempool, $state); } unset($state); } $text_descr = rewrite_entity_descr($mempool['mempool_descr']); $mempool_url = 'graphs/id=' . $mempool['mempool_id'] . '/type=mempool_usage/'; $mini_url = 'graph.php?id=' . $mempool['mempool_id'] . '&type=' . $graph_type . '&from=' . $config['time']['day'] . '&to=' . $config['time']['now'] . '&width=80&height=20&bg=f4f4f4'; $mempool_popup = "onmouseover=\"return overlib('<div class=list-large>" . $device['hostname'] . ' - ' . $text_descr; $mempool_popup .= "</div><img src=\\'graph.php?id=" . $mempool['mempool_id'] . '&type=' . $graph_type . '&from=' . $config['time']['month'] . '&to=' . $config['time']['now'] . "&width=400&height=125\\'>"; $mempool_popup .= "', RIGHT" . $config['overlib_defaults'] . ');" onmouseout="return nd();"'; $total = formatStorage($mempool['mempool_total']); $used = formatStorage($mempool['mempool_used']); $free = formatStorage($mempool['mempool_free']); $perc = round($mempool['mempool_used'] / $mempool['mempool_total'] * 100); $background = get_percentage_colours($percent); $right_background = $background['right']; $left_background = $background['left']; echo "<tr bgcolor={$row_colour}><td class=tablehead><a href='" . $mempool_url . "' {$mempool_popup}>" . $text_descr . "</a></td>\n <td width=90><a href='" . $mempool_url . "' {$mempool_popup}><img src='{$mini_url}'></a></td>\n <td width=200><a href='" . $mempool_url . "' {$mempool_popup}>\n " . print_percentage_bar(400, 20, $perc, "{$used} / {$total}", 'ffffff', $left_background, $free, 'ffffff', $right_background) . ' </a></td> <td width=50>' . $perc . '%</td>