Code

plugin_dispatch_multivalue: Submit NAN when computing percantage of an empty set.
authorFlorian Forster <octo@collectd.org>
Mon, 5 Sep 2016 13:45:19 +0000 (15:45 +0200)
committerFlorian Forster <octo@collectd.org>
Mon, 5 Sep 2016 13:45:21 +0000 (15:45 +0200)
src/daemon/plugin.c

index 1deabba3dde599a3c203258e1b26200519d6951c..a8e6ca1312a61c92ff352740fe8f0873d287ecb5 100644 (file)
@@ -2273,7 +2273,7 @@ int plugin_dispatch_multivalue (value_list_t const *template, /* {{{ */
                case DS_TYPE_GAUGE:
                        vl->values[0].gauge = va_arg (ap, gauge_t);
                        if (store_percentage)
-                               vl->values[0].gauge *= sum ? (100.0 / sum) : 0;
+                               vl->values[0].gauge *= sum ? (100.0 / sum) : NAN;
                        break;
                case DS_TYPE_ABSOLUTE:
                        vl->values[0].absolute = va_arg (ap, absolute_t);