diff --git a/html/includes/graphs/device/smokeping_common.inc.php b/html/includes/graphs/device/smokeping_common.inc.php index 55d1cfbbf3..c158e8267e 100644 --- a/html/includes/graphs/device/smokeping_common.inc.php +++ b/html/includes/graphs/device/smokeping_common.inc.php @@ -8,10 +8,12 @@ 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; } diff --git a/html/includes/graphs/smokeping/in.inc.php b/html/includes/graphs/smokeping/in.inc.php index 5456fa7c2b..28ee285286 100644 --- a/html/includes/graphs/smokeping/in.inc.php +++ b/html/includes/graphs/smokeping/in.inc.php @@ -34,8 +34,18 @@ if($width > "500") if($src['hostname'] == $config['own_hostname']) { $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 { $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; } diff --git a/html/includes/graphs/smokeping/out.inc.php b/html/includes/graphs/smokeping/out.inc.php index 96147b2241..9165da6c77 100644 --- a/html/includes/graphs/smokeping/out.inc.php +++ b/html/includes/graphs/smokeping/out.inc.php @@ -34,8 +34,18 @@ if($width > "500") if($device['hostname'] == $config['own_hostname']) { $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 { $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; } diff --git a/html/pages/device.inc.php b/html/pages/device.inc.php index 630b003f5c..437fd93787 100644 --- a/html/pages/device.inc.php +++ b/html/pages/device.inc.php @@ -123,10 +123,12 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) 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; }