mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: Fixed IPv6 host renaming (#7275)
* Fixed IPv6 host renaming * Added get_rrd_dir() and modified other files to use it where appropriate. * rrd_name() now uses the new function get_rrd_dir(), to make it simpler to modify the escaping in the future. * Wrong function name in rrdstep.php
This commit is contained in:
@@ -300,10 +300,24 @@ function rrd_name($host, $extra, $extension = ".rrd")
|
||||
{
|
||||
global $config;
|
||||
$filename = safename(is_array($extra) ? implode("-", $extra) : $extra);
|
||||
$host = str_replace(':', '_', trim($host, '[]'));
|
||||
return implode("/", array($config['rrd_dir'], $host, $filename.$extension));
|
||||
return implode("/", array(get_rrd_dir($host), $filename.$extension));
|
||||
} // rrd_name
|
||||
|
||||
|
||||
/**
|
||||
* Generates a path based on the hostname (or IP)
|
||||
*
|
||||
* @param string $host Host name
|
||||
* @return string the name of the rrd directory for $host
|
||||
*/
|
||||
function get_rrd_dir($host)
|
||||
{
|
||||
global $config;
|
||||
$host = str_replace(':', '_', trim($host, '[]'));
|
||||
return implode("/", array($config['rrd_dir'], $host));
|
||||
} // rrd_dir
|
||||
|
||||
|
||||
/**
|
||||
* Generates a filename for a proxmox cluster rrd
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user