W32 CPU (any number of processors) Perl Script via WMI
Moderators: Developers, Moderators
My understanding is that it does matter. Perl doesn't offer Win32::OLE on Linux. But have a look at http://forums.cacti.net/viewtopic.php?t=5842 - there I have summarized all possible ways to get WMI data from windows to CACTI on Linux.anonfoo wrote:Would this work if I have cacti installed ona Linux box or does that not matter?
HTH
Thomas Rupp
Hi!
I used your scripts to monitor CPUs.I tried this script on my localhost (a WinXP) and it works well, then I tested it on a remote server(a Win2000)...and... no data in my graph...
My config:
Windows XP
apache 2.0.53
cacti 0.8.6d
cactid 0.8.6d
mysql 4.0.24
net-snmp-5.2.1
php-5.0.4
rrdtool-cygwin-1.2.9
When I run php poller.php:
06/29/2005 03:03:23 PM - SYSTEM STATS: Time: 23.1785 s, Method: cmd.php, Processes: 1, Threads: N/A, Hosts: 13, Hosts/Process: 13
06/29/2005 03:03:23 PM - POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update C:\Apache2\htdocs\cacti\rra\serveur1_w32_cpu_load_32.rrd --template w32_cpu_load 1120050180:U
06/29/2005 03:03:23 PM - CMDPHP: Poller[0] Time: 22.4457 s, Theads: N/A, Hosts: 12
06/29/2005 03:03:23 PM - PHPSVR: Poller[0] DEBUG: PHP Script Server Shutdown request received, exiting
06/29/2005 03:03:23 PM - CMDPHP: Poller[0] Host[19] CMD: perl C:\Apache2\htdocs\cacti/scripts/w32_query_cpu.pl 192.168.0.14 get LoadPercentage 1, output: U
06/29/2005 03:03:23 PM - CMDPHP: Poller[0] Host[19] WARNING: Result from CMD not valid. Partial Result: Unable to talk to WM
06/29/2005 03:03:18 PM - POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update C:\Apache2\htdocs\cacti\rra\serveur2_w32_cpu_load_34.rrd --template w32_cpu_load 1120050180:U
06/29/2005 03:03:17 PM - CMDPHP: Poller[0] Host[19] RECACHE: Processing 3 items in the auto reindex cache for '192.168.0.14'.
06/29/2005 03:03:17 PM - CMDPHP: Poller[0] Host[19] SNMP: Host responded to SNMP
06/29/2005 03:03:17 PM - CMDPHP: Poller[0] Host[16] CMD: perl C:\Apache2\htdocs\cacti/scripts/w32_query_cpu.pl 192.168.0.1 get LoadPercentage 1, output: U
06/29/2005 03:03:17 PM - CMDPHP: Poller[0] Host[16] WARNING: Result from CMD not valid. Partial Result: Unable to talk to WM
06/29/2005 03:03:04 PM - POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update C:\Apache2\htdocs\cacti\rra\127_0_0_1_w32_cpu_load_24.rrd --template w32_cpu_load 1120050180:4
06/29/2005 03:03:04 PM - CMDPHP: Poller[0] Host[2] CMD: perl C:\Apache2\htdocs\cacti/scripts/w32_query_cpu.pl 127.0.0.1 get LoadPercentage 1, output: 4
Why for the localhost ouput value it's ok and for remote servers it's done?
Could you help me?!
I used your scripts to monitor CPUs.I tried this script on my localhost (a WinXP) and it works well, then I tested it on a remote server(a Win2000)...and... no data in my graph...
My config:
Windows XP
apache 2.0.53
cacti 0.8.6d
cactid 0.8.6d
mysql 4.0.24
net-snmp-5.2.1
php-5.0.4
rrdtool-cygwin-1.2.9
When I run php poller.php:
06/29/2005 03:03:23 PM - SYSTEM STATS: Time: 23.1785 s, Method: cmd.php, Processes: 1, Threads: N/A, Hosts: 13, Hosts/Process: 13
06/29/2005 03:03:23 PM - POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update C:\Apache2\htdocs\cacti\rra\serveur1_w32_cpu_load_32.rrd --template w32_cpu_load 1120050180:U
06/29/2005 03:03:23 PM - CMDPHP: Poller[0] Time: 22.4457 s, Theads: N/A, Hosts: 12
06/29/2005 03:03:23 PM - PHPSVR: Poller[0] DEBUG: PHP Script Server Shutdown request received, exiting
06/29/2005 03:03:23 PM - CMDPHP: Poller[0] Host[19] CMD: perl C:\Apache2\htdocs\cacti/scripts/w32_query_cpu.pl 192.168.0.14 get LoadPercentage 1, output: U
06/29/2005 03:03:23 PM - CMDPHP: Poller[0] Host[19] WARNING: Result from CMD not valid. Partial Result: Unable to talk to WM
06/29/2005 03:03:18 PM - POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update C:\Apache2\htdocs\cacti\rra\serveur2_w32_cpu_load_34.rrd --template w32_cpu_load 1120050180:U
06/29/2005 03:03:17 PM - CMDPHP: Poller[0] Host[19] RECACHE: Processing 3 items in the auto reindex cache for '192.168.0.14'.
06/29/2005 03:03:17 PM - CMDPHP: Poller[0] Host[19] SNMP: Host responded to SNMP
06/29/2005 03:03:17 PM - CMDPHP: Poller[0] Host[16] CMD: perl C:\Apache2\htdocs\cacti/scripts/w32_query_cpu.pl 192.168.0.1 get LoadPercentage 1, output: U
06/29/2005 03:03:17 PM - CMDPHP: Poller[0] Host[16] WARNING: Result from CMD not valid. Partial Result: Unable to talk to WM
06/29/2005 03:03:04 PM - POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update C:\Apache2\htdocs\cacti\rra\127_0_0_1_w32_cpu_load_24.rrd --template w32_cpu_load 1120050180:4
06/29/2005 03:03:04 PM - CMDPHP: Poller[0] Host[2] CMD: perl C:\Apache2\htdocs\cacti/scripts/w32_query_cpu.pl 127.0.0.1 get LoadPercentage 1, output: 4
Why for the localhost ouput value it's ok and for remote servers it's done?
Could you help me?!
I'm trying to use these scripts to get CPU information from Windows Servers (2000 & 2003), but althought the script is running, when viewing the poller log I get the following errors;
07/12/2005 02:11:04 PM - CACTID: Poller[0] Host[3] DS[33] WARNING: Result from SCRIPT not valid. Partial Result: ...
07/12/2005 02:11:04 PM - CACTID: Poller[0] Host[3] ERROR: Empty result [server1.comm.ad.roke.co.uk]: 'perl C:\Inetpub\wwwroot\cacti/scripts/w32_query_cpu.pl server1 get LoadPercentage 2'
The RRD files are not updated, and the graphs show 'NaN'. If I run this script from the command line, I get the correct results, e.g;
CPU0:1 CPU1:2 etc.
I am running Cacti 0.8.6f on Windows 2000 server.
07/12/2005 02:11:04 PM - CACTID: Poller[0] Host[3] DS[33] WARNING: Result from SCRIPT not valid. Partial Result: ...
07/12/2005 02:11:04 PM - CACTID: Poller[0] Host[3] ERROR: Empty result [server1.comm.ad.roke.co.uk]: 'perl C:\Inetpub\wwwroot\cacti/scripts/w32_query_cpu.pl server1 get LoadPercentage 2'
The RRD files are not updated, and the graphs show 'NaN'. If I run this script from the command line, I get the correct results, e.g;
CPU0:1 CPU1:2 etc.
I am running Cacti 0.8.6f on Windows 2000 server.
Ah, and here I am trying to duplicate your work.... <groan>...
Except I'm trying to do it without ANY knowledge of how to use WMI along with SNMP.
Just trying to use the standard Host_MIB stuff... (Which should work too).
Argon0
Except I'm trying to do it without ANY knowledge of how to use WMI along with SNMP.
Just trying to use the standard Host_MIB stuff... (Which should work too).
Argon0
No longer a n00by, probably, by now an 0ldby
Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
I got a problem with this template.
the perl script works fine when I manually run it:
c:\perl c:/apache2/htdocs/cacti/scripts/w32_query_cpu.pl 192.168.100.26 LoadPercentage 4
CPU0:0 CPU1:1 CPU2:1 CPU3:0
and the debug log as this:
02/05/2006 11:12:23 PM - CMDPHP: Poller[0] Host[18] DS[171] CMD: perl C:/Apache2/htdocs/cacti/scripts/w32_query_cpu.pl 192.168.100.26 get LoadPercentage 4, output: U
so the graphic could not update.
any clue?
the perl script works fine when I manually run it:
c:\perl c:/apache2/htdocs/cacti/scripts/w32_query_cpu.pl 192.168.100.26 LoadPercentage 4
CPU0:0 CPU1:1 CPU2:1 CPU3:0
and the debug log as this:
02/05/2006 11:12:23 PM - CMDPHP: Poller[0] Host[18] DS[171] CMD: perl C:/Apache2/htdocs/cacti/scripts/w32_query_cpu.pl 192.168.100.26 get LoadPercentage 4, output: U
so the graphic could not update.
any clue?
Does this work with 2k and 2k3
I am trying to run this against a 2k server and get no results. Do i need to change the script?
Any tips on how to deal with 8 hyperthreaded procs? Each physical processor shows up as two seperate procs as far as the template is concerned. Any help is greatly apprieciated.
[size=75]Cacti - 0.8.6h + patches
PHP - 5.1.2
ZendOptimizer - 2.6.2
FastCGI - 0.6
MySQL - 4.1.15
Cactid - 0.8.6g
rrdtool - 1.2.x
IIS6[/size]
PHP - 5.1.2
ZendOptimizer - 2.6.2
FastCGI - 0.6
MySQL - 4.1.15
Cactid - 0.8.6g
rrdtool - 1.2.x
IIS6[/size]
I have similar error but not sure whether its similar cause.ioiioi wrote:I have figured out the problem, the reason is the account's permission, It could not talk to WMI.
May i know what is your solution.
08/01/2006 10:45:05 AM - CACTID: Poller[0] Host[5] SNMP Result: Host responded to SNMP
08/01/2006 10:45:05 AM - CACTID: Poller[0] Host[4] DS[77] SCRIPT: perl C:/Inetpub/wwwroot/cacti/scripts/w32_query_cpu.pl get LoadPercentage 4, output: U
08/01/2006 10:45:05 AM - CACTID: Poller[0] Host[4] DS[77] WARNING: Result from SCRIPT not valid. Partial Result: ...
08/01/2006 10:45:05 AM - CACTID: Poller[0] Host[4] ERROR: Empty result [sgk-kp2]: 'perl C:/Inetpub/wwwroot/cacti/scripts/w32_query_cpu.pl get LoadPercentage 4'
08/01/2006 10:45:05 AM - CACTID: Poller[0] Host[4] SNMP Result: Host responded to SNMP
Who is online
Users browsing this forum: No registered users and 6 guests