correctly escape : for temperatures so FPC temperature works on junos + add safename() function to strip unwanted characters from filenames - should not break anything existing afaik

git-svn-id: http://www.observium.org/svn/observer/trunk@765 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2010-02-05 22:10:06 +00:00
parent e644b9d2dd
commit 57a9689ddd
46 changed files with 66 additions and 65 deletions
+3 -5
View File
@@ -14,17 +14,15 @@ include("common.inc.php");
$temperature['temp_descr_fixed'] = str_pad($temperature['temp_descr'], 28);
$temperature['temp_descr_fixed'] = substr($temperature['temp_descr_fixed'],0,28);
$filename = str_replace(")", "_", str_replace("(", "_", str_replace("/", "_", str_replace(" ", "_",$temperature['temp_descr']))));
$rrd_filename = $config['rrd_dir'] . "/".$hostname."/temp-" . $filename . ".rrd";
$rrd_filename = $config['rrd_dir'] . "/".$hostname."/" . safename("temp-" . $temperature['temp_descr'] . ".rrd");
$rrd_options .= " DEF:temp=$rrd_filename:temp:AVERAGE";
$rrd_options .= " CDEF:tempwarm=temp,".$temperature[temp_limit].",GT,temp,UNKN,IF";
$rrd_options .= " CDEF:tempwarm=temp,".$temperature['temp_limit'].",GT,temp,UNKN,IF";
$rrd_options .= " CDEF:tempcold=temp,20,LT,temp,UNKN,IF";
$rrd_options .= " AREA:temp#FFFF99";
$rrd_options .= " AREA:tempwarm#FF9999";
$rrd_options .= " AREA:tempcold#CCCCFF";
$rrd_options .= " LINE1.5:temp#cc0000:'" . quotemeta($temperature[temp_descr_fixed]."'");
$rrd_options .= " LINE1.5:temp#cc0000:'" . str_replace(':','\:',quotemeta($temperature['temp_descr_fixed'])."'");
$rrd_options .= " LINE1.5:tempwarm#660000";
$rrd_options .= " GPRINT:temp:LAST:%3.0lfC";
$rrd_options .= " GPRINT:temp:MAX:%3.0lfC\\\\l";