mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: Sanitize metric name before sending via graphite (#7173)
Fixes #7167
This commit is contained in:
committed by
Neil Lathwood
parent
ad6e82b3c7
commit
0d384b8949
@ -36,6 +36,8 @@ function graphite_update($device, $measurement, $tags, $fields)
|
||||
|
||||
foreach ($fields as $k => $v) {
|
||||
$metric = implode(".", array_filter(array($graphite_prefix, $hostname, $measurement, $ms_name, $k)));
|
||||
// Further sanitize the full metric before sending, whitespace isn't allowed
|
||||
$metric = preg_replace('/\s+/', '_', $metric);
|
||||
$line = implode(" ", array($metric, $v, $timestamp));
|
||||
d_echo("Sending $line\n");
|
||||
fwrite($graphite, $line . "\n");
|
||||
|
Reference in New Issue
Block a user