Monitor your Servers CPU temperature using EmonCMS

Hi,

Im not a hugely exprenced OpenEnergyMonotor user, nor Script writer, but I have just written a script to post your servers core temperature to EmonCMS. This script depends on lm-sensors being installed and configured properly. It also may require customizing to your servers output of "sensors"

 

Here is the script, I have it saved in /usr/bin/emon-server-temp.

 

#!/bin/bash
CPUTemp=$(sensors -u | grep temp2_input | tail -n1 | awk '{print $2}')
echo "$CPUTemp"
wget -q -O /dev/null "http://127.1.1.1/emon/api/post?apikey=xxxxxxxxxxxxxxxxxxxxxxxxx&json={ServerCoreTemp:"$CPUTemp"}"
 
 
 
 
​You will need to "sudo chmod a+x /usr/bin/emon-server-temp"
 
​You may also want to edit /etc/crontab to include the following line, in order for the script to run once a minute.
*  *    * * *   root    emon-server-temp
 
Always open to comments or refinements on the above script.
 
 
 
Mike Christiansen
 
 
TrystanLea's picture

Re: Monitor your Servers CPU temperature using EmonCMS

Wow! Awesome! thanks for sharing

sudo apt-get install lm-sensors

$ sensors

 

acpitz-virtual-0
Adapter: Virtual device
temp1:       +54.0°C  (crit = +88.0°C) 
 
thats the temperature on my eee-pc

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.