This module can be added to Pandora to monitor a host’s system temp.
First, install lm-sensors and configure it following these instructions.
Next, we need to figure out the layout of the “sensors” output. Mine looks like:
$ sensors coretemp-isa-0000 Adapter: ISA adapter Physical id 0: +35.0°C (high = +80.0°C, crit = +100.0°C) Core 0: +33.0°C (high = +80.0°C, crit = +100.0°C) Core 1: +33.0°C (high = +80.0°C, crit = +100.0°C) Core 2: +35.0°C (high = +80.0°C, crit = +100.0°C) Core 3: +34.0°C (high = +80.0°C, crit = +100.0°C)
I want this the number only from the Physical id line, so we’re going to use a combination of grep and awk to extract that information. Type something like the below in the command line. For me:
sensors | awk 'NR==3 {print $4}' | grep -o [0-9][0-9].[0-9]
Basically, the above can be broken down to:
sensors: runs the sensors command awk: prints select columns and rows NR==3: tells awk that I want the third row {print $4}: tells awk that I want the 4th column grep -o [0-9][0-9].[0-9]: grep matches only XX.X number format.
The only issue with the above is if the temp gets above 99*C, then it’ll report only something like 00.0 for 100.0, but that won’t be your only problem anyway.
Now, we can add it to our pandora_agent.conf which should be located in (/etc/pandora/ or /etc/pandorafms/). You can add it to the end of the file:
#System Temperature module_begin module_name Temperature module_type generic_data module_exec sensors | awk 'NR==3 {print $4}' | grep -o [0-9][0-9].[0-9] module_description Processor temperature module_end
Restart the Pandora agent and you should be good to go.