fix: Send zero for fields without values for graphite (#7176)

Fixes #7166
This commit is contained in:
Filippo Giunchedi
2017-08-17 12:20:04 -04:00
committed by Neil Lathwood
parent 0d384b8949
commit 7cf00eb1ce

View File

@@ -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);