diff --git a/html/includes/graphs/bgp_updates.inc.php b/html/includes/graphs/bgp_updates.inc.php
index d05da8613..f4f682c6e 100644
--- a/html/includes/graphs/bgp_updates.inc.php
+++ b/html/includes/graphs/bgp_updates.inc.php
@@ -4,7 +4,7 @@ $scale_min = "0";
$data = mysql_fetch_array(mysql_query("SELECT * FROM bgpPeers AS B, devices AS D WHERE bgpPeer_id = '".$_GET['peer']."' AND D.device_id = B.device_id"));
-$rrd_filename = $config['rrd_dir'] . "/" . $data['hostname'] . "/bgp-" . $data['bgpPeerIdentifier'] . ".rrd";
+$rrd_filename = $config['rrd_dir'] . "/" . $data['hostname'] . "/" . safename("bgp-" . $data['bgpPeerIdentifier'] . ".rrd");
$rra_in = "bgpPeerInUpdates";
$rra_out = "bgpPeerOutUpdates";
diff --git a/html/includes/graphs/cbgp_prefixes.inc.php b/html/includes/graphs/cbgp_prefixes.inc.php
index f65b60e0f..2a0f5f17e 100644
--- a/html/includes/graphs/cbgp_prefixes.inc.php
+++ b/html/includes/graphs/cbgp_prefixes.inc.php
@@ -6,7 +6,7 @@ $scale_min = "0";
$data = mysql_fetch_array(mysql_query("SELECT * FROM bgpPeers AS B, devices AS D WHERE bgpPeer_id = '".$_GET['peer']."' AND D.device_id = B.device_id"));
-$rrd_filename = $config['rrd_dir'] . "/" . $data['hostname'] . "/cbgp-" . $data['bgpPeerIdentifier'] . ".".$_GET['afi'].".".$_GET['safi'].".rrd";
+$rrd_filename = $config['rrd_dir'] . "/" . $data['hostname'] . "/". safename("cbgp-" . $data['bgpPeerIdentifier'] . ".".$_GET['afi'].".".$_GET['safi'].".rrd");
$rra = "AcceptedPrefixes";
diff --git a/html/includes/graphs/cempMemPool.inc.php b/html/includes/graphs/cempMemPool.inc.php
index d7fe2a352..a610125f0 100644
--- a/html/includes/graphs/cempMemPool.inc.php
+++ b/html/includes/graphs/cempMemPool.inc.php
@@ -20,7 +20,7 @@ include("common.inc.php");
$mempool['descr_fixed'] = str_pad($mempool['descr_fixed'], 28);
$mempool['descr_fixed'] = substr($mempool['descr_fixed'],0,28);
$oid = $mempool['entPhysicalIndex'] . "." . $mempool['Index'];
- $rrd = $config['rrd_dir'] . "/".$mempool['hostname']."/cempMemPool-$oid.rrd";
+ $rrd = $config['rrd_dir'] . "/".$mempool['hostname']."/" . safename("cempMemPool-$oid.rrd");
$id = $mempool['entPhysicalIndex'] . "-" . $mempool['Index'];
$rrd_options .= " DEF:mempool" . $id . "free=$rrd:free:AVERAGE ";
$rrd_options .= " DEF:mempool" . $id . "used=$rrd:used:AVERAGE ";
diff --git a/html/includes/graphs/cisco_entity_sensor.inc.php b/html/includes/graphs/cisco_entity_sensor.inc.php
index 2e226ebb1..2dd83ba5d 100644
--- a/html/includes/graphs/cisco_entity_sensor.inc.php
+++ b/html/includes/graphs/cisco_entity_sensor.inc.php
@@ -13,7 +13,7 @@ case 'amperes':
include("common.inc.php");
-$rrd_filename = $config['rrd_dir'] . "/" . $sensor['hostname'] . "/ces-" . $sensor['entPhysicalIndex'] . ".rrd";
+$rrd_filename = $config['rrd_dir'] . "/" . $sensor['hostname'] . "/" . safename("ces-" . $sensor['entPhysicalIndex'] . ".rrd");
$type = str_pad($sensor['entSensorType'], 8);
$type = substr($type,0,8);
diff --git a/html/includes/graphs/cmpMemPool.inc.php b/html/includes/graphs/cmpMemPool.inc.php
index c9089ae7b..07b9e4d90 100755
--- a/html/includes/graphs/cmpMemPool.inc.php
+++ b/html/includes/graphs/cmpMemPool.inc.php
@@ -15,7 +15,7 @@ include("common.inc.php");
$mempool['descr_fixed'] = str_pad($mempool['descr_fixed'], 28);
$mempool['descr_fixed'] = substr($mempool['descr_fixed'],0,28);
$oid = $mempool['Index'];
- $rrd = $config['rrd_dir'] . "/".$mempool['hostname']."/cmp-$oid.rrd";
+ $rrd = $config['rrd_dir'] . "/".$mempool['hostname']."/" . safename("cmp-$oid.rrd");
$rrd_options .= " DEF:mempool" . $oid . "free=$rrd:free:AVERAGE ";
$rrd_options .= " DEF:mempool" . $oid . "used=$rrd:used:AVERAGE ";
$rrd_options .= " CDEF:mempool" . $oid . "total=mempool" . $oid . "used,mempool" . $oid . "used,mempool" . $oid . "free,+,/,100,* ";
diff --git a/html/includes/graphs/cpmCPU.inc.php b/html/includes/graphs/cpmCPU.inc.php
index 4ffea134c..1b552d566 100644
--- a/html/includes/graphs/cpmCPU.inc.php
+++ b/html/includes/graphs/cpmCPU.inc.php
@@ -15,7 +15,7 @@ include("common.inc.php");
} elseif($iter=="7") {$colour="FF0084"; unset($iter); }
$proc['descr_fixed'] = str_pad($proc['entPhysicalDescr'], 28);
$proc['descr_fixed'] = substr($proc['descr_fixed'],0,28);
- $rrd = $config['rrd_dir'] . "/".$proc['hostname']."/cpmCPU-" . $proc['cpmCPU_oid'] . ".rrd";
+ $rrd = $config['rrd_dir'] . "/".$proc['hostname']."/" . safename("cpmCPU-" . $proc['cpmCPU_oid'] . ".rrd");
$rrd_options .= " DEF:proc" . $proc['cpmCPU_oid'] . "=$rrd:usage:AVERAGE ";
$rrd_options .= " LINE1:proc" . $proc['cpmCPU_oid'] . "#" . $colour . ":'" . $proc['descr_fixed'] . "' ";
$rrd_options .= " GPRINT:proc" . $proc['cpmCPU_oid'] . ":LAST:%3.0lf";
diff --git a/html/includes/graphs/customer_bits.inc.php b/html/includes/graphs/customer_bits.inc.php
index 18a0cc7ac..517529f69 100644
--- a/html/includes/graphs/customer_bits.inc.php
+++ b/html/includes/graphs/customer_bits.inc.php
@@ -4,8 +4,8 @@
$query = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE `ifAlias` LIKE 'Cust: ".mres($_GET['cust'])."%' AND D.device_id = I.device_id");
while($int = mysql_fetch_array($query)) {
- if(is_file($config['rrd_dir'] . "/" . $int['hostname'] . "/" . $int['ifIndex'] . ".rrd")) {
- $rrd_filenames[] = $config['rrd_dir'] . "/" . $int['hostname'] . "/" . $int['ifIndex'] . ".rrd";
+ if(is_file($config['rrd_dir'] . "/" . $int['hostname'] . "/" . safename($int['ifIndex'] . ".rrd"))) {
+ $rrd_filenames[] = $config['rrd_dir'] . "/" . $int['hostname'] . "/" . safename($int['ifIndex'] . ".rrd");
}
}
diff --git a/html/includes/graphs/device_bits.inc.php b/html/includes/graphs/device_bits.inc.php
index 3bf34bbf3..51dbaf2a8 100644
--- a/html/includes/graphs/device_bits.inc.php
+++ b/html/includes/graphs/device_bits.inc.php
@@ -7,8 +7,8 @@ $hostname = gethostbyid($device);
$query = mysql_query("SELECT `ifIndex`,`interface_id` FROM `interfaces` WHERE `device_id` = '$device' AND `ifType` NOT LIKE '%oopback%' AND `ifType` NOT LIKE '%SVI%' AND `ifType` != 'l2vlan'");
while($int = mysql_fetch_row($query)) {
- if(is_file($config['rrd_dir'] . "/" . $hostname . "/" . $int[0] . ".rrd")) {
- $rrd_filenames[] = $config['rrd_dir'] . "/" . $hostname . "/" . $int[0] . ".rrd";
+ if(is_file($config['rrd_dir'] . "/" . $hostname . "/" . safename($int[0] . ".rrd"))) {
+ $rrd_filenames[] = $config['rrd_dir'] . "/" . $hostname . "/" . safename($int[0] . ".rrd");
}
}
diff --git a/html/includes/graphs/device_cpu_ios.inc.php b/html/includes/graphs/device_cpu_ios.inc.php
index 5deeb731d..3e9807231 100644
--- a/html/includes/graphs/device_cpu_ios.inc.php
+++ b/html/includes/graphs/device_cpu_ios.inc.php
@@ -4,7 +4,7 @@ $query = mysql_query("SELECT * FROM `cpmCPU` where `device_id` = '".mres($device
$i=0;
while($proc = mysql_fetch_array($query)) {
- $rrd_filename = $config['rrd_dir'] . "/$hostname/cpmCPU-" . $proc['cpmCPU_oid'] . ".rrd";
+ $rrd_filename = $config['rrd_dir'] . "/$hostname/" . safename("cpmCPU-" . $proc['cpmCPU_oid'] . ".rrd");
if(is_file($rrd_filename)) {
$descr = str_pad($proc['entPhysicalDescr'], 8);
$descr = substr($descr,0,8);
diff --git a/html/includes/graphs/device_cpu_unix.inc.php b/html/includes/graphs/device_cpu_unix.inc.php
index cf5cdbd2d..881026138 100644
--- a/html/includes/graphs/device_cpu_unix.inc.php
+++ b/html/includes/graphs/device_cpu_unix.inc.php
@@ -5,7 +5,7 @@ $query = mysql_query("SELECT * FROM `hrDevice` where `device_id` = '".mres($devi
$i=0;
while($proc = mysql_fetch_array($query)) {
- $rrd_filename = $config['rrd_dir'] . "/$hostname/hrProcessor-" . $proc['hrDeviceIndex'] . ".rrd";
+ $rrd_filename = $config['rrd_dir'] . "/$hostname/" . safename("hrProcessor-" . $proc['hrDeviceIndex'] . ".rrd");
if(is_file($rrd_filename)) {
diff --git a/html/includes/graphs/device_cpu_windows.inc.php b/html/includes/graphs/device_cpu_windows.inc.php
index b400b1aad..baf3c0602 100644
--- a/html/includes/graphs/device_cpu_windows.inc.php
+++ b/html/includes/graphs/device_cpu_windows.inc.php
@@ -5,7 +5,7 @@ $query = mysql_query("SELECT * FROM `hrDevice` where `device_id` = '".mres($devi
$i=0;
while($proc = mysql_fetch_array($query)) {
- $rrd_filename = $config['rrd_dir'] . "/$hostname/hrProcessor-" . $proc['hrDeviceIndex'] . ".rrd";
+ $rrd_filename = $config['rrd_dir'] . "/$hostname/" . safename("hrProcessor-" . $proc['hrDeviceIndex'] . ".rrd");
if(is_file($rrd_filename)) {
diff --git a/html/includes/graphs/device_hrstorage.inc.php b/html/includes/graphs/device_hrstorage.inc.php
index 4d7f7ad2a..679934def 100644
--- a/html/includes/graphs/device_hrstorage.inc.php
+++ b/html/includes/graphs/device_hrstorage.inc.php
@@ -14,7 +14,7 @@ include("common.inc.php");
} elseif($iter=="7") {$colour="FF0084"; $iter = "0"; }
$descr = substr(str_pad($fs[hrStorageDescr], 12),0,12);
$descr = str_replace(":","\:",$descr);
- $rrd = $config['rrd_dir'] . "/$hostname/hrStorage-".$fs['hrStorageIndex'].".rrd";
+ $rrd = $config['rrd_dir'] . "/$hostname/" . safename("hrStorage-".$fs['hrStorageIndex'].".rrd");
$rrd_options .= " DEF:$fs[storage_id]=$rrd:used:AVERAGE";
$rrd_options .= " DEF:$fs[storage_id]s=$rrd:size:AVERAGE";
$rrd_options .= " DEF:$fs[storage_id]p=$rrd:perc:AVERAGE";
diff --git a/html/includes/graphs/device_memory_ios.inc.php b/html/includes/graphs/device_memory_ios.inc.php
index e17439467..e55aa0527 100644
--- a/html/includes/graphs/device_memory_ios.inc.php
+++ b/html/includes/graphs/device_memory_ios.inc.php
@@ -21,7 +21,7 @@ if(mysql_result(mysql_query("SELECT COUNT(*) FROM `cempMemPool` WHERE `device_id
$mempool['descr_fixed'] = str_pad($mempool['descr_fixed'], 20);
$mempool['descr_fixed'] = substr($mempool['descr_fixed'],0,20);
$oid = $mempool['entPhysicalIndex'] . "." . $mempool['Index'];
- $rrd = $config['rrd_dir'] . "/$hostname/cempMemPool-$oid.rrd";
+ $rrd = $config['rrd_dir'] . "/$hostname/" . safename("cempMemPool-$oid.rrd");
$rrd_options .= " DEF:mempool" . $iter . "free=$rrd:free:AVERAGE";
$rrd_options .= " DEF:mempool" . $iter . "used=$rrd:used:AVERAGE";
$rrd_options .= " DEF:mempool" . $iter . "free_m=$rrd:free:MAX";
@@ -46,7 +46,7 @@ if(mysql_result(mysql_query("SELECT COUNT(*) FROM `cempMemPool` WHERE `device_id
$mempool['descr_fixed'] = str_pad($mempool['descr_fixed'], 20);
$mempool['descr_fixed'] = substr($mempool['descr_fixed'],0,20);
$oid = $mempool['Index'];
- $rrd = $config['rrd_dir'] . "/$hostname/cmp-$oid.rrd";
+ $rrd = $config['rrd_dir'] . "/$hostname/" . safename("cmp-$oid.rrd");
$rrd_options .= " DEF:mempool" . $iter . "free=$rrd:free:AVERAGE";
$rrd_options .= " DEF:mempool" . $iter . "used=$rrd:used:AVERAGE";
$rrd_options .= " DEF:mempool" . $iter . "free_m=$rrd:free:MAX";
diff --git a/html/includes/graphs/device_temperatures.inc.php b/html/includes/graphs/device_temperatures.inc.php
index c84fd3e7e..10587e8ac 100644
--- a/html/includes/graphs/device_temperatures.inc.php
+++ b/html/includes/graphs/device_temperatures.inc.php
@@ -13,7 +13,7 @@ while($temperature = mysql_fetch_array($sql)) {
} elseif($iter=="7") {$colour="FF0084"; unset($iter); }
$temperature['temp_descr_fixed'] = str_pad($temperature['temp_descr'], 22);
$temperature['temp_descr_fixed'] = substr($temperature['temp_descr_fixed'],0,22);
- $temprrd = addslashes($config['rrd_dir'] . "/$hostname/temp-" . str_replace("/", "_", str_replace(" ", "_",$temperature['temp_descr'])) . ".rrd");
+ $temprrd = $config['rrd_dir'] . "/$hostname/".safename("temp-" . $temperature['temp_descr'] . ".rrd");
$temprrd = str_replace(")", "_", $temprrd);
$temprrd = str_replace("(", "_", $temprrd);
$rrd_options .= " DEF:temp" . $temperature[temp_id] . "=$temprrd:temp:AVERAGE ";
diff --git a/html/includes/graphs/hrProcessor.inc.php b/html/includes/graphs/hrProcessor.inc.php
index cfa0c9361..be2c6b10f 100755
--- a/html/includes/graphs/hrProcessor.inc.php
+++ b/html/includes/graphs/hrProcessor.inc.php
@@ -15,7 +15,7 @@ include("common.inc.php");
} elseif($iter=="7") {$colour="FF0084"; unset($iter); }
$proc['descr_fixed'] = substr(str_pad(short_hrDeviceDescr($proc['hrDeviceDescr']), 28),0,28);
$proc['descr_fixed'] = str_replace(":", "\:", $proc['descr_fixed']);
- $rrd = $config['rrd_dir'] . "/".$proc['hostname']."/hrProcessor-" . $proc['hrDeviceIndex'] . ".rrd";
+ $rrd = $config['rrd_dir'] . "/".$proc['hostname']."/" . safename("hrProcessor-" . $proc['hrDeviceIndex'] . ".rrd");
$rrd_options .= " DEF:proc" . $proc['hrDeviceIndex'] . "=$rrd:usage:AVERAGE ";
$rrd_options .= " LINE1:proc" . $proc['hrDeviceIndex'] . "#" . $colour . ":'" . $proc['descr_fixed'] . "' ";
$rrd_options .= " GPRINT:proc" . $proc['hrDeviceIndex'] . ":LAST:%3.0lf";
diff --git a/html/includes/graphs/hrstorage.inc.php b/html/includes/graphs/hrstorage.inc.php
index 8fe22ffe9..32010ef99 100644
--- a/html/includes/graphs/hrstorage.inc.php
+++ b/html/includes/graphs/hrstorage.inc.php
@@ -16,7 +16,7 @@ $rrd_options .= " -b 1024";
} elseif($iter=="7") {$colour="FF0084"; $iter = "0"; }
$descr = substr(str_pad($fs[hrStorageDescr], 12),0,12);
$descr = str_replace(":","\:",$descr);
- $rrd = $config['rrd_dir'] . "/$hostname/hrStorage-".$fs['hrStorageIndex'].".rrd";
+ $rrd = $config['rrd_dir'] . "/$hostname/" . safename("hrStorage-".$fs['hrStorageIndex'].".rrd");
$rrd_options .= " DEF:$fs[storage_id]=$rrd:used:AVERAGE";
$rrd_options .= " DEF:$fs[storage_id]s=$rrd:size:AVERAGE";
$rrd_options .= " DEF:$fs[storage_id]p=$rrd:perc:AVERAGE";
diff --git a/html/includes/graphs/mac_acc_bits.inc.php b/html/includes/graphs/mac_acc_bits.inc.php
index f6050bfde..7582bd093 100644
--- a/html/includes/graphs/mac_acc_bits.inc.php
+++ b/html/includes/graphs/mac_acc_bits.inc.php
@@ -4,8 +4,8 @@ $query = mysql_query("SELECT * FROM `mac_accounting` AS M, `interfaces` AS I, `d
AND I.interface_id = M.interface_id AND I.device_id = D.device_id");
$acc = mysql_fetch_array($query);
-if(is_file($config['rrd_dir'] . "/" . $acc['hostname'] . "/cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd")) {
- $rrd_filename = $config['rrd_dir'] . "/" . $acc['hostname'] . "/cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
+if(is_file($config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd"))) {
+ $rrd_filename = $config['rrd_dir'] . "/" . $acc['hostname'] . "/". safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");
}
$rra_in = "IN";
diff --git a/html/includes/graphs/mac_acc_pkts.inc.php b/html/includes/graphs/mac_acc_pkts.inc.php
index 2dea00dbd..62f1b994d 100644
--- a/html/includes/graphs/mac_acc_pkts.inc.php
+++ b/html/includes/graphs/mac_acc_pkts.inc.php
@@ -4,8 +4,8 @@ $query = mysql_query("SELECT * FROM `mac_accounting` AS M, `interfaces` AS I, `d
AND I.interface_id = M.interface_id AND I.device_id = D.device_id");
$acc = mysql_fetch_array($query);
-if(is_file($config['rrd_dir'] . "/" . $acc['hostname'] . "/cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd")) {
- $rrd_filename = $config['rrd_dir'] . "/" . $acc['hostname'] . "/cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
+if(is_file($config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd"))) {
+ $rrd_filename = $config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");
}
$rra_in = "PIN";
diff --git a/html/includes/graphs/mac_acc_total.inc.php b/html/includes/graphs/mac_acc_total.inc.php
index 7a3ae49b7..32ac6a65c 100644
--- a/html/includes/graphs/mac_acc_total.inc.php
+++ b/html/includes/graphs/mac_acc_total.inc.php
@@ -40,7 +40,7 @@ if(is_numeric($_GET['topn'])) { $topn = $_GET['topn']; } else { $topn = '10'; }
$pluses = ""; $iter = '0';
$rrd_options .= " COMMENT:' In\: Current Maximum Total Out\: Current Maximum Total\\\\n'";
while($acc = mysql_fetch_array($query)) {
- $this_rrd = $config['rrd_dir'] . "/" . $acc['hostname'] . "/cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
+ $this_rrd = $config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");
if(is_file($this_rrd)) {
$name = $acc['mac'];
$addy = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."' AND interface_id = '".$acc['interface_id']."'"));
diff --git a/html/includes/graphs/multi_bits.inc.php b/html/includes/graphs/multi_bits.inc.php
index 829bb43c4..77b2fd612 100644
--- a/html/includes/graphs/multi_bits.inc.php
+++ b/html/includes/graphs/multi_bits.inc.php
@@ -8,8 +8,8 @@ $i = 1;
foreach(explode(",", $interfaces) as $ifid) {
$query = mysql_query("SELECT `ifIndex`, `hostname` FROM `interfaces` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id");
$int = mysql_fetch_row($query);
- if(is_file($config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd")) {
- $rrd_filenames[] = $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd";
+ if(is_file($config['rrd_dir'] . "/" . $int[1] . "/" . safename($int[0] . ".rrd"))) {
+ $rrd_filenames[] = $config['rrd_dir'] . "/" . $int[1] . "/" . safename($int[0] . ".rrd");
$i++;
}
}
diff --git a/html/includes/graphs/multi_bits_separate.inc.php b/html/includes/graphs/multi_bits_separate.inc.php
index e21fd5f2f..be7c077f9 100644
--- a/html/includes/graphs/multi_bits_separate.inc.php
+++ b/html/includes/graphs/multi_bits_separate.inc.php
@@ -13,7 +13,7 @@ function graph_multi_bits ($args) {
foreach(explode(",", $args['interfaces']) as $ifid) {
$query = mysql_query("SELECT * FROM `interfaces` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id");
$int = mysql_fetch_array($query);
- $this_rrd = $config['rrd_dir'] . "/" . $int['hostname'] . "/" . $int['ifIndex'] . ".rrd";
+ $this_rrd = $config['rrd_dir'] . "/" . $int['hostname'] . "/" . safename($int['ifIndex'] . ".rrd");
$units='bps'; $unit='B'; $colours='greens'; $multiplier = "8"; $coloursb = 'blues';
if(is_file($this_rrd)) {
$name = $int['ifDescr'];
diff --git a/html/includes/graphs/pagp_bits.inc.php b/html/includes/graphs/pagp_bits.inc.php
index 489a7d7e2..468011ab9 100644
--- a/html/includes/graphs/pagp_bits.inc.php
+++ b/html/includes/graphs/pagp_bits.inc.php
@@ -8,8 +8,8 @@ $query = mysql_query("SELECT * FROM `interfaces` WHERE `device_id` = '".$parent[
$i=0;
while($int = mysql_fetch_array($query)) {
- if(is_file($config['rrd_dir'] . "/" . $hostname . "/" . $int['ifIndex'] . ".rrd")) {
- $rrd_list[$i]['filename'] = $config['rrd_dir'] . "/" . $hostname . "/" . $int['ifIndex'] . ".rrd";
+ if(is_file($config['rrd_dir'] . "/" . $hostname . "/" . safename($int['ifIndex'] . ".rrd"))) {
+ $rrd_list[$i]['filename'] = $config['rrd_dir'] . "/" . $hostname . "/" . safename($int['ifIndex'] . ".rrd");
$rrd_list[$i]['descr'] = $int['ifDescr'];
$i++;
}
diff --git a/html/includes/graphs/port_bits.inc.php b/html/includes/graphs/port_bits.inc.php
index e664c5cce..c8a545d4e 100644
--- a/html/includes/graphs/port_bits.inc.php
+++ b/html/includes/graphs/port_bits.inc.php
@@ -9,8 +9,8 @@ $query = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.in
AND I.device_id = D.device_id");
$port = mysql_fetch_array($query);
-if(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/" . $port['ifIndex'] . ".rrd")) {
- $rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/" . $port['ifIndex'] . ".rrd";
+if(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd"))) {
+ $rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd");
}
$rra_in = "INOCTETS";
diff --git a/html/includes/graphs/port_errors.inc.php b/html/includes/graphs/port_errors.inc.php
index 02b336bf5..6f6384f63 100644
--- a/html/includes/graphs/port_errors.inc.php
+++ b/html/includes/graphs/port_errors.inc.php
@@ -9,8 +9,8 @@ $query = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.in
AND I.device_id = D.device_id");
$port = mysql_fetch_array($query);
-if(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/" . $port['ifIndex'] . ".rrd")) {
- $rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/" . $port['ifIndex'] . ".rrd";
+if(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd"))) {
+ $rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd");
}
$rra_in = "INERRORS";
diff --git a/html/includes/graphs/port_etherlike.inc.php b/html/includes/graphs/port_etherlike.inc.php
index 18a658608..5445f758d 100644
--- a/html/includes/graphs/port_etherlike.inc.php
+++ b/html/includes/graphs/port_etherlike.inc.php
@@ -12,12 +12,12 @@ $oids = array('dot3StatsAlignmentErrors', 'dot3StatsFCSErrors', 'dot3StatsSingle
'dot3StatsSymbolErrors');
$i=0;
-if(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/etherlike-" . $port['ifIndex'] . ".rrd")) {
+if(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename("etherlike-" . $port['ifIndex'] . ".rrd"))) {
foreach($oids as $oid){
$oid = str_replace("dot3Stats", "", $oid);
$oid_rra = truncate($oid, 19, '');
$rrd_create .= " DS:$oid:COUNTER:600:U:100000000000";
- $rrd_list[$i]['filename'] = $config['rrd_dir'] . "/" . $port['hostname'] . "/etherlike-" . $port['ifIndex'] . ".rrd";
+ $rrd_list[$i]['filename'] = $config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename("etherlike-" . $port['ifIndex'] . ".rrd");
$rrd_list[$i]['descr'] = $oid;
$rrd_list[$i]['rra'] = $oid_rra;
$i++;
diff --git a/html/includes/graphs/port_nupkts.inc.php b/html/includes/graphs/port_nupkts.inc.php
index c22b1079d..7ca77f267 100644
--- a/html/includes/graphs/port_nupkts.inc.php
+++ b/html/includes/graphs/port_nupkts.inc.php
@@ -9,8 +9,8 @@ $query = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.in
AND I.device_id = D.device_id");
$port = mysql_fetch_array($query);
-if(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/" . $port['ifIndex'] . ".rrd")) {
- $rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/" . $port['ifIndex'] . ".rrd";
+if(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd"))) {
+ $rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd");
}
$rra_in = "INNUCASTPKTS";
diff --git a/html/includes/graphs/port_upkts.inc.php b/html/includes/graphs/port_upkts.inc.php
index 0392214aa..c5f7efca6 100644
--- a/html/includes/graphs/port_upkts.inc.php
+++ b/html/includes/graphs/port_upkts.inc.php
@@ -9,8 +9,8 @@ $query = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.in
AND I.device_id = D.device_id");
$port = mysql_fetch_array($query);
-if(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/" . $port['ifIndex'] . ".rrd")) {
- $rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/" . $port['ifIndex'] . ".rrd";
+if(is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd"))) {
+ $rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd");
}
$rra_in = "INUCASTPKTS";
diff --git a/html/includes/graphs/temperature.inc.php b/html/includes/graphs/temperature.inc.php
index 870f52776..b48d8d415 100644
--- a/html/includes/graphs/temperature.inc.php
+++ b/html/includes/graphs/temperature.inc.php
@@ -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";
diff --git a/html/includes/print-interface.inc.php b/html/includes/print-interface.inc.php
index 2c49715e7..b4493833b 100644
--- a/html/includes/print-interface.inc.php
+++ b/html/includes/print-interface.inc.php
@@ -207,7 +207,7 @@ echo("");
echo("");
// If we're showing graphs, generate the graph and print the img tags
- if($graph_type && is_file($config['rrd_dir'] . "/" . $device['hostname'] . "/". $interface['ifIndex'] . ".rrd")) {
+ if($graph_type && is_file($config['rrd_dir'] . "/" . $device['hostname'] . "/". safename($interface['ifIndex'] . ".rrd"))) {
$type = $graph_type;
diff --git a/includes/common.php b/includes/common.php
index 5c1ebc01f..5050ac9ce 100644
--- a/includes/common.php
+++ b/includes/common.php
@@ -74,6 +74,10 @@ function gethostosbyid($id) {
return $result;
}
+function safename($name)
+{
+ return preg_replace('/[^a-zA-Z0-9,._\+\()\-]/', '_', $name);
+}
?>
diff --git a/includes/polling/apachestats.inc.php b/includes/polling/apachestats.inc.php
index a5f800e78..0870d88d6 100755
--- a/includes/polling/apachestats.inc.php
+++ b/includes/polling/apachestats.inc.php
@@ -2,7 +2,7 @@
echo("Collecting Apache statistics...");
- $apacherrd = "rrd/" . $device['hostname'] . "-apache.rrd";
+ $apacherrd = "rrd/" . safename($device['hostname'] . "-apache.rrd");
if(!is_file($apacherrd)) {
$woo= `rrdtool create $apacherrd \
DS:bits:COUNTER:600:U:10000000 \
diff --git a/includes/polling/bgpPeer.inc.php b/includes/polling/bgpPeer.inc.php
index 1ba8acaff..c1d257181 100755
--- a/includes/polling/bgpPeer.inc.php
+++ b/includes/polling/bgpPeer.inc.php
@@ -91,7 +91,7 @@ if ($device['os'] == "junos")
}
}
- $peerrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/bgp-" . $peer['bgpPeerIdentifier'] . ".rrd";
+ $peerrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("bgp-" . $peer['bgpPeerIdentifier'] . ".rrd");
if(!is_file($peerrrd)) {
$woo = shell_exec($config['rrdtool'] . " create $peerrrd \
DS:bgpPeerOutUpdates:COUNTER:600:U:100000000000 \
@@ -153,7 +153,7 @@ if ($device['os'] == "junos")
mysql_query($update);
- $cbgp_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/cbgp-" . $peer['bgpPeerIdentifier'] . ".$afi.$safi.rrd";
+ $cbgp_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("cbgp-" . $peer['bgpPeerIdentifier'] . ".$afi.$safi.rrd");
if(!is_file($cbgp_rrd)) {
$woo = shell_exec($config['rrdtool'] . " create $cbgp_rrd \
DS:AcceptedPrefixes:GAUGE:600:U:100000000000 \
diff --git a/includes/polling/cisco-enhanced-mempool.inc.php b/includes/polling/cisco-enhanced-mempool.inc.php
index f62b869ec..086559cc5 100755
--- a/includes/polling/cisco-enhanced-mempool.inc.php
+++ b/includes/polling/cisco-enhanced-mempool.inc.php
@@ -25,7 +25,7 @@ while($mempool = mysql_fetch_array($pool_data)) {
echo(round(($cempMemPoolUsed/($cempMemPoolFree+$cempMemPoolUsed))*100) . "% ");
- $poolrrd = addslashes($config['rrd_dir'] . "/" . $device['hostname'] . "/cempMemPool-" . $oid . ".rrd");
+ $poolrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("cempMemPool-" . $oid . ".rrd");
if (!is_file($poolrrd)) {
`rrdtool create $poolrrd \
diff --git a/includes/polling/cisco-entity-sensors.inc.php b/includes/polling/cisco-entity-sensors.inc.php
index c29652a22..e38912131 100755
--- a/includes/polling/cisco-entity-sensors.inc.php
+++ b/includes/polling/cisco-entity-sensors.inc.php
@@ -17,7 +17,7 @@ while($sensor = mysql_fetch_array($sensors)) {
list($entSensorValue, $entSensorStatus) = explode("\n", $sensor_data);
- $rrd = addslashes($config['rrd_dir'] . "/" . $device['hostname'] . "/ces-" . $oid . ".rrd");
+ $rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("ces-" . $oid . ".rrd");
if (!is_file($rrd)) {
`rrdtool create $rrd \
diff --git a/includes/polling/cisco-mac-accounting.inc.php b/includes/polling/cisco-mac-accounting.inc.php
index 9bff23bab..bef4d3023 100755
--- a/includes/polling/cisco-mac-accounting.inc.php
+++ b/includes/polling/cisco-mac-accounting.inc.php
@@ -50,7 +50,7 @@ while ($acc = mysql_fetch_array($mac_accounting_query)) {
}
if($debug) {echo("\n" . $acc['hostname']." ".$acc['ifDescr'] . " $mac -> $b_in:$b_out:$p_in:$p_out ");}
- $rrdfile = $host_rrd . "/cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
+ $rrdfile = $host_rrd . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");
if(!is_file($rrdfile)) {
$woo = shell_exec($config['rrdtool'] ." create $rrdfile \
diff --git a/includes/polling/cisco-mempool.inc.php b/includes/polling/cisco-mempool.inc.php
index c59a99389..4780afcb0 100755
--- a/includes/polling/cisco-mempool.inc.php
+++ b/includes/polling/cisco-mempool.inc.php
@@ -20,7 +20,7 @@ while($mempool = mysql_fetch_array($pool_data)) {
echo(round(($cmpUsed/($cmpFree+$cmpUsed))*100) . "% ");
- $poolrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/cmp-" . $mempool['Index'] . ".rrd";
+ $poolrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("cmp-" . $mempool['Index'] . ".rrd");
if (!is_file($poolrrd)) {
shell_exec ($config['rrdtool'] . " create $poolrrd \
diff --git a/includes/polling/cisco-poe.inc.php b/includes/polling/cisco-poe.inc.php
index 17ff5f08a..52c809851 100644
--- a/includes/polling/cisco-poe.inc.php
+++ b/includes/polling/cisco-poe.inc.php
@@ -30,7 +30,7 @@ if($device['os_group'] == "ios") {
echo(" --> " . $port['ifDescr'] . " POE");
/// Update RRDs
- $rrdfile = $host_rrd . "/" . $port['ifIndex'] . ".rrd";
+ $rrdfile = $host_rrd . "/" . safename($port['ifIndex'] . ".rrd");
if(!is_file($rrdfile)) {
$woo = shell_exec($config['rrdtool'] . " create $rrdfile -s 300 \
DS:PortPwrAllocated:GAUGE:600:0:12500000000 \
diff --git a/includes/polling/cisco-processors.inc.php b/includes/polling/cisco-processors.inc.php
index 47adc360e..3984d0a53 100755
--- a/includes/polling/cisco-processors.inc.php
+++ b/includes/polling/cisco-processors.inc.php
@@ -9,7 +9,7 @@ while($processor = mysql_fetch_array($proc_data)) {
echo("Checking CPU " . $processor['entPhysicalDescr'] . "... ");
- $procrrd = addslashes($config['rrd_dir'] . "/" . $device['hostname'] . "/cpmCPU-" . $processor['cpmCPU_oid'] . ".rrd");
+ $procrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("cpmCPU-" . $processor['cpmCPU_oid'] . ".rrd");
if (!is_file($procrrd)) {
`rrdtool create $procrrd \
diff --git a/includes/polling/device-netstats.inc.php b/includes/polling/device-netstats.inc.php
index c77d20018..586c84357 100755
--- a/includes/polling/device-netstats.inc.php
+++ b/includes/polling/device-netstats.inc.php
@@ -35,7 +35,7 @@ if($device[os] != "Snom") {
foreach($protos as $proto) {
unset($snmpstring, $rrdupdate, $snmpdata, $snmpdata_cmd, $rrd_create);
- $rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/netstats-".$proto.".rrd";
+ $rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("netstats-".$proto.".rrd");
$rrd_create = $config['rrdtool'] . " create $rrdfile ";
$rrd_create .= "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 \
diff --git a/includes/polling/hr-mib_processor.inc.php b/includes/polling/hr-mib_processor.inc.php
index 3f7811cae..c42172efc 100755
--- a/includes/polling/hr-mib_processor.inc.php
+++ b/includes/polling/hr-mib_processor.inc.php
@@ -18,7 +18,7 @@ while ($hrDevice = mysql_fetch_array($query)) {
$update_query .= " WHERE hrDevice_id = '".$hrDevice['hrDevice_id']."'";
@mysql_query($update_query); $mysql++; echo(".");
- $procrrd = addslashes($config['rrd_dir'] . "/" . $device['hostname'] . "/hrProcessor-" . $hrDevice['hrDeviceIndex'] . ".rrd");
+ $procrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("hrProcessor-" . $hrDevice['hrDeviceIndex'] . ".rrd");
if (!is_file($procrrd)) {
shell_exec($config['rrdtool'] . " create $procrrd \
diff --git a/includes/polling/hr-mib_storage.inc.php b/includes/polling/hr-mib_storage.inc.php
index f7df40773..b2daf02d0 100755
--- a/includes/polling/hr-mib_storage.inc.php
+++ b/includes/polling/hr-mib_storage.inc.php
@@ -13,8 +13,8 @@ while ($dr = mysql_fetch_array($dq)) {
$used = $used_units * $hrStorageAllocationUnits;
$perc = round($used / $hrStorageSize * 100, 2);
$filedesc = str_replace("\"", "", str_replace("/", "_", $hrStorageDescr));
- $old_storage_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/storage-" . $filedesc . ".rrd";
- $storage_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/hrStorage-" . $hrStorageIndex . ".rrd";
+ $old_storage_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("storage-" . $filedesc . ".rrd");
+ $storage_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("hrStorage-" . $hrStorageIndex . ".rrd");
if(is_file($old_storage_rrd)) { rename($old_storage_rrd,$storage_rrd); }
if (!is_file($storage_rrd)) {
shell_exec($config['rrdtool'] . " create $storage_rrd \
diff --git a/includes/polling/interfaces.inc.php b/includes/polling/interfaces.inc.php
index 105acee74..b7e0b1d1f 100644
--- a/includes/polling/interfaces.inc.php
+++ b/includes/polling/interfaces.inc.php
@@ -61,7 +61,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
if($config[ifname][$device[os]]) { $ifDescr = $ifName; }
- $rrdfile = $host_rrd . "/" . $interface['ifIndex'] . ".rrd";
+ $rrdfile = $host_rrd . "/" . safename($interface['ifIndex'] . ".rrd");
if(!is_file($rrdfile)) {
$woo = shell_exec($config['rrdtool'] . " create $rrdfile \
diff --git a/includes/polling/ipSystemStats.inc.php b/includes/polling/ipSystemStats.inc.php
index cd7f150c3..bf4c7c6c7 100755
--- a/includes/polling/ipSystemStats.inc.php
+++ b/includes/polling/ipSystemStats.inc.php
@@ -23,7 +23,7 @@
unset($snmpstring, $rrdupdate, $snmpdata, $snmpdata_cmd, $rrd_create);
- $rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/ipSystemStats-".$af.".rrd";
+ $rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("ipSystemStats-".$af.".rrd");
$rrd_create = $config['rrdtool'] . " create $rrdfile ";
$rrd_create .= "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797";
diff --git a/includes/polling/port-etherlike.inc.php b/includes/polling/port-etherlike.inc.php
index eaa8547f7..d252a724e 100755
--- a/includes/polling/port-etherlike.inc.php
+++ b/includes/polling/port-etherlike.inc.php
@@ -4,7 +4,7 @@
$this_port = &$array[$device[device_id]][$port[ifIndex]];
- $rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/etherlike-".$port['ifIndex'].".rrd";
+ $rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("etherlike-".$port['ifIndex'].".rrd");
$rrd_create = $config['rrdtool'] . " create $rrdfile ";
$rrd_create .= "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 \
diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php
index 5b8d07a91..a9cc0a9ae 100755
--- a/includes/polling/ports.inc.php
+++ b/includes/polling/ports.inc.php
@@ -107,7 +107,7 @@
}
/// Update RRDs
- $rrdfile = $host_rrd . "/" . $port['ifIndex'] . ".rrd";
+ $rrdfile = $host_rrd . "/" . safename($port['ifIndex'] . ".rrd");
if(!is_file($rrdfile)) {
$woo = shell_exec($config['rrdtool'] . " create $rrdfile -s 300 \
DS:INOCTETS:DERIVE:600:0:12500000000 \
diff --git a/includes/polling/temperatures.inc.php b/includes/polling/temperatures.inc.php
index afd9e2ac4..77acf0d08 100755
--- a/includes/polling/temperatures.inc.php
+++ b/includes/polling/temperatures.inc.php
@@ -20,9 +20,7 @@ while($temperature = mysql_fetch_array($temp_data)) {
if ($temp != 999.9) break; # TME sometimes sends 999.9 when it is right in the middle of an update;
}
- $temprrd = addslashes($config['rrd_dir'] . "/" . $device['hostname'] . "/temp-" . str_replace("/", "_", str_replace(" ", "_",$temperature['temp_descr'])) . ".rrd");
- $temprrd = str_replace(")", "_", $temprrd);
- $temprrd = str_replace("(", "_", $temprrd);
+ $temprrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("temp-" . $temperature['temp_descr'] . ".rrd");
if (!is_file($temprrd)) {
`rrdtool create $temprrd \
@@ -38,6 +36,7 @@ while($temperature = mysql_fetch_array($temp_data)) {
$updatecmd = "rrdtool update $temprrd N:$temp";
+ if ($debug) { echo "$updatecmd\n"; }
shell_exec($updatecmd);
if($temperature['temp_current'] < $temperature['temp_limit'] && $temp >= $temperature['temp_limit']) {