Last active
June 11, 2024 09:31
-
-
Save jul/9b869a1532ac058b00cf998c7f2c21b2 to your computer and use it in GitHub Desktop.
munin plugin for freebsd for monitoring fan rotation ibm_acpi
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 | |
acpi_ibm - Munin plugin to monitor the fan speed returned by ACPI probe. | |
=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 fans' speeds. | |
=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 | |
NB_FAN=$( sysctl -a | grep fan_speed | wc -l ) | |
do_ () { # Fetch | |
if sysctl dev.acpi_ibm.0.fan_speed &> /dev/null; then | |
# man acpi_ibm | |
for ((i=0;i<$NB_FAN;i++)); do | |
echo -n "FAN_$i.value "; | |
sysctl dev.acpi_ibm.$i.fan_speed | cut -d " " -f2; | |
done | |
fi | |
exit 0 | |
} | |
do_config () { | |
echo "graph_title ACPI Fan rotation" | |
echo "graph_vlabel rotations per minute" | |
echo "graph_category sensors" | |
echo "graph_info This graph gives rotation per minutes for each fans in ACPI table" | |
for ((i=0;i<$NB_FAN;i++)); do | |
echo "FAN_$i.label fan_$i" | |
done | |
# print values immediately if dirtyconfig is supported | |
if [ "${MUNIN_CAP_DIRTYCONFIG:-0}" = 1 ]; then do_; fi | |
} | |
do_autoconf () { | |
if [[ $NB_FAN == 0 ]]; then | |
echo "no (sysctl dev.acpi_ibm.0.fan_speed not found)" | |
exit 0 | |
fi | |
echo yes | |
exit 0 | |
} | |
case $1 in | |
config|autoconf|'') | |
"do_$1" | |
esac | |
exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment