mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
ipmi sensors rewrite based on known hardware id
This commit is contained in:
@@ -16,7 +16,7 @@ $rrd_options .= ' CDEF:sensor_diff=sensor_max,sensor_min,-';
|
||||
$rrd_options .= ' AREA:sensor_min';
|
||||
$rrd_options .= ' AREA:sensor_diff#c5c5c5::STACK';
|
||||
|
||||
$rrd_options .= " LINE1.5:sensor#cc0000:'".rrdtool_escape($sensor['sensor_descr'], 21)."'";
|
||||
$rrd_options .= " LINE1.5:sensor#cc0000:'".rrdtool_escape(ipmiSensorName($device['hardware'], $sensor['sensor_descr'], $ipmiSensorsNames), 21)."'"
|
||||
$rrd_options .= ' GPRINT:sensor_min:MIN:%4.1lfC';
|
||||
$rrd_options .= ' GPRINT:sensor:LAST:%4.1lfC';
|
||||
$rrd_options .= ' GPRINT:sensor_max:MAX:%4.1lfC\\l';
|
||||
|
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
//echo '<table cellspacing=0 cellpadding=5 width=100%>';
|
||||
|
||||
$row = 1;
|
||||
|
||||
foreach (dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND `device_id` = ? ORDER BY `sensor_descr`', array($class, $device['device_id'])) as $sensor) {
|
||||
@@ -11,7 +9,7 @@ foreach (dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND `devi
|
||||
else {
|
||||
$row_colour = $list_colour_b;
|
||||
}
|
||||
$sensor_descr = $sensor['sensor_descr'];
|
||||
$sensor_descr = ipmiSensorName($device['hardware'], $sensor['sensor_descr'], $ipmiSensorsNames);
|
||||
$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;
|
||||
@@ -30,5 +28,3 @@ foreach (dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND `devi
|
||||
|
||||
$row++;
|
||||
}
|
||||
|
||||
//echo '</table>';
|
||||
|
@@ -1,6 +1,4 @@
|
||||
<?php
|
||||
|
||||
|
||||
if ($sensor_class == 'state') {
|
||||
$sensors = dbFetchRows('SELECT * FROM `sensors` LEFT JOIN `sensors_to_state_indexes` ON sensors_to_state_indexes.sensor_id = sensors.sensor_id LEFT JOIN state_indexes ON state_indexes.state_index_id = sensors_to_state_indexes.state_index_id WHERE `sensor_class` = ? AND device_id = ? ORDER BY `sensor_type`, `sensor_index`+0, `sensor_oid`', array($sensor_class, $device['device_id']));
|
||||
}
|
||||
@@ -45,6 +43,8 @@ if (count($sensors)) {
|
||||
$link_array['page'] = 'graphs';
|
||||
unset($link_array['height'], $link_array['width'], $link_array['legend']);
|
||||
$link = generate_url($link_array);
|
||||
|
||||
$sensor['sensor_descr'] = truncate(ipmiSensorName($device['hardware'], $sensor['sensor_descr'], $ipmiSensorsNames), 48, '');
|
||||
|
||||
$overlib_content = '<div style="width: 580px;"><h2>'.$device['hostname'].' - '.$sensor['sensor_descr'].'</h1>';
|
||||
foreach (array('day', 'week', 'month', 'year') as $period) {
|
||||
@@ -61,7 +61,6 @@ if (count($sensors)) {
|
||||
$graph_array['from'] = $config['time']['day'];
|
||||
$sensor_minigraph = generate_lazy_graph_tag($graph_array);
|
||||
|
||||
$sensor['sensor_descr'] = truncate($sensor['sensor_descr'], 48, '');
|
||||
if (!empty($state_translation['0']['state_descr'])) {
|
||||
$state_style="";
|
||||
switch ($state_translation['0']['state_generic_value']) {
|
||||
|
@@ -1331,3 +1331,29 @@ function rewrite_brocade_fc_switches($descr) {
|
||||
}
|
||||
return $hardware;
|
||||
}
|
||||
|
||||
$ipmiSensorsNames = array(
|
||||
"HP ProLiant BL460c G6" => array(
|
||||
"Temp 1" => "Ambient zone",
|
||||
"Temp 2" => "CPU 1",
|
||||
"Temp 3" => "CPU 2",
|
||||
"Temp 4" => "Memory zone",
|
||||
"Temp 5" => "Memory zone",
|
||||
"Temp 6" => "Memory zone",
|
||||
"Temp 7" => "System zone",
|
||||
"Temp 8" => "System zone",
|
||||
"Temp 9" => "System zone",
|
||||
"Temp 10" => "Storage zone",
|
||||
),
|
||||
"HP ProLiant BL460c G1" => array(
|
||||
"Temp 1" => "System zone",
|
||||
"Temp 2" => "CPU 1 zone",
|
||||
"Temp 3" => "CPU 1",
|
||||
"Temp 4" => "CPU 1",
|
||||
"Temp 5" => "CPU 2 zone",
|
||||
"Temp 6" => "CPU 2",
|
||||
"Temp 7" => "CPU 2",
|
||||
"Temp 8" => "Memory zone",
|
||||
"Temp 9" => "Ambient zone",
|
||||
),
|
||||
);
|
||||
|
Reference in New Issue
Block a user