Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Sun Dec 16, 2018 10:29 am

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 
Offline

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.


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

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. http://openhardwaremonitor.org/ 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.
Attachment:
File comment: Paessler WMI Tester - Basic Tab
PaesslerWMITester-BasicTab.JPG
PaesslerWMITester-BasicTab.JPG [ 63.43 KiB | Viewed 2037 times ]
Attachment:
File comment: Paessler WMI Tester - Advance Tab
PaesslerWMITester-AdvanceTab.JPG
PaesslerWMITester-AdvanceTab.JPG [ 71.58 KiB | Viewed 2037 times ]


Follow the steps for a Linux WMI client from http://blog.network-outsourcing.de/cacti-howtos/cacti/howto-compile-wmic-on-centos/ . Both 1.3.14 and 1.3.16 exist. (I used
Code:
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.)
Attachment:
File comment: Result of wmi query
wmicScriptUsing1.3.14.gif
wmicScriptUsing1.3.14.gif [ 9.82 KiB | Viewed 2037 times ]


Your query will be different, but this what I used on this Intel from Ubuntu. Use a \ before the " , where needed.
Code:
/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.)

TalkingToes


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

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

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: http://php.net/manual/en/language.types ... php#101318 ):

Code:
<?php
$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:
Code:
INT:     1114112000
HEX:     0x42680000
Float32: 58

_________________
Greetings,
Phalek
---
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 |

Code:
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


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

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!
TalkingToes


Attachments:
wmi.zip [2.73 KiB]
Downloaded 87 times
Top
 Profile  
 
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: Google [Bot] and 1 guest


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