]> git.ipfire.org Git - oddments/collecty.git/commitdiff
processors: Add line with total usage
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 24 Sep 2020 11:12:46 +0000 (11:12 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 24 Sep 2020 11:12:46 +0000 (11:12 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/collecty/plugins/processor.py

index 6a4aec2af346769262c96baee4be2029d4997bc7..5eeb93c0f1207abc35d78c17a9bb78b9f28ed6bd 100644 (file)
@@ -33,7 +33,11 @@ class GraphTemplateProcessor(base.GraphTemplate):
                _ = self.locale.translate
 
                return [
-                       "CDEF:total=user,nice,+,sys,+,wait,+,irq,+,sirq,+,steal,+,guest,+,guest_nice,+,idle,+",
+                       # Add all used CPU cycles
+                       "CDEF:usage=user,nice,+,sys,+,wait,+,irq,+,sirq,+,steal,+,guest,+,guest_nice,+",
+
+                       # Add idle to get the total number of cycles
+                       "CDEF:total=usage,idle,+",
 
                        "CDEF:user_p=100,user,*,total,/",
                        "AREA:user_p%s:%-15s" % (CPU_USER, _("User")),
@@ -89,6 +93,12 @@ class GraphTemplateProcessor(base.GraphTemplate):
                        "GPRINT:guest_nice_p_min:%12s\:" % _("Minimum") + " %6.2lf%%",
                        "GPRINT:guest_nice_p_avg:%12s\:" % _("Average") + " %6.2lf%%\\n",
 
+                       "CDEF:usage_p=100,usage,*,total,/",
+                       "COMMENT:  %-15s" % _("Usage"),
+                       "GPRINT:usage_p_max:%12s\:" % _("Maximum") + " %6.2lf%%",
+                       "GPRINT:usage_p_min:%12s\:" % _("Minimum") + " %6.2lf%%",
+                       "GPRINT:usage_p_avg:%12s\:" % _("Average") + " %6.2lf%%\\n",
+
                        "CDEF:idle_p=100,idle,*,total,/",
                        "STACK:idle_p%s:%-15s" % (CPU_IDLE, _("Idle")),
                        "GPRINT:idle_p_max:%12s\:" % _("Maximum") + " %6.2lf%%",