]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
virt plugin: Submit `ps_cputime' only when data exists
authorPavel Rochnyack <pavel2000@ngs.ru>
Thu, 25 Oct 2018 08:37:20 +0000 (15:37 +0700)
committerPavel Rochnyack <pavel2000@ngs.ru>
Thu, 25 Oct 2018 08:37:26 +0000 (15:37 +0700)
src/virt.c

index 21df2d651a6fb6581a53df7496378611e0e5289f..e7f11fc6049e5305733531a329a2f95363a0a4ef 100644 (file)
@@ -511,8 +511,9 @@ static int get_pcpu_stats(virDomainPtr dom) {
       total_syst_cpu_time = param[i].value.ul;
   }
 
-  submit_derive2("ps_cputime", total_user_cpu_time, total_syst_cpu_time, dom,
-                 NULL);
+  if (total_user_cpu_time > 0 || total_syst_cpu_time > 0)
+    submit_derive2("ps_cputime", total_user_cpu_time, total_syst_cpu_time, dom,
+                   NULL);
 
   virTypedParamsClear(param, nparams);
   sfree(param);