Last active
June 10, 2024 16:46
-
-
Save jul/e02b4b9cf4682c8abf694b7533773b66 to your computer and use it in GitHub Desktop.
munin plugin for acpi thermal zone for lenovo on freebsd
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
#!/usr/bin/env bash | |
# -*- sh -*- | |
: <<=cut | |
=head1 NAME | |
acpii_ibm - Munin plugin to monitor the temperature in different ACPI Thermal zones. | |
=head1 APPLICABLE SYSTEMS | |
FreeBSD systems with ACPI support. man acpi_ibm(4) | |
=head1 CONFIGURATION | |
add ibm_acpi in loader.conf | |
=head1 USAGE | |
Link this plugin to @@CONFDIR@@/plugins/ and restart the munin-node. | |
=head1 INTERPRETATION | |
The plugin shows the temperature from the different thermal zones. | |
=head1 MAGIC MARKERS | |
#%# family=auto | |
#%# capabilities=autoconf | |
=head1 BUGS | |
None known. | |
=head1 VERSION | |
v1.1 - 2024-03-24 | |
=head1 AUTHOR | |
Julien Tayon (julien@tayon.net) | |
=head1 LICENSE | |
GPLv2 | |
=cut | |
if sysctl dev.acpi_ibm.0.thermal &>/dev/null; then | |
ATZ=( CPU Mini_PCI_Module HDD GPU Built_in_battery_1 UltraBay_battery_1 Built_in_battery_2 UltraBay_battery_2 ) | |
else | |
ATZ= | |
fi | |
do_ () { # Fetch | |
if sysctl dev.acpi_ibm.0.thermal &> /dev/null; then | |
# man acpi_ibm | |
for ((i=0;i<${#ATZ[@]};i++)); do | |
echo -n "${ATZ[i]}.value "; | |
sysctl dev.acpi_ibm.0.thermal | cut -d " " -f$(( i+2 )); | |
done | |
fi | |
exit 0 | |
} | |
do_config () { | |
echo "graph_title ACPI Thermal zone temperatures" | |
echo "graph_vlabel Celsius" | |
echo "graph_category sensors" | |
echo "graph_info This graph shows the temperature in different ACPI Thermal zones. If there is only one it will usually be the case temperature." | |
for ZONE in ${ATZ[@]}; do | |
echo "$ZONE.label $ZONE" | |
echo "$ZONE.warning 68" | |
echo "$ZONE.critical 72" | |
done | |
# print values immediately if dirtyconfig is supported | |
if [ "${MUNIN_CAP_DIRTYCONFIG:-0}" = 1 ]; then do_; fi | |
} | |
do_autoconf () { | |
if [ -z "$ATZ" ]; then | |
echo "no (failed to find thermal zones below /sys/class/thermal/thermal_zone*)" | |
exit 0 | |
fi | |
echo yes | |
exit 0 | |
} | |
case $1 in | |
config|autoconf|'') | |
"do_$1" | |
esac | |
exit $? |
Author
jul
commented
Jun 10, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment