mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix graph colours for volt and fan, optimize code
git-svn-id: http://www.observium.org/svn/observer/trunk@824 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -10,17 +10,13 @@ include("common.inc.php");
|
||||
|
||||
$hostname = mysql_result(mysql_query("SELECT hostname FROM devices WHERE device_id = '" . $fanspeed['fan_host'] . "'"),0);
|
||||
|
||||
$fanspeed['fan_descr_fixed'] = str_pad($fanspeed['fan_descr'], 28);
|
||||
$fanspeed['fan_descr_fixed'] = substr($fanspeed['fan_descr_fixed'],0,28);
|
||||
$fanspeed['fan_descr_fixed'] = substr(str_pad($fanspeed['fan_descr'], 28),0,28);
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$hostname."/" . safename("fan-" . $fanspeed['fan_descr'] . ".rrd");
|
||||
|
||||
$rrd_options .= " DEF:fan=$rrd_filename:fan:AVERAGE";
|
||||
$rrd_options .= " CDEF:fanwarm=fan,".$fanspeed['fan_limit'].",GT,fan,UNKN,IF";
|
||||
$rrd_options .= " AREA:fan#FFFF99";
|
||||
$rrd_options .= " AREA:fanwarm#FF9999";
|
||||
$rrd_options .= " LINE1.5:fan#cc0000:'" . str_replace(':','\:',str_replace('\*','*',quotemeta($fanspeed['fan_descr_fixed'])))."'"; # Ugly hack :(
|
||||
$rrd_options .= " LINE1.5:fanwarm#660000";
|
||||
$rrd_options .= " GPRINT:fan:LAST:%3.0lfrpm";
|
||||
$rrd_options .= " GPRINT:fan:MAX:%3.0lfrpm\\\\l";
|
||||
|
||||
|
@@ -11,8 +11,7 @@ include("common.inc.php");
|
||||
|
||||
$hostname = mysql_result(mysql_query("SELECT hostname FROM devices WHERE device_id = '" . $temperature['temp_host'] . "'"),0);
|
||||
|
||||
$temperature['temp_descr_fixed'] = str_pad($temperature['temp_descr'], 28);
|
||||
$temperature['temp_descr_fixed'] = substr($temperature['temp_descr_fixed'],0,28);
|
||||
$temperature['temp_descr_fixed'] = substr(str_pad($temperature['temp_descr'], 28),0,28);
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$hostname."/" . safename("temp-" . $temperature['temp_descr'] . ".rrd");
|
||||
|
||||
|
@@ -10,17 +10,13 @@ include("common.inc.php");
|
||||
|
||||
$hostname = mysql_result(mysql_query("SELECT hostname FROM devices WHERE device_id = '" . $voltage['volt_host'] . "'"),0);
|
||||
|
||||
$voltage['volt_descr_fixed'] = str_pad($voltage['volt_descr'], 28);
|
||||
$voltage['volt_descr_fixed'] = substr($voltage['volt_descr_fixed'],0,28);
|
||||
$voltage['volt_descr_fixed'] = substr(str_pad($voltage['volt_descr'], 28),0,28);
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$hostname."/" . safename("volt-" . $voltage['volt_descr'] . ".rrd");
|
||||
|
||||
$rrd_options .= " DEF:volt=$rrd_filename:volt:AVERAGE";
|
||||
$rrd_options .= " CDEF:voltwarm=volt,".$voltage['volt_limit'].",GT,volt,UNKN,IF";
|
||||
$rrd_options .= " AREA:volt#FFFF99";
|
||||
$rrd_options .= " AREA:voltwarm#FF9999";
|
||||
$rrd_options .= " LINE1.5:volt#cc0000:'" . $voltage['volt_descr_fixed']."'";
|
||||
$rrd_options .= " LINE1.5:voltwarm#660000";
|
||||
$rrd_options .= " GPRINT:volt:LAST:%3.0lfV";
|
||||
$rrd_options .= " GPRINT:volt:MAX:%3.0lfV\\\\l";
|
||||
|
||||
|
Reference in New Issue
Block a user