Updated function and use - generate_smokeping_file

This commit is contained in:
laf 2015-07-12 19:47:50 +01:00
parent 0e45bad173
commit e356d80141
2 changed files with 8 additions and 13 deletions

View File

@ -31,7 +31,7 @@ if($width > "500")
$rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)." RTT Loss SDev RTT\:SDev \l'";
}
$filename_dir = generate_smokeping_dir($device);
$filename_dir = generate_smokeping_file($device);
if($src['hostname'] == $config['own_hostname'])
{
$filename = $filename_dir . $device['hostname'].'.rrd';

View File

@ -751,7 +751,7 @@ function get_smokeping_files($device) {
global $config;
if (isset($config['smokeping']['dir'])) {
$smokeping_files = array();
$smokeping_dir = generate_smokeping_dir($device);
$smokeping_dir = generate_smokeping_file($device);
if ($handle = opendir($smokeping_dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
@ -778,18 +778,13 @@ function get_smokeping_files($device) {
function generate_smokeping_file($device,$file) {
global $config;
if ($config['smokeping']['integration'] === true) {
return $config['smokeping']['dir'] .'/'. $device['type'] .'/'. $file;
$response = $config['smokeping']['dir'] .'/'. $device['type'] .'/';
} else {
return $config['smokeping']['dir'] . $file;
}
}
function generate_smokeping_dir($device) {
global $config;
if ($config['smokeping']['integration'] === true) {
return $config['smokeping']['dir'] .'/'. $device['type'] .'/';
} else {
return $config['smokeping']['dir'];
$response = $config['smokeping']['dir'] . '/';
}
if (!empty($file)) {
$response = $response . $file;
}
return $response;
}