Created
February 13, 2016 22:38
-
-
Save infertux/d1aa602766ebb5656249 to your computer and use it in GitHub Desktop.
Munin plugin to monitor AXP PMU on sunxi SoCs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# -*- sh -*- | |
# vim: ft=sh | |
: << =cut | |
=head1 NAME | |
axp_pmu - Plugin to monitor power | |
=head1 CONFIGURATION | |
None | |
=head1 AUTHOR | |
Cedric Felizard | |
=head1 LICENSE | |
AGPLv3+ | |
=head1 MAGIC MARKERS | |
#%# family=auto | |
#%# capabilities=autoconf | |
=cut | |
AXP_PMU=/sys/power/axp_pmu | |
if [ "$1" = "autoconf" ]; then | |
autoconf="yes" | |
test -d $AXP_PMU || autoconf="no" | |
echo $autoconf | |
exit 0 | |
fi | |
if [ "$1" = "config" ]; then | |
echo 'graph_title AXP PMU' | |
echo 'graph_category sensors' | |
echo 'axp_pmu_ac_amperage.label AC amperage' | |
echo 'axp_pmu_ac_voltage.label AC voltage' | |
echo 'axp_pmu_ac_connected.label AC connected' | |
echo 'axp_pmu_ac_used.label AC used' | |
echo 'axp_pmu_battery_amperage.label Battery amperage' | |
echo 'axp_pmu_battery_voltage.label Battery voltage' | |
echo 'axp_pmu_battery_charge.label Battery charge' | |
echo 'axp_pmu_battery_power.label Battery power' | |
echo 'axp_pmu_battery_capacity.label Battery capacity' | |
echo 'axp_pmu_battery_charging.label Battery charging' | |
echo 'axp_pmu_battery_connected.label Battery connected' | |
echo 'axp_pmu_pmu_voltage.label PMU voltage' | |
exit 0 | |
fi | |
echo "axp_pmu_ac_amperage.value $(echo $(cat /sys/power/axp_pmu/ac/amperage)/1000000 | bc -l)" | |
echo "axp_pmu_ac_voltage.value $(echo $(cat /sys/power/axp_pmu/ac/voltage)/1000000 | bc -l)" | |
echo "axp_pmu_ac_connected.value $(cat /sys/power/axp_pmu/ac/connected)" | |
echo "axp_pmu_ac_used.value $(cat /sys/power/axp_pmu/ac/used)" | |
echo "axp_pmu_battery_amperage.value $(echo $(cat /sys/power/axp_pmu/battery/amperage)/1000000 | bc -l)" | |
echo "axp_pmu_battery_voltage.value $(echo $(cat /sys/power/axp_pmu/battery/voltage)/1000000 | bc -l)" | |
echo "axp_pmu_battery_charge.value $(echo $(cat /sys/power/axp_pmu/battery/charge)/1000000 | bc -l)" | |
echo "axp_pmu_battery_power.value $(echo $(cat /sys/power/axp_pmu/battery/power)/1000000 | bc -l)" | |
echo "axp_pmu_battery_capacity.value $(echo $(cat /sys/power/axp_pmu/battery/capacity)/100 | bc -l)" | |
echo "axp_pmu_battery_charging.value $(cat /sys/power/axp_pmu/battery/charging)" | |
echo "axp_pmu_battery_connected.value $(cat /sys/power/axp_pmu/battery/connected)" | |
echo "axp_pmu_pmu_voltage.value $(echo $(cat /sys/power/axp_pmu/pmu/voltage)/1000000 | bc -l)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment