mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
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:
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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 ";
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,* ";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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 ";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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']."'"));
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'];
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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++;
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -207,7 +207,7 @@ echo("</td>");
|
||||
echo("</td></tr>");
|
||||
|
||||
// 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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user