mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00: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"));
|
$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_in = "bgpPeerInUpdates";
|
||||||
$rra_out = "bgpPeerOutUpdates";
|
$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"));
|
$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";
|
$rra = "AcceptedPrefixes";
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ include("common.inc.php");
|
|||||||
$mempool['descr_fixed'] = str_pad($mempool['descr_fixed'], 28);
|
$mempool['descr_fixed'] = str_pad($mempool['descr_fixed'], 28);
|
||||||
$mempool['descr_fixed'] = substr($mempool['descr_fixed'],0,28);
|
$mempool['descr_fixed'] = substr($mempool['descr_fixed'],0,28);
|
||||||
$oid = $mempool['entPhysicalIndex'] . "." . $mempool['Index'];
|
$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'];
|
$id = $mempool['entPhysicalIndex'] . "-" . $mempool['Index'];
|
||||||
$rrd_options .= " DEF:mempool" . $id . "free=$rrd:free:AVERAGE ";
|
$rrd_options .= " DEF:mempool" . $id . "free=$rrd:free:AVERAGE ";
|
||||||
$rrd_options .= " DEF:mempool" . $id . "used=$rrd:used:AVERAGE ";
|
$rrd_options .= " DEF:mempool" . $id . "used=$rrd:used:AVERAGE ";
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ case 'amperes':
|
|||||||
|
|
||||||
include("common.inc.php");
|
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 = str_pad($sensor['entSensorType'], 8);
|
||||||
$type = substr($type,0,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'] = str_pad($mempool['descr_fixed'], 28);
|
||||||
$mempool['descr_fixed'] = substr($mempool['descr_fixed'],0,28);
|
$mempool['descr_fixed'] = substr($mempool['descr_fixed'],0,28);
|
||||||
$oid = $mempool['Index'];
|
$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 . "free=$rrd:free:AVERAGE ";
|
||||||
$rrd_options .= " DEF:mempool" . $oid . "used=$rrd:used: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,* ";
|
$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); }
|
} elseif($iter=="7") {$colour="FF0084"; unset($iter); }
|
||||||
$proc['descr_fixed'] = str_pad($proc['entPhysicalDescr'], 28);
|
$proc['descr_fixed'] = str_pad($proc['entPhysicalDescr'], 28);
|
||||||
$proc['descr_fixed'] = substr($proc['descr_fixed'],0,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 .= " DEF:proc" . $proc['cpmCPU_oid'] . "=$rrd:usage:AVERAGE ";
|
||||||
$rrd_options .= " LINE1:proc" . $proc['cpmCPU_oid'] . "#" . $colour . ":'" . $proc['descr_fixed'] . "' ";
|
$rrd_options .= " LINE1:proc" . $proc['cpmCPU_oid'] . "#" . $colour . ":'" . $proc['descr_fixed'] . "' ";
|
||||||
$rrd_options .= " GPRINT:proc" . $proc['cpmCPU_oid'] . ":LAST:%3.0lf";
|
$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");
|
$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)) {
|
while($int = mysql_fetch_array($query)) {
|
||||||
if(is_file($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'] . "/" . $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'");
|
$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)) {
|
while($int = mysql_fetch_row($query)) {
|
||||||
if(is_file($config['rrd_dir'] . "/" . $hostname . "/" . $int[0] . ".rrd")) {
|
if(is_file($config['rrd_dir'] . "/" . $hostname . "/" . safename($int[0] . ".rrd"))) {
|
||||||
$rrd_filenames[] = $config['rrd_dir'] . "/" . $hostname . "/" . $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;
|
$i=0;
|
||||||
while($proc = mysql_fetch_array($query)) {
|
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)) {
|
if(is_file($rrd_filename)) {
|
||||||
$descr = str_pad($proc['entPhysicalDescr'], 8);
|
$descr = str_pad($proc['entPhysicalDescr'], 8);
|
||||||
$descr = substr($descr,0,8);
|
$descr = substr($descr,0,8);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ $query = mysql_query("SELECT * FROM `hrDevice` where `device_id` = '".mres($devi
|
|||||||
$i=0;
|
$i=0;
|
||||||
while($proc = mysql_fetch_array($query)) {
|
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)) {
|
if(is_file($rrd_filename)) {
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ $query = mysql_query("SELECT * FROM `hrDevice` where `device_id` = '".mres($devi
|
|||||||
$i=0;
|
$i=0;
|
||||||
while($proc = mysql_fetch_array($query)) {
|
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)) {
|
if(is_file($rrd_filename)) {
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ include("common.inc.php");
|
|||||||
} elseif($iter=="7") {$colour="FF0084"; $iter = "0"; }
|
} elseif($iter=="7") {$colour="FF0084"; $iter = "0"; }
|
||||||
$descr = substr(str_pad($fs[hrStorageDescr], 12),0,12);
|
$descr = substr(str_pad($fs[hrStorageDescr], 12),0,12);
|
||||||
$descr = str_replace(":","\:",$descr);
|
$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]=$rrd:used:AVERAGE";
|
||||||
$rrd_options .= " DEF:$fs[storage_id]s=$rrd:size:AVERAGE";
|
$rrd_options .= " DEF:$fs[storage_id]s=$rrd:size:AVERAGE";
|
||||||
$rrd_options .= " DEF:$fs[storage_id]p=$rrd:perc: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'] = str_pad($mempool['descr_fixed'], 20);
|
||||||
$mempool['descr_fixed'] = substr($mempool['descr_fixed'],0,20);
|
$mempool['descr_fixed'] = substr($mempool['descr_fixed'],0,20);
|
||||||
$oid = $mempool['entPhysicalIndex'] . "." . $mempool['Index'];
|
$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 . "free=$rrd:free:AVERAGE";
|
||||||
$rrd_options .= " DEF:mempool" . $iter . "used=$rrd:used:AVERAGE";
|
$rrd_options .= " DEF:mempool" . $iter . "used=$rrd:used:AVERAGE";
|
||||||
$rrd_options .= " DEF:mempool" . $iter . "free_m=$rrd:free:MAX";
|
$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'] = str_pad($mempool['descr_fixed'], 20);
|
||||||
$mempool['descr_fixed'] = substr($mempool['descr_fixed'],0,20);
|
$mempool['descr_fixed'] = substr($mempool['descr_fixed'],0,20);
|
||||||
$oid = $mempool['Index'];
|
$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 . "free=$rrd:free:AVERAGE";
|
||||||
$rrd_options .= " DEF:mempool" . $iter . "used=$rrd:used:AVERAGE";
|
$rrd_options .= " DEF:mempool" . $iter . "used=$rrd:used:AVERAGE";
|
||||||
$rrd_options .= " DEF:mempool" . $iter . "free_m=$rrd:free:MAX";
|
$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); }
|
} elseif($iter=="7") {$colour="FF0084"; unset($iter); }
|
||||||
$temperature['temp_descr_fixed'] = str_pad($temperature['temp_descr'], 22);
|
$temperature['temp_descr_fixed'] = str_pad($temperature['temp_descr'], 22);
|
||||||
$temperature['temp_descr_fixed'] = substr($temperature['temp_descr_fixed'],0,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);
|
||||||
$temprrd = str_replace("(", "_", $temprrd);
|
$temprrd = str_replace("(", "_", $temprrd);
|
||||||
$rrd_options .= " DEF:temp" . $temperature[temp_id] . "=$temprrd:temp:AVERAGE ";
|
$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); }
|
} elseif($iter=="7") {$colour="FF0084"; unset($iter); }
|
||||||
$proc['descr_fixed'] = substr(str_pad(short_hrDeviceDescr($proc['hrDeviceDescr']), 28),0,28);
|
$proc['descr_fixed'] = substr(str_pad(short_hrDeviceDescr($proc['hrDeviceDescr']), 28),0,28);
|
||||||
$proc['descr_fixed'] = str_replace(":", "\:", $proc['descr_fixed']);
|
$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 .= " DEF:proc" . $proc['hrDeviceIndex'] . "=$rrd:usage:AVERAGE ";
|
||||||
$rrd_options .= " LINE1:proc" . $proc['hrDeviceIndex'] . "#" . $colour . ":'" . $proc['descr_fixed'] . "' ";
|
$rrd_options .= " LINE1:proc" . $proc['hrDeviceIndex'] . "#" . $colour . ":'" . $proc['descr_fixed'] . "' ";
|
||||||
$rrd_options .= " GPRINT:proc" . $proc['hrDeviceIndex'] . ":LAST:%3.0lf";
|
$rrd_options .= " GPRINT:proc" . $proc['hrDeviceIndex'] . ":LAST:%3.0lf";
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ $rrd_options .= " -b 1024";
|
|||||||
} elseif($iter=="7") {$colour="FF0084"; $iter = "0"; }
|
} elseif($iter=="7") {$colour="FF0084"; $iter = "0"; }
|
||||||
$descr = substr(str_pad($fs[hrStorageDescr], 12),0,12);
|
$descr = substr(str_pad($fs[hrStorageDescr], 12),0,12);
|
||||||
$descr = str_replace(":","\:",$descr);
|
$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]=$rrd:used:AVERAGE";
|
||||||
$rrd_options .= " DEF:$fs[storage_id]s=$rrd:size:AVERAGE";
|
$rrd_options .= " DEF:$fs[storage_id]s=$rrd:size:AVERAGE";
|
||||||
$rrd_options .= " DEF:$fs[storage_id]p=$rrd:perc: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");
|
AND I.interface_id = M.interface_id AND I.device_id = D.device_id");
|
||||||
|
|
||||||
$acc = mysql_fetch_array($query);
|
$acc = mysql_fetch_array($query);
|
||||||
if(is_file($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'] . "/cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
|
$rrd_filename = $config['rrd_dir'] . "/" . $acc['hostname'] . "/". safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");
|
||||||
}
|
}
|
||||||
|
|
||||||
$rra_in = "IN";
|
$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");
|
AND I.interface_id = M.interface_id AND I.device_id = D.device_id");
|
||||||
|
|
||||||
$acc = mysql_fetch_array($query);
|
$acc = mysql_fetch_array($query);
|
||||||
if(is_file($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'] . "/cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
|
$rrd_filename = $config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");
|
||||||
}
|
}
|
||||||
|
|
||||||
$rra_in = "PIN";
|
$rra_in = "PIN";
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ if(is_numeric($_GET['topn'])) { $topn = $_GET['topn']; } else { $topn = '10'; }
|
|||||||
$pluses = ""; $iter = '0';
|
$pluses = ""; $iter = '0';
|
||||||
$rrd_options .= " COMMENT:' In\: Current Maximum Total Out\: Current Maximum Total\\\\n'";
|
$rrd_options .= " COMMENT:' In\: Current Maximum Total Out\: Current Maximum Total\\\\n'";
|
||||||
while($acc = mysql_fetch_array($query)) {
|
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)) {
|
if(is_file($this_rrd)) {
|
||||||
$name = $acc['mac'];
|
$name = $acc['mac'];
|
||||||
$addy = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."' AND interface_id = '".$acc['interface_id']."'"));
|
$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) {
|
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");
|
$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);
|
$int = mysql_fetch_row($query);
|
||||||
if(is_file($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] . "/" . $int[0] . ".rrd";
|
$rrd_filenames[] = $config['rrd_dir'] . "/" . $int[1] . "/" . safename($int[0] . ".rrd");
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ function graph_multi_bits ($args) {
|
|||||||
foreach(explode(",", $args['interfaces']) as $ifid) {
|
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");
|
$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);
|
$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';
|
$units='bps'; $unit='B'; $colours='greens'; $multiplier = "8"; $coloursb = 'blues';
|
||||||
if(is_file($this_rrd)) {
|
if(is_file($this_rrd)) {
|
||||||
$name = $int['ifDescr'];
|
$name = $int['ifDescr'];
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ $query = mysql_query("SELECT * FROM `interfaces` WHERE `device_id` = '".$parent[
|
|||||||
|
|
||||||
$i=0;
|
$i=0;
|
||||||
while($int = mysql_fetch_array($query)) {
|
while($int = mysql_fetch_array($query)) {
|
||||||
if(is_file($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 . "/" . $int['ifIndex'] . ".rrd";
|
$rrd_list[$i]['filename'] = $config['rrd_dir'] . "/" . $hostname . "/" . safename($int['ifIndex'] . ".rrd");
|
||||||
$rrd_list[$i]['descr'] = $int['ifDescr'];
|
$rrd_list[$i]['descr'] = $int['ifDescr'];
|
||||||
$i++;
|
$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");
|
AND I.device_id = D.device_id");
|
||||||
|
|
||||||
$port = mysql_fetch_array($query);
|
$port = mysql_fetch_array($query);
|
||||||
if(is_file($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'] . "/" . $port['ifIndex'] . ".rrd";
|
$rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd");
|
||||||
}
|
}
|
||||||
|
|
||||||
$rra_in = "INOCTETS";
|
$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");
|
AND I.device_id = D.device_id");
|
||||||
|
|
||||||
$port = mysql_fetch_array($query);
|
$port = mysql_fetch_array($query);
|
||||||
if(is_file($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'] . "/" . $port['ifIndex'] . ".rrd";
|
$rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd");
|
||||||
}
|
}
|
||||||
|
|
||||||
$rra_in = "INERRORS";
|
$rra_in = "INERRORS";
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ $oids = array('dot3StatsAlignmentErrors', 'dot3StatsFCSErrors', 'dot3StatsSingle
|
|||||||
'dot3StatsSymbolErrors');
|
'dot3StatsSymbolErrors');
|
||||||
|
|
||||||
$i=0;
|
$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){
|
foreach($oids as $oid){
|
||||||
$oid = str_replace("dot3Stats", "", $oid);
|
$oid = str_replace("dot3Stats", "", $oid);
|
||||||
$oid_rra = truncate($oid, 19, '');
|
$oid_rra = truncate($oid, 19, '');
|
||||||
$rrd_create .= " DS:$oid:COUNTER:600:U:100000000000";
|
$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]['descr'] = $oid;
|
||||||
$rrd_list[$i]['rra'] = $oid_rra;
|
$rrd_list[$i]['rra'] = $oid_rra;
|
||||||
$i++;
|
$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");
|
AND I.device_id = D.device_id");
|
||||||
|
|
||||||
$port = mysql_fetch_array($query);
|
$port = mysql_fetch_array($query);
|
||||||
if(is_file($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'] . "/" . $port['ifIndex'] . ".rrd";
|
$rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd");
|
||||||
}
|
}
|
||||||
|
|
||||||
$rra_in = "INNUCASTPKTS";
|
$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");
|
AND I.device_id = D.device_id");
|
||||||
|
|
||||||
$port = mysql_fetch_array($query);
|
$port = mysql_fetch_array($query);
|
||||||
if(is_file($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'] . "/" . $port['ifIndex'] . ".rrd";
|
$rrd_filename = $config['rrd_dir'] . "/" . $port['hostname'] . "/" . safename($port['ifIndex'] . ".rrd");
|
||||||
}
|
}
|
||||||
|
|
||||||
$rra_in = "INUCASTPKTS";
|
$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'] = str_pad($temperature['temp_descr'], 28);
|
||||||
$temperature['temp_descr_fixed'] = substr($temperature['temp_descr_fixed'],0,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."/" . safename("temp-" . $temperature['temp_descr'] . ".rrd");
|
||||||
|
|
||||||
$rrd_filename = $config['rrd_dir'] . "/".$hostname."/temp-" . $filename . ".rrd";
|
|
||||||
|
|
||||||
$rrd_options .= " DEF:temp=$rrd_filename:temp:AVERAGE";
|
$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 .= " CDEF:tempcold=temp,20,LT,temp,UNKN,IF";
|
||||||
$rrd_options .= " AREA:temp#FFFF99";
|
$rrd_options .= " AREA:temp#FFFF99";
|
||||||
$rrd_options .= " AREA:tempwarm#FF9999";
|
$rrd_options .= " AREA:tempwarm#FF9999";
|
||||||
$rrd_options .= " AREA:tempcold#CCCCFF";
|
$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 .= " LINE1.5:tempwarm#660000";
|
||||||
$rrd_options .= " GPRINT:temp:LAST:%3.0lfC";
|
$rrd_options .= " GPRINT:temp:LAST:%3.0lfC";
|
||||||
$rrd_options .= " GPRINT:temp:MAX:%3.0lfC\\\\l";
|
$rrd_options .= " GPRINT:temp:MAX:%3.0lfC\\\\l";
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ echo("</td>");
|
|||||||
echo("</td></tr>");
|
echo("</td></tr>");
|
||||||
|
|
||||||
// If we're showing graphs, generate the graph and print the img tags
|
// 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;
|
$type = $graph_type;
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,10 @@ function gethostosbyid($id) {
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function safename($name)
|
||||||
|
{
|
||||||
|
return preg_replace('/[^a-zA-Z0-9,._\+\()\-]/', '_', $name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
echo("Collecting Apache statistics...");
|
echo("Collecting Apache statistics...");
|
||||||
|
|
||||||
$apacherrd = "rrd/" . $device['hostname'] . "-apache.rrd";
|
$apacherrd = "rrd/" . safename($device['hostname'] . "-apache.rrd");
|
||||||
if(!is_file($apacherrd)) {
|
if(!is_file($apacherrd)) {
|
||||||
$woo= `rrdtool create $apacherrd \
|
$woo= `rrdtool create $apacherrd \
|
||||||
DS:bits:COUNTER:600:U:10000000 \
|
DS:bits:COUNTER:600:U:10000000 \
|
||||||
|
|||||||
@@ -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)) {
|
if(!is_file($peerrrd)) {
|
||||||
$woo = shell_exec($config['rrdtool'] . " create $peerrrd \
|
$woo = shell_exec($config['rrdtool'] . " create $peerrrd \
|
||||||
DS:bgpPeerOutUpdates:COUNTER:600:U:100000000000 \
|
DS:bgpPeerOutUpdates:COUNTER:600:U:100000000000 \
|
||||||
@@ -153,7 +153,7 @@ if ($device['os'] == "junos")
|
|||||||
|
|
||||||
mysql_query($update);
|
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)) {
|
if(!is_file($cbgp_rrd)) {
|
||||||
$woo = shell_exec($config['rrdtool'] . " create $cbgp_rrd \
|
$woo = shell_exec($config['rrdtool'] . " create $cbgp_rrd \
|
||||||
DS:AcceptedPrefixes:GAUGE:600:U:100000000000 \
|
DS:AcceptedPrefixes:GAUGE:600:U:100000000000 \
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ while($mempool = mysql_fetch_array($pool_data)) {
|
|||||||
echo(round(($cempMemPoolUsed/($cempMemPoolFree+$cempMemPoolUsed))*100) . "% ");
|
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)) {
|
if (!is_file($poolrrd)) {
|
||||||
`rrdtool create $poolrrd \
|
`rrdtool create $poolrrd \
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ while($sensor = mysql_fetch_array($sensors)) {
|
|||||||
|
|
||||||
list($entSensorValue, $entSensorStatus) = explode("\n", $sensor_data);
|
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)) {
|
if (!is_file($rrd)) {
|
||||||
`rrdtool create $rrd \
|
`rrdtool create $rrd \
|
||||||
|
|||||||
@@ -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 ");}
|
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)) {
|
if(!is_file($rrdfile)) {
|
||||||
$woo = shell_exec($config['rrdtool'] ." create $rrdfile \
|
$woo = shell_exec($config['rrdtool'] ." create $rrdfile \
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ while($mempool = mysql_fetch_array($pool_data)) {
|
|||||||
|
|
||||||
echo(round(($cmpUsed/($cmpFree+$cmpUsed))*100) . "% ");
|
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)) {
|
if (!is_file($poolrrd)) {
|
||||||
shell_exec ($config['rrdtool'] . " create $poolrrd \
|
shell_exec ($config['rrdtool'] . " create $poolrrd \
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ if($device['os_group'] == "ios") {
|
|||||||
echo(" --> " . $port['ifDescr'] . " POE");
|
echo(" --> " . $port['ifDescr'] . " POE");
|
||||||
|
|
||||||
/// Update RRDs
|
/// Update RRDs
|
||||||
$rrdfile = $host_rrd . "/" . $port['ifIndex'] . ".rrd";
|
$rrdfile = $host_rrd . "/" . safename($port['ifIndex'] . ".rrd");
|
||||||
if(!is_file($rrdfile)) {
|
if(!is_file($rrdfile)) {
|
||||||
$woo = shell_exec($config['rrdtool'] . " create $rrdfile -s 300 \
|
$woo = shell_exec($config['rrdtool'] . " create $rrdfile -s 300 \
|
||||||
DS:PortPwrAllocated:GAUGE:600:0:12500000000 \
|
DS:PortPwrAllocated:GAUGE:600:0:12500000000 \
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ while($processor = mysql_fetch_array($proc_data)) {
|
|||||||
|
|
||||||
echo("Checking CPU " . $processor['entPhysicalDescr'] . "... ");
|
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)) {
|
if (!is_file($procrrd)) {
|
||||||
`rrdtool create $procrrd \
|
`rrdtool create $procrrd \
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ if($device[os] != "Snom") {
|
|||||||
|
|
||||||
foreach($protos as $proto) {
|
foreach($protos as $proto) {
|
||||||
unset($snmpstring, $rrdupdate, $snmpdata, $snmpdata_cmd, $rrd_create);
|
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 = $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 \
|
$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 \
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ while ($hrDevice = mysql_fetch_array($query)) {
|
|||||||
$update_query .= " WHERE hrDevice_id = '".$hrDevice['hrDevice_id']."'";
|
$update_query .= " WHERE hrDevice_id = '".$hrDevice['hrDevice_id']."'";
|
||||||
@mysql_query($update_query); $mysql++; echo(".");
|
@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)) {
|
if (!is_file($procrrd)) {
|
||||||
shell_exec($config['rrdtool'] . " create $procrrd \
|
shell_exec($config['rrdtool'] . " create $procrrd \
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ while ($dr = mysql_fetch_array($dq)) {
|
|||||||
$used = $used_units * $hrStorageAllocationUnits;
|
$used = $used_units * $hrStorageAllocationUnits;
|
||||||
$perc = round($used / $hrStorageSize * 100, 2);
|
$perc = round($used / $hrStorageSize * 100, 2);
|
||||||
$filedesc = str_replace("\"", "", str_replace("/", "_", $hrStorageDescr));
|
$filedesc = str_replace("\"", "", str_replace("/", "_", $hrStorageDescr));
|
||||||
$old_storage_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/storage-" . $filedesc . ".rrd";
|
$old_storage_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("storage-" . $filedesc . ".rrd");
|
||||||
$storage_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/hrStorage-" . $hrStorageIndex . ".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($old_storage_rrd)) { rename($old_storage_rrd,$storage_rrd); }
|
||||||
if (!is_file($storage_rrd)) {
|
if (!is_file($storage_rrd)) {
|
||||||
shell_exec($config['rrdtool'] . " create $storage_rrd \
|
shell_exec($config['rrdtool'] . " create $storage_rrd \
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
|
|||||||
|
|
||||||
if($config[ifname][$device[os]]) { $ifDescr = $ifName; }
|
if($config[ifname][$device[os]]) { $ifDescr = $ifName; }
|
||||||
|
|
||||||
$rrdfile = $host_rrd . "/" . $interface['ifIndex'] . ".rrd";
|
$rrdfile = $host_rrd . "/" . safename($interface['ifIndex'] . ".rrd");
|
||||||
|
|
||||||
if(!is_file($rrdfile)) {
|
if(!is_file($rrdfile)) {
|
||||||
$woo = shell_exec($config['rrdtool'] . " create $rrdfile \
|
$woo = shell_exec($config['rrdtool'] . " create $rrdfile \
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
unset($snmpstring, $rrdupdate, $snmpdata, $snmpdata_cmd, $rrd_create);
|
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 = $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";
|
$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";
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
$this_port = &$array[$device[device_id]][$port[ifIndex]];
|
$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 = $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 \
|
$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 \
|
||||||
|
|||||||
@@ -107,7 +107,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Update RRDs
|
/// Update RRDs
|
||||||
$rrdfile = $host_rrd . "/" . $port['ifIndex'] . ".rrd";
|
$rrdfile = $host_rrd . "/" . safename($port['ifIndex'] . ".rrd");
|
||||||
if(!is_file($rrdfile)) {
|
if(!is_file($rrdfile)) {
|
||||||
$woo = shell_exec($config['rrdtool'] . " create $rrdfile -s 300 \
|
$woo = shell_exec($config['rrdtool'] . " create $rrdfile -s 300 \
|
||||||
DS:INOCTETS:DERIVE:600:0:12500000000 \
|
DS:INOCTETS:DERIVE:600:0:12500000000 \
|
||||||
|
|||||||
@@ -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;
|
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 = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("temp-" . $temperature['temp_descr'] . ".rrd");
|
||||||
$temprrd = str_replace(")", "_", $temprrd);
|
|
||||||
$temprrd = str_replace("(", "_", $temprrd);
|
|
||||||
|
|
||||||
if (!is_file($temprrd)) {
|
if (!is_file($temprrd)) {
|
||||||
`rrdtool create $temprrd \
|
`rrdtool create $temprrd \
|
||||||
@@ -38,6 +36,7 @@ while($temperature = mysql_fetch_array($temp_data)) {
|
|||||||
|
|
||||||
$updatecmd = "rrdtool update $temprrd N:$temp";
|
$updatecmd = "rrdtool update $temprrd N:$temp";
|
||||||
|
|
||||||
|
if ($debug) { echo "$updatecmd\n"; }
|
||||||
shell_exec($updatecmd);
|
shell_exec($updatecmd);
|
||||||
|
|
||||||
if($temperature['temp_current'] < $temperature['temp_limit'] && $temp >= $temperature['temp_limit']) {
|
if($temperature['temp_current'] < $temperature['temp_limit'] && $temp >= $temperature['temp_limit']) {
|
||||||
|
|||||||
Reference in New Issue
Block a user