Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Thu Jul 19, 2018 1:55 pm

All times are UTC - 5 hours

Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Temperature Monitoring on Windows Clients
PostPosted: Tue May 19, 2015 12:57 am 

Joined: Tue May 19, 2015 12:34 am
Posts: 4
Hi All,

Hopefully this is the correct board to post this in:

I have some customers that have normal pcs that I currently monitor on cacti, standard stuff like memory, cpu disk usage. I would like to extend this to monitoring the cpu temperatures as well.

I have read that you can use speedfan and its snmp extension to do so, however the project seems dead and there are no available downloads for me to test.
Are there any other ways of doing this? bear in mind that these are not full on workstation boards with management ports etc.

Your help is much appreciated.

 Post subject: Re: Temperature Monitoring on Windows Clients
PostPosted: Fri Jun 12, 2015 3:51 pm 

Joined: Mon May 25, 2009 11:52 pm
Posts: 16
Location: Seattle, WA
This almost works.

You can use Open Hardware Monitor, with WMI queries. Make sure you allow WMI via the Windows firewall, and have a [domain|local] user account that has rights to make WMI queries too.

If you use Pressler WMI Tester, enter the domain, username, password hostname, and change the Namespace to root/OpenHardwareMonitor and the Query is (o) Custom SELECT * from SENSOR but you are looking for Value and set a WHERE to limit the results to just one value. The correct temperature is 55 for my examples.
File comment: Paessler WMI Tester - Basic Tab
PaesslerWMITester-BasicTab.JPG [ 63.43 KiB | Viewed 1884 times ]
File comment: Paessler WMI Tester - Advance Tab
PaesslerWMITester-AdvanceTab.JPG [ 71.58 KiB | Viewed 1884 times ]

Follow the steps for a Linux WMI client from . Both 1.3.14 and 1.3.16 exist. (I used
make "CPP=gcc -E -ffreestanding"
to get around an error that appeared)

But, I get the wrong temperatures returned, (1114112000.000000 is a bit wrong) when I run this simple BASH script. Enter your domain, username (with WMI rights) and password. (If you convert the value to Hex, it looks promising, but beyond me.)
File comment: Result of wmi query
wmicScriptUsing1.3.14.gif [ 9.82 KiB | Viewed 1884 times ]

Your query will be different, but this what I used on this Intel from Ubuntu. Use a \ before the " , where needed.
/usr/bin/wmic -d 0 -U DOMAIN/WMIUSER%PASSWORD --namespace='root/OpenHardwareMonitor' //w.x.y.z  "Select Value FROM Sensor WHERE SensorType = \"Temperature\"  and Name = \"CPU Package\" and index = 2 "

Anybody have theories as to why it fails? (have a coworker with a space heater under the desk. I suspect the PC is overheating, and this would be a nice way to know.)


 Post subject: Re: Temperature Monitoring on Windows Clients
PostPosted: Mon Jun 15, 2015 2:03 am 
Cacti Guru User
User avatar

Joined: Thu Jan 31, 2008 6:39 am
Posts: 2684
Location: Kressbronn, Germany

Yes that value being returned is the decimal representation of a HEX number ( use -d 10 on the wmic command to get more info on the data values being returned ). That hex number needs to be converted to a float (real 32) number to actually get the true temperature:

Example of a wmic return:
v_real32 : 0x42680000(1114112000)

Hex 0x42680000in FLoat: 58.000000

In PHP you could use the following function to convert these numbers ( function is from this post: ... php#101318 ):

$int = 1114112000;
$hex = dechex($int);
echo "INT:     " . $int."\n";
echo "HEX:     0x" . $hex."\n";
echo "Float32: " . hexTo32Float($hex)."\n";

function hexTo32Float($strHex) {
    $v = hexdec($strHex);
    $x = ($v & ((1 << 23) - 1)) + (1 << 23) * ($v >> 31 | 1);
    $exp = ($v >> 23 & 0xFF) - 127;
    return $x * pow(2, $exp - 23);

output of the above:
INT:     1114112000
HEX:     0x42680000
Float32: 58

Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
Plugins : CereusTransporter | CereusReporting | nmidWebService | nmidSmokeping | nmidWeb2 |

CereusServer Master:  SYSTEM STATS: Time:2.5621 Method:spine Processes:1 Threads:16 Hosts:446 HostsPerProcess:446 DataSources:14683 RRDsProcessed:7573
CereusServer Agent:   SYSTEM STATS: Time:27.4840 Method:spine Processes:1 Threads:8 Hosts:16 HostsPerProcess:16 DataSources:114576 RRDsProcessed:48061

 Post subject: Re: Temperature Monitoring on Windows Clients
PostPosted: Wed Jul 01, 2015 11:27 am 

Joined: Mon May 25, 2009 11:52 pm
Posts: 16
Location: Seattle, WA
Since I'm using aWMIC.php plugin, I can store the real32 values in cacti.

Is there a CDEF rule I can create/use, to change the real32 it to a simple number (29)?

-or- can someone on here, modify the attached wmi.php file to do the math on the v_real32 value and change it to decimal number? Since I'm not a programmer, I'd rather not edit the wmic.php file I use. I have attached mine here. It is not a usable package, just the one .php from it. I would have cacti run the script via a new file name (OneTempMonitor.php ??) to get the integer values (or 10x the first decimal value (so 29.5 becomes 295), and use the CDEF of "Divide by 10" when graphing.)

-or- a whole new OpenTemperatureMonitor WMI script?

-or- ???

Any suggestions would be appreciated. Thank you!

Attachments: [2.73 KiB]
Downloaded 79 times
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group