mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* Security fix: unauthorized access Affects nginx users: Moved php files outside of public html directory (Apache was protected by .htaccess) Affects all users: Some files did not check for authentication and could disclose some info. Better checks before including files from user input * git mv html/includes/ includes/html git mv html/pages/ includes/html/
49 lines
1.5 KiB
PHP
49 lines
1.5 KiB
PHP
<?php
|
|
|
|
require 'includes/html/graphs/common.inc.php';
|
|
|
|
$col_w = 7 + strlen($unit);
|
|
$rrd_options .= " COMMENT:'". str_pad($unit_long, 19) . str_pad("Cur", $col_w). str_pad("Min", $col_w) . "Max\\n'";
|
|
|
|
foreach (dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND `device_id` = ? ORDER BY `sensor_index`', array($class, $device['device_id'])) as $index => $sensor) {
|
|
// FIXME generic colour function
|
|
switch ($index % 7) {
|
|
case 0:
|
|
$colour = 'CC0000';
|
|
break;
|
|
|
|
case 1:
|
|
$colour = '008C00';
|
|
break;
|
|
|
|
case 2:
|
|
$colour = '4096EE';
|
|
break;
|
|
|
|
case 3:
|
|
$colour = '73880A';
|
|
break;
|
|
|
|
case 4:
|
|
$colour = 'D01F3C';
|
|
break;
|
|
|
|
case 5:
|
|
$colour = '36393D';
|
|
break;
|
|
|
|
case 6:
|
|
default:
|
|
$colour = 'FF0084';
|
|
}//end switch
|
|
|
|
$sensor_descr_fixed = rrdtool_escape($sensor['sensor_descr'], 12);
|
|
$rrd_file = get_sensor_rrd($device, $sensor);
|
|
$rrd_options .= " DEF:sensor{$sensor['sensor_id']}=$rrd_file:sensor:AVERAGE";
|
|
$rrd_options .= " LINE1:sensor{$sensor['sensor_id']}#$colour:'$sensor_descr_fixed'";
|
|
$rrd_options .= " GPRINT:sensor{$sensor['sensor_id']}:LAST:%5.1lf$unit";
|
|
$rrd_options .= " GPRINT:sensor{$sensor['sensor_id']}:MIN:%5.1lf$unit";
|
|
$rrd_options .= " GPRINT:sensor{$sensor['sensor_id']}:MAX:%5.1lf$unit\\l ";
|
|
$iter++;
|
|
}//end foreach
|