mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
improve smokeping filename detection (see filenames with underscores instead of dots). this is temporary until we "discovery" these rather than look for them on the fly.
git-svn-id: http://www.observium.org/svn/observer/trunk@3005 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -8,10 +8,12 @@
|
|||||||
if (eregi(".rrd", $file)) {
|
if (eregi(".rrd", $file)) {
|
||||||
if (eregi("~", $file)) {
|
if (eregi("~", $file)) {
|
||||||
list($target,$slave) = explode("~", str_replace(".rrd", "", $file));
|
list($target,$slave) = explode("~", str_replace(".rrd", "", $file));
|
||||||
|
$target = str_replace("_", ".", $target);
|
||||||
$smokeping_files['in'][$target][$slave] = $file;
|
$smokeping_files['in'][$target][$slave] = $file;
|
||||||
$smokeping_files['out'][$slave][$target] = $file;
|
$smokeping_files['out'][$slave][$target] = $file;
|
||||||
} else {
|
} else {
|
||||||
$target = str_replace(".rrd", "", $file);
|
$target = str_replace(".rrd", "", $file);
|
||||||
|
$target = str_replace("_", ".", $target);
|
||||||
$smokeping_files['in'][$target][$config['own_hostname']] = $file;
|
$smokeping_files['in'][$target][$config['own_hostname']] = $file;
|
||||||
$smokeping_files['out'][$config['own_hostname']][$target] = $file;
|
$smokeping_files['out'][$config['own_hostname']][$target] = $file;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,8 +34,18 @@ if($width > "500")
|
|||||||
if($src['hostname'] == $config['own_hostname'])
|
if($src['hostname'] == $config['own_hostname'])
|
||||||
{
|
{
|
||||||
$filename = $config['smokeping']['dir'] . $device['hostname'].'.rrd';
|
$filename = $config['smokeping']['dir'] . $device['hostname'].'.rrd';
|
||||||
|
if (!file_exists($filename))
|
||||||
|
{
|
||||||
|
// Try with dots in hostname replaced by underscores
|
||||||
|
$filename = $config['smokeping']['dir'] . str_replace(".", "_", $device['hostname']).'.rrd';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$filename = $config['smokeping']['dir'] . $device['hostname'] .'~'.$src['hostname'].'.rrd';
|
$filename = $config['smokeping']['dir'] . $device['hostname'] .'~'.$src['hostname'].'.rrd';
|
||||||
|
if (!file_exists($filename))
|
||||||
|
{
|
||||||
|
// Try with dots in hostname replaced by underscores
|
||||||
|
$filename = $config['smokeping']['dir'] . str_replace(".", "-", $device['hostname']) .'~'.$src['hostname'].'.rrd';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($config['graph_colours'][$colourset][$iter])) { $iter = 0; }
|
if (!isset($config['graph_colours'][$colourset][$iter])) { $iter = 0; }
|
||||||
|
|||||||
@@ -34,8 +34,18 @@ if($width > "500")
|
|||||||
if($device['hostname'] == $config['own_hostname'])
|
if($device['hostname'] == $config['own_hostname'])
|
||||||
{
|
{
|
||||||
$filename = $config['smokeping']['dir'] . $dest['hostname'].'.rrd';
|
$filename = $config['smokeping']['dir'] . $dest['hostname'].'.rrd';
|
||||||
|
if (!file_exists($filename))
|
||||||
|
{
|
||||||
|
// Try with dots in hostname replaced by underscores
|
||||||
|
$filename = $config['smokeping']['dir'] . str_replace(".", "_", $dest['hostname']).'.rrd';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$filename = $config['smokeping']['dir'] . $dest['hostname'] .'~'.$device['hostname'].'.rrd';
|
$filename = $config['smokeping']['dir'] . $dest['hostname'] .'~'.$device['hostname'].'.rrd';
|
||||||
|
if (!file_exists($filename))
|
||||||
|
{
|
||||||
|
// Try with dots in hostname replaced by underscores
|
||||||
|
$filename = $config['smokeping']['dir'] . str_replace(".", "_", $dest['hostname']) .'~'.$device['hostname'].'.rrd';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($config['graph_colours'][$colourset][$iter])) { $iter = 0; }
|
if (!isset($config['graph_colours'][$colourset][$iter])) { $iter = 0; }
|
||||||
|
|||||||
@@ -123,10 +123,12 @@ if (device_permitted($vars['device']) || $check_device == $vars['device'])
|
|||||||
if (eregi("~", $file))
|
if (eregi("~", $file))
|
||||||
{
|
{
|
||||||
list($target,$slave) = explode("~", str_replace(".rrd", "", $file));
|
list($target,$slave) = explode("~", str_replace(".rrd", "", $file));
|
||||||
|
$target = str_replace("_", ".", $target);
|
||||||
$smokeping_files['in'][$target][$slave] = $file;
|
$smokeping_files['in'][$target][$slave] = $file;
|
||||||
$smokeping_files['out'][$slave][$target] = $file;
|
$smokeping_files['out'][$slave][$target] = $file;
|
||||||
} else {
|
} else {
|
||||||
$target = str_replace(".rrd", "", $file);
|
$target = str_replace(".rrd", "", $file);
|
||||||
|
$target = str_replace("_", ".", $target);
|
||||||
$smokeping_files['in'][$target][$config['own_hostname']] = $file;
|
$smokeping_files['in'][$target][$config['own_hostname']] = $file;
|
||||||
$smokeping_files['out'][$config['own_hostname']][$target] = $file;
|
$smokeping_files['out'][$config['own_hostname']][$target] = $file;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user