Updated smokeping to support Rosiaks integration

This commit is contained in:
laf
2015-06-24 11:41:10 +01:00
parent db4a5de847
commit 432fa5cadd
7 changed files with 54 additions and 62 deletions

View File

@@ -747,4 +747,34 @@ function get_graph_subtypes($type)
return $types;
}
?>
function get_smokeping_files($device) {
global $config;
if (isset($config['smokeping']['dir'])) {
$smokeping_files = array();
if ($config['smokeping']['integration'] === true) {
$smokeping_dir = $config['smokeping']['dir'] . "/" . $device['type'];
} else {
$smokeping_dir = $config['smokeping']['dir'];
}
if ($handle = opendir($smokeping_dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (eregi(".rrd", $file)) {
if (eregi("~", $file)) {
list($target,$slave) = explode("~", str_replace(".rrd", "", $file));
$target = str_replace("_", ".", $target);
$smokeping_files['in'][$target][$slave] = $file;
$smokeping_files['out'][$slave][$target] = $file;
} else {
$target = str_replace(".rrd", "", $file);
$target = str_replace("_", ".", $target);
$smokeping_files['in'][$target][$config['own_hostname']] = $file;
$smokeping_files['out'][$config['own_hostname']][$target] = $file;
}
}
}
}
}
}
return $smokeping_files;
}