Ejemplo n.º 1
0
<?php

$storage = dbFetchCell('select count(*) from storage WHERE device_id = ?', array($device['device_id']));
$diskio = dbFetchCell('select count(*) from ucd_diskio WHERE device_id = ?', array($device['device_id']));
$mempools = dbFetchCell('select count(*) from mempools WHERE device_id = ?', array($device['device_id'])) + count_mib_mempools($device);
$processor = dbFetchCell('select count(*) from processors WHERE device_id = ?', array($device['device_id'])) + count_mib_processors($device);
$charge = dbFetchCell("select count(*) from sensors WHERE sensor_class='charge' AND device_id = ?", array($device['device_id']));
$temperatures = dbFetchCell("select count(*) from sensors WHERE sensor_class='temperature' AND device_id = ?", array($device['device_id']));
$humidity = dbFetchCell("select count(*) from sensors WHERE sensor_class='humidity' AND device_id = ?", array($device['device_id']));
$fans = dbFetchCell("select count(*) from sensors WHERE sensor_class='fanspeed' AND device_id = ?", array($device['device_id']));
$volts = dbFetchCell("select count(*) from sensors WHERE sensor_class='voltage' AND device_id = ?", array($device['device_id']));
$current = dbFetchCell("select count(*) from sensors WHERE sensor_class='current' AND device_id = ?", array($device['device_id']));
$freqs = dbFetchCell("select count(*) from sensors WHERE sensor_class='frequency' AND device_id = ?", array($device['device_id']));
$power = dbFetchCell("select count(*) from sensors WHERE sensor_class='power' AND device_id = ?", array($device['device_id']));
$dBm = dbFetchCell("select count(*) from sensors WHERE sensor_class='dBm' AND device_id = ?", array($device['device_id']));
$states = dbFetchCell("select count(*) from sensors WHERE sensor_class='state' AND device_id = ?", array($device['device_id']));
$load = dbFetchCell("select count(*) from sensors WHERE sensor_class='load' AND device_id = ?", array($device['device_id']));
$signal = dbFetchCell("select count(*) from sensors WHERE sensor_class='signal' AND device_id = ?", array($device['device_id']));
unset($datas);
$datas[] = 'overview';
if ($processor) {
    $datas[] = 'processor';
}
if ($mempools) {
    $datas[] = 'mempool';
}
if ($storage) {
    $datas[] = 'storage';
}
if ($diskio) {
    $datas[] = 'diskio';
Ejemplo n.º 2
0
function count_mib_health($device)
{
    return count_mib_mempools($device) + count_mib_processors($device);
}
Ejemplo n.º 3
0
<?php

$graph_type = 'mempool_usage';
$i = '1';
if (count_mib_mempools($device) > 0) {
    $mempools = get_mib_mempools($device);
    $graph_type = 'device_mempool';
} else {
    $mempools = dbFetchRows('SELECT * FROM `mempools` WHERE device_id = ?', array($device['device_id']));
}
// FIXME css alternating colours
foreach ($mempools as $mempool) {
    if (!is_integer($i / 2)) {
        $row_colour = $list_colour_a;
    } else {
        $row_colour = $list_colour_b;
    }
    $text_descr = rewrite_entity_descr($mempool['mempool_descr']);
    if ($graph_type == 'device_mempool') {
        $id = 'device';
        $val = $device['device_id'];
    } else {
        $id = 'id';
        $val = $mempool['mempool_id'];
    }
    $mempool_url = 'graphs/' . $id . '=' . $val . '/type=' . $graph_type . '/';
    $mini_url = 'graph.php?' . $id . '=' . $val . '&amp;type=' . $graph_type . '&amp;from=' . $config['time']['day'] . '&amp;to=' . $config['time']['now'] . '&amp;width=80&amp;height=20&amp;bg=f4f4f4';
    $mempool_popup = "onmouseover=\"return overlib('<div class=list-large>" . $device['hostname'] . ' - ' . $text_descr;
    $mempool_popup .= "</div><img src=\\'graph.php?'.{$id}.'=" . $val . '&amp;type=' . $graph_type . '&amp;from=' . $config['time']['month'] . '&amp;to=' . $config['time']['now'] . "&amp;width=400&amp;height=125\\'>";
    $mempool_popup .= "', RIGHT" . $config['overlib_defaults'] . ');" onmouseout="return nd();"';
    $total = formatStorage($mempool['mempool_total']);