mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
moar cleanup
git-svn-id: http://www.observium.org/svn/observer/trunk@1901 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
if(is_numeric($id))
|
||||
if (is_numeric($id))
|
||||
{
|
||||
$sensor = mysql_fetch_assoc(mysql_query("SELECT * FROM sensors WHERE sensor_id = '".mres($id)."'"));
|
||||
|
||||
if(is_numeric($sensor['device_id']) && ($config['allow_unauth_graphs'] || device_permitted($sensor['device_id'])))
|
||||
if (is_numeric($sensor['device_id']) && ($config['allow_unauth_graphs'] || device_permitted($sensor['device_id'])))
|
||||
{
|
||||
$device = device_by_id_cache($sensor['device_id']);
|
||||
|
||||
@@ -17,4 +17,4 @@ if(is_numeric($id))
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
@@ -4,20 +4,19 @@ $scale_min = "0";
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("current-" . $sensor['sensor_descr'] . ".rrd");
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("current-" . $sensor['sensor_descr'] . ".rrd");
|
||||
|
||||
$rrd_options .= " COMMENT:' Min Last Max\\n'";
|
||||
$rrd_options .= " COMMENT:' Min Last Max\\n'";
|
||||
|
||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 18),0,18);
|
||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 18),0,18);
|
||||
|
||||
$rrd_options .= " DEF:sensor=$rrd_filename:sensor:AVERAGE";
|
||||
$rrd_options .= " LINE1.5:sensor#cc0000:'" . $sensor['sensor_descr_fixed']."'";
|
||||
$rrd_options .= " GPRINT:sensor$current_id:MIN:%5.2lfA";
|
||||
$rrd_options .= " GPRINT:sensor:LAST:%5.2lfA";
|
||||
$rrd_options .= " GPRINT:sensor:MAX:%5.2lfA\\\\l";
|
||||
$rrd_options .= " DEF:sensor=$rrd_filename:sensor:AVERAGE";
|
||||
$rrd_options .= " LINE1.5:sensor#cc0000:'" . $sensor['sensor_descr_fixed']."'";
|
||||
$rrd_options .= " GPRINT:sensor$current_id:MIN:%5.2lfA";
|
||||
$rrd_options .= " GPRINT:sensor:LAST:%5.2lfA";
|
||||
$rrd_options .= " GPRINT:sensor:MAX:%5.2lfA\\\\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";
|
||||
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";
|
||||
|
||||
|
||||
?>
|
||||
?>
|
@@ -4,18 +4,18 @@ $scale_min = "0";
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$rrd_options .= " COMMENT:' Last Max\\n'";
|
||||
$rrd_options .= " COMMENT:' Last Max\\n'";
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("fanspeed-" . $sensor['sensor_type'] .'-'. $sensor['sensor_index'] . ".rrd");
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("fanspeed-" . $sensor['sensor_type'] .'-'. $sensor['sensor_index'] . ".rrd");
|
||||
|
||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 20),0,20);
|
||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 20),0,20);
|
||||
|
||||
$rrd_options .= " DEF:sensor=$rrd_filename:sensor:AVERAGE";
|
||||
$rrd_options .= " LINE1.5:sensor#cc0000:'" . str_replace(':','\:',str_replace('\*','*',quotemeta($sensor['sensor_descr_fixed'])))."'"; # Ugly hack :(
|
||||
$rrd_options .= " GPRINT:sensor:LAST:%3.0lfrpm";
|
||||
$rrd_options .= " GPRINT:sensor:MAX:%3.0lfrpm\\\\l";
|
||||
$rrd_options .= " DEF:sensor=$rrd_filename:sensor:AVERAGE";
|
||||
$rrd_options .= " LINE1.5:sensor#cc0000:'" . str_replace(':','\:',str_replace('\*','*',quotemeta($sensor['sensor_descr_fixed'])))."'"; # Ugly hack :(
|
||||
$rrd_options .= " GPRINT:sensor:LAST:%3.0lfrpm";
|
||||
$rrd_options .= " GPRINT:sensor:MAX:%3.0lfrpm\\\\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";
|
||||
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";
|
||||
|
||||
?>
|
||||
?>
|
@@ -4,18 +4,18 @@ $scale_min = "0";
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("frequency-" . $sensor['sensor_descr'] . ".rrd");
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("frequency-" . $sensor['sensor_descr'] . ".rrd");
|
||||
|
||||
$rrd_options .= " COMMENT:' Last Max\\n'";
|
||||
$rrd_options .= " COMMENT:' Last Max\\n'";
|
||||
|
||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 28),0,28);
|
||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 28),0,28);
|
||||
|
||||
$rrd_options .= " DEF:sensor=$rrd_filename:sensor:AVERAGE";
|
||||
$rrd_options .= " LINE1.5:sensor#cc0000:'" . $sensor['sensor_descr_fixed']."'";
|
||||
$rrd_options .= " GPRINT:sensor:LAST:%3.0lfHz";
|
||||
$rrd_options .= " GPRINT:sensor:MAX:%3.0lfHz\\\\l";
|
||||
$rrd_options .= " DEF:sensor=$rrd_filename:sensor:AVERAGE";
|
||||
$rrd_options .= " LINE1.5:sensor#cc0000:'" . $sensor['sensor_descr_fixed']."'";
|
||||
$rrd_options .= " GPRINT:sensor:LAST:%3.0lfHz";
|
||||
$rrd_options .= " GPRINT:sensor:MAX:%3.0lfHz\\\\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";
|
||||
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";
|
||||
|
||||
?>
|
||||
?>
|
@@ -5,30 +5,30 @@ $scale_max = "40";
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$rrd_options .= " COMMENT:' Last Max\\n'";
|
||||
$rrd_options .= " COMMENT:' Last Max\\n'";
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("humidity-" . $sensor['sensor_descr'] . ".rrd");
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("humidity-" . $sensor['sensor_descr'] . ".rrd");
|
||||
|
||||
|
||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 28),0,28);
|
||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 28),0,28);
|
||||
|
||||
$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 .= " CDEF:sensorwarm=sensor_max,".$sensor['sensor_limit'].",GT,sensor,UNKN,IF";
|
||||
$rrd_options .= " CDEF:sensorcold=sensor_min,20,LT,sensor,UNKN,IF";
|
||||
$rrd_options .= " AREA:sensor_max#c5c5c5";
|
||||
$rrd_options .= " AREA:sensor_min#ffffffff";
|
||||
$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 .= " CDEF:sensorwarm=sensor_max,".$sensor['sensor_limit'].",GT,sensor,UNKN,IF";
|
||||
$rrd_options .= " CDEF:sensorcold=sensor_min,20,LT,sensor,UNKN,IF";
|
||||
$rrd_options .= " AREA:sensor_max#c5c5c5";
|
||||
$rrd_options .= " AREA:sensor_min#ffffffff";
|
||||
|
||||
# $rrd_options .= " AREA:sensor#bbd392";
|
||||
# $rrd_options .= " AREA:sensorwarm#FFCCCC";
|
||||
# $rrd_options .= " AREA:sensorcold#CCCCFF";
|
||||
$rrd_options .= " LINE1:sensor#cc0000:'" . str_replace(':','\:',str_replace('\*','*',quotemeta($sensor['sensor_descr_fixed'])))."'"; # Ugly hack :(
|
||||
$rrd_options .= " LINE1:sensorwarm#660000";
|
||||
$rrd_options .= " GPRINT:sensor:LAST:%3.0lf%%";
|
||||
$rrd_options .= " GPRINT:sensor:MAX:%3.0lf%%\\\\l";
|
||||
$rrd_options .= " LINE1:sensor#cc0000:'" . str_replace(':','\:',str_replace('\*','*',quotemeta($sensor['sensor_descr_fixed'])))."'"; # Ugly hack :(
|
||||
$rrd_options .= " LINE1:sensorwarm#660000";
|
||||
$rrd_options .= " GPRINT:sensor:LAST:%3.0lf%%";
|
||||
$rrd_options .= " GPRINT:sensor:MAX:%3.0lf%%\\\\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";
|
||||
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";
|
||||
|
||||
?>
|
||||
?>
|
@@ -5,35 +5,34 @@ $scale_max = "60";
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$rrd_options .= " COMMENT:' Cur Min Max\\n'";
|
||||
$rrd_options .= " COMMENT:' Cur Min Max\\n'";
|
||||
|
||||
### FIXME: Overwrite default because it won't work here yet
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/temperature-" . safename($sensor['sensor_type']."-".$sensor['sensor_index']) . ".rrd";
|
||||
### FIXME: Overwrite default because it won't work here yet
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/temperature-" . safename($sensor['sensor_type']."-".$sensor['sensor_index']) . ".rrd";
|
||||
|
||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 21),0,21);
|
||||
$sensor['sensor_descr_fixed'] = str_replace(':','\:',str_replace('\*','*',$sensor['sensor_descr_fixed']));
|
||||
|
||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 21),0,21);
|
||||
$sensor['sensor_descr_fixed'] = str_replace(':','\:',str_replace('\*','*',$sensor['sensor_descr_fixed']));
|
||||
|
||||
$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 .= " CDEF:sensorwarm=sensor_max,".$sensor['sensor_limit'].",GT,sensor,UNKN,IF";
|
||||
$rrd_options .= " CDEF:sensorcold=sensor_min,20,LT,sensor,UNKN,IF";
|
||||
$rrd_options .= " AREA:sensor_max#c5c5c5";
|
||||
$rrd_options .= " AREA:sensor_min#ffffffff";
|
||||
$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 .= " CDEF:sensorwarm=sensor_max,".$sensor['sensor_limit'].",GT,sensor,UNKN,IF";
|
||||
$rrd_options .= " CDEF:sensorcold=sensor_min,20,LT,sensor,UNKN,IF";
|
||||
$rrd_options .= " AREA:sensor_max#c5c5c5";
|
||||
$rrd_options .= " AREA:sensor_min#ffffffff";
|
||||
|
||||
# $rrd_options .= " AREA:sensor#bbd392";
|
||||
# $rrd_options .= " AREA:sensorwarm#FFCCCC";
|
||||
# $rrd_options .= " AREA:sensorcold#CCCCFF";
|
||||
# $rrd_options .= " LINE1:sensor#cc0000:'" . str_replace(':','\:',str_replace('\*','*',quotemeta($sensor['sensor_descr_fixed'])))."'"; # Ugly hack :(
|
||||
|
||||
$rrd_options .= " LINE1.5:sensor#cc0000:'" . $sensor['sensor_descr_fixed']."'";
|
||||
$rrd_options .= " LINE1.5:sensor#cc0000:'" . $sensor['sensor_descr_fixed']."'";
|
||||
# $rrd_options .= " LINE1.5:sensorwarm#660000";
|
||||
$rrd_options .= " GPRINT:sensor:LAST:%4.1lfC";
|
||||
$rrd_options .= " GPRINT:sensor_min:MIN:%4.1lfC";
|
||||
$rrd_options .= " GPRINT:sensor_max:MAX:%4.1lfC\\\\l";
|
||||
$rrd_options .= " GPRINT:sensor:LAST:%4.1lfC";
|
||||
$rrd_options .= " GPRINT:sensor_min:MIN:%4.1lfC";
|
||||
$rrd_options .= " GPRINT:sensor_max:MAX:%4.1lfC\\\\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";
|
||||
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";
|
||||
|
||||
?>
|
||||
?>
|
@@ -24,7 +24,7 @@ $rrd_options .= " LINE1.5:sensor#cc0000:'" . $sensor['sensor_descr_fixed']."'";
|
||||
$rrd_options .= " GPRINT:sensor:LAST:%6.2lfV";
|
||||
$rrd_options .= " GPRINT:sensor:MAX:%6.2lfV\\\\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";
|
||||
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";
|
||||
|
||||
?>
|
||||
?>
|
Reference in New Issue
Block a user