The snmp and apcups plugins both report timeleft in minutes, but nut
does so in seconds. This makes them consistent.

I note that the maximum value for it is defined as 3600. That's 60
hours, which is 2½ days. Not a particularly round number...?

diff --git a/src/nut.c b/src/nut.c
index edc48c6..104ec93 100644
--- a/src/nut.c
+++ b/src/nut.c
@@ -206,7 +206,11 @@ static int nut_read_one (nut_ups_t *ups)
       else if (strcmp ("battery.current", key) == 0)
        nut_submit (ups, "current", "battery", value);
       else if (strcmp ("battery.runtime", key) == 0)
+      {
+       /* NUT uses seconds but other plugins give it to us in minutes */
+       value /= 60.0;
        nut_submit (ups, "timeleft", "battery", value);
+      }
       else if (strcmp ("battery.temperature", key) == 0)
        nut_submit (ups, "temperature", "battery", value);
       else if (strcmp ("battery.voltage", key) == 0)

-- 
dwmw2

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
collectd mailing list
[email protected]
http://mailman.verplant.org/listinfo/collectd

Reply via email to