NAME
Monitoring::Sneck::Checks::sensors - checks temperatures, fans, and voltages
VERSION
Version 0.0.1
SYNOPSIS
sensors|perl:sensors
cpu_temp|perl:sensors -s '^coretemp' -w 80 -c 90
no_gpu|perl:sensors -x '^nouveau' -i
DESCRIPTION
On Linux, reads every temperature, fan, and voltage from /sys/class/hwmon, so lm-sensors is not needed, and checks each against the limits its chip gives, as well as its alarm and fault flags. With --warning or --critical, temperatures are checked against those alone, their alarm flags left out.
- temperatures :: At or over crit, or a crit alarm, is CRITICAL. At or over max, or a max or plain alarm, is WARNING.
- fans :: Under min, or a alarm, is CRITICAL, as a fan that stopped is one.
- voltages :: Outside of min and max, or a alarm, is WARNING.
A fault, a sensor that is broken or not hooked up, is UNKNOWN unless --ignore-fault is given. A sensor that can not be read, such as on a GPU that is powered down, is left out. Limits of 0 or less are taken as not set, as some chips report them that way.
On FreeBSD, only temperatures are known, from dev.cpu.N.temperature, with coretemp's tjmax as crit, and the ACPI thermal zones, with _CRT as crit and _HOT as max, through BSD::Sysctl. Other OSes are UNKNOWN, as is finding no sensors.
On Linux each sensor is named by its chip and its label, such as "coretemp Core 0", or its file, such as "nct6775 fan2". On FreeBSD they are cpuN and tzN. Every one with a reading goes into the perfdata, with what it is checked against as its ranges.
OPTIONS
- -s, --sensor :: A regex sensors names must match to be checked. May be given more than once, matching any is enough.
- -x, --exclude :: A regex for sensors to leave out. May be given more than once.
- -w, --warning :: Range of degrees C for temperatures, in place of what the chips say.
- -c, --critical :: Range of degrees C for temperatures, in place of what the chips say.
- -i, --ignore-fault :: Faults are OK.
METHODS
check
Does the check.
perf_ranges
Returns the warning and critical ranges for a sensor's perfdata, as it is checked under "DESCRIPTION". For a temperature, max and crit, or --warning and --critical if given. For a fan, critical is under min. For a voltage, warning is outside min to max. Any not known is undef.
- sensor :: As for "sensor_status".
my ( $warning, $critical ) = $check->perf_ranges( { type => 'fan', min => 300 } );
# ( undef, '300:' )
user_limits
Returns 1 if --warning or --critical was given, so they are used for temperatures in place of what the chips say.
wanted
Returns 1 if a sensor name is to be checked, as --sensor and --exclude say, else 0.
sensor_status
Works out the status of a sensor, as said under "DESCRIPTION".
- sensor :: Hash ref of name, type, one of temp, fan, or in, value, min, max, crit, any undef if not known, and alarm, max_alarm, min_alarm, crit_alarm, and fault, each 1 if set.
Returns the code and why, or undef for why if OK.
linux_sensors
Returns the sensors under /sys/class/hwmon, as hash refs as taken by "sensor_status".
freebsd_sensors
Returns the temperatures FreeBSD knows through sysctl, as hash refs as taken by "sensor_status".