<?php $scale_min = '0'; require 'includes/graphs/common.inc.php'; $rrd_options .= ' -A '; $rrd_options .= " COMMENT:' Last Max\\n'"; $rrd_options .= " DEF:sensor={$rrd_filename}:sensor:AVERAGE"; $rrd_options .= " DEF:sensor_max={$rrd_filename}:sensor:MAX"; $rrd_options .= " DEF:sensor_min={$rrd_filename}:sensor:MIN"; $rrd_options .= ' AREA:sensor_max#c5c5c5'; $rrd_options .= ' AREA:sensor_min#ffffffff'; if ($sensor['poller_type'] == "ipmi") { $rrd_options .= " LINE1.5:sensor#cc0000:'" . rrdtool_escape(ipmiSensorName($device['hardware'], $sensor['sensor_descr'], $ipmiSensorsNames), 21) . "'"; } else { $rrd_options .= " LINE1.5:sensor#cc0000:'" . rrdtool_escape($sensor['sensor_descr'], 21) . "'"; } $rrd_options .= ' GPRINT:sensor:LAST:%6.2lfW'; $rrd_options .= ' GPRINT:sensor:MAX:%6.2lfW\\l'; if (is_numeric($sensor['sensor_limit'])) { $rrd_options .= ' HRULE:' . $sensor['sensor_limit'] . '#999999::dashes'; } if (is_numeric($sensor['sensor_limit_low'])) { $rrd_options .= ' HRULE:' . $sensor['sensor_limit_low'] . '#999999::dashes'; }
// FIXME - DUPLICATED IN health/sensors $graph_colour = str_replace('#', '', $row_colour); $graph_array = array(); $graph_array['height'] = '100'; $graph_array['width'] = '210'; $graph_array['to'] = $config['time']['now']; $graph_array['id'] = $sensor['sensor_id']; $graph_array['type'] = $graph_type; $graph_array['from'] = $config['time']['day']; $graph_array['legend'] = 'no'; $link_array = $graph_array; $link_array['page'] = 'graphs'; unset($link_array['height'], $link_array['width'], $link_array['legend']); $link = generate_url($link_array); if ($sensor['poller_type'] == "ipmi") { $sensor['sensor_descr'] = substr(ipmiSensorName($device['hardware'], $sensor['sensor_descr'], $ipmiSensorsNames), 0, 48); } else { $sensor['sensor_descr'] = substr($sensor['sensor_descr'], 0, 48); } $overlib_content = '<div style="width: 580px;"><h2>' . $device['hostname'] . ' - ' . $sensor['sensor_descr'] . '</h1>'; foreach (array('day', 'week', 'month', 'year') as $period) { $graph_array['from'] = $config['time'][$period]; $overlib_content .= str_replace('"', "\\'", generate_graph_tag($graph_array)); } $overlib_content .= '</div>'; $graph_array['width'] = 80; $graph_array['height'] = 20; $graph_array['bg'] = 'ffffff00'; // the 00 at the end makes the area transparent. $graph_array['from'] = $config['time']['day']; $sensor_minigraph = generate_lazy_graph_tag($graph_array);
// FIXME - DUPLICATED IN health/sensors $graph_colour = str_replace('#', '', $row_colour); $graph_array = array(); $graph_array['height'] = '100'; $graph_array['width'] = '210'; $graph_array['to'] = $config['time']['now']; $graph_array['id'] = $sensor['sensor_id']; $graph_array['type'] = $graph_type; $graph_array['from'] = $config['time']['day']; $graph_array['legend'] = 'no'; $link_array = $graph_array; $link_array['page'] = 'graphs'; unset($link_array['height'], $link_array['width'], $link_array['legend']); $link = generate_url($link_array); if ($sensor['poller_type'] == "ipmi") { $sensor['sensor_descr'] = truncate(ipmiSensorName($device['hardware'], $sensor['sensor_descr'], $ipmiSensorsNames), 48, ''); } else { $sensor['sensor_descr'] = truncate($sensor['sensor_descr'], 48, ''); } $overlib_content = '<div style="width: 580px;"><h2>' . $device['hostname'] . ' - ' . $sensor['sensor_descr'] . '</h1>'; foreach (array('day', 'week', 'month', 'year') as $period) { $graph_array['from'] = $config['time'][$period]; $overlib_content .= str_replace('"', "\\'", generate_graph_tag($graph_array)); } $overlib_content .= '</div>'; $graph_array['width'] = 80; $graph_array['height'] = 20; $graph_array['bg'] = 'ffffff00'; // the 00 at the end makes the area transparent. $graph_array['from'] = $config['time']['day']; $sensor_minigraph = generate_lazy_graph_tag($graph_array);
<?php $row = 1; foreach (dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND `device_id` = ? ORDER BY `sensor_descr`', array($class, $device['device_id'])) as $sensor) { if (!is_integer($row / 2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } if ($sensor['poller_type'] == "ipmi") { $sensor_descr = ipmiSensorName($device['hardware'], $sensor['sensor_descr'], $ipmiSensorsNames); } else { $sensor_descr = $sensor['sensor_descr']; } $sensor_current = format_si($sensor['sensor_current']) . $unit; $sensor_limit = format_si($sensor['sensor_limit']) . $unit; $sensor_limit_low = format_si($sensor['sensor_limit_low']) . $unit; echo "<div class='panel panel-default'>\n <div class='panel-heading'>\n <h3 class='panel-title'>{$sensor_descr} <div class='pull-right'>{$sensor_current} | {$sensor_limit_low} <> {$sensor_limit}</div></h3>\n </div>"; echo "<div class='panel-body'>"; $graph_array['id'] = $sensor['sensor_id']; $graph_array['type'] = $graph_type; include 'includes/print-graphrow.inc.php'; echo '</div></div>'; $row++; }