Skip to content

battery plugin

Plugin name battery
Type read
Callbacks init, read
Status supported
Since 3.7
Copyright 2006–2014 Florian octo Forster, 2008 Michał Mirosław, 2014 Andy Parkins
License GPLv2
Configuration collectd.conf(5)

The Battery plugin collects the battery's charge, the drawn current and the battery's voltage. Right now the plugin works with ACPI- and PMU-batteries under Linux and under Mac OS X.

Example graphs

Plugin-battery-charge.png Plugin-battery-current.png Plugin-battery-voltage.png

Dependencies

  • Linux uses one of these sources (first match):
    • sysfs filesystem with /sys/class/power_supply (available since collectd 5.4.2).
    • proc filesystem with /proc/acpi/battery
    • proc filesystem with /proc/pmu.
  • Mac OS X
    • IOKit (Part of Mac OS X.)

Configuration

Configuration options · from collectd.conf(5)

See this section in the full configuration reference

The battery plugin reports the remaining capacity, power and voltage of laptop batteries.

ValuesPercentage false|true
When enabled, remaining capacity is reported as a percentage, e.g. "42% capacity remaining". Otherwise the capacity is stored as reported by the battery, most likely in "Wh". This option does not work with all input methods, in particular when only /proc/pmu is available on an old Linux system. Defaults to false.
ReportDegraded false|true

Typical laptop batteries degrade over time, meaning the capacity decreases with recharge cycles. The maximum charge of the previous charge cycle is tracked as "last full capacity" and used to determine that a battery is "fully charged".

When this option is set to false, the default, the battery plugin will only report the remaining capacity. If the ValuesPercentage option is enabled, the relative remaining capacity is calculated as the ratio of the "remaining capacity" and the "last full capacity". This is what most tools, such as the status bar of desktop environments, also do.

When set to true, the battery plugin will report three values: charged (remaining capacity), discharged (difference between "last full capacity" and "remaining capacity") and degraded (difference between "design capacity" and "last full capacity").

QueryStateFS false|true
When set to true, the battery plugin will only read statistics related to battery performance as exposed by StateFS at /run/state. StateFS is used in Mer-based Sailfish OS, for example.