mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: Send zero for fields without values for graphite (#7176)
Fixes #7166
This commit is contained in:
committed by
Neil Lathwood
parent
0d384b8949
commit
7cf00eb1ce
@@ -35,6 +35,10 @@ function graphite_update($device, $measurement, $tags, $fields)
|
||||
}
|
||||
|
||||
foreach ($fields as $k => $v) {
|
||||
// Send zero for fields without values
|
||||
if (empty($v)) {
|
||||
$v = 0;
|
||||
}
|
||||
$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);
|
||||
|
Reference in New Issue
Block a user