W32 CPU (any number of processors) Perl Script via WMI
Moderators: Developers, Moderators
W32 CPU (any number of processors) Perl Script via WMI
First off, thanks to Sidewinder...this is my first time working with Perl and Cacti, so his scripts got me off to a great start. I have lots more coming, so stay tuned! (IIS, Exchange, etc).
This script connects to a remote machine via WMI and gets the requested item from it (LoadPercentage is what I use) for however many processors you specify.
Enjoy!
This script connects to a remote machine via WMI and gets the requested item from it (LoadPercentage is what I use) for however many processors you specify.
Enjoy!
- Attachments
-
- w32_query_cpu.pl.txt
- Perl script
- (5.84 KiB) Downloaded 7452 times
-
- cacti_data_template_w32_cpu_load.xml
- Data template (single processor)
- (3.46 KiB) Downloaded 4391 times
-
- cacti_data_template_w32_cpu_load_2_cpus.xml
- Data template (dual processor)
- (4.44 KiB) Downloaded 5142 times
Can't get the Graph to work...
Could you post the "cacti_graph_template" up for download?
Everything is working fine except I have to create the grahp myself, and it doesnt show anything <-prolly my own fault
Btw Im kinda new to this.....
Thx
Everything is working fine except I have to create the grahp myself, and it doesnt show anything <-prolly my own fault
Btw Im kinda new to this.....
Thx
Graphs
- Attachments
-
- cacti_graph_template_w32_cpu_load.xml
- 1 CPU Graph
- (7.47 KiB) Downloaded 3204 times
-
- cacti_graph_template_w32_cpu_load_2_cpus.xml
- 2 CPU graph
- (10.89 KiB) Downloaded 3239 times
For 4 processors
- Attachments
-
- Screenshot
- w32_4cpu.gif (8.48 KiB) Viewed 60635 times
-
- cacti_data_template_w32_cpu_load_4_cpus.xml
- Data Template
- (6.35 KiB) Downloaded 3068 times
-
- cacti_graph_template_w32_cpu_load_4_cpus.xml
- Graph Template
- (17.66 KiB) Downloaded 3250 times
Im having this message when i try to import a template
someone could help me ?
Warning: filesize() [function.filesize]: stat failed for C:\WINNT\TEMP\php13.tmp in E:\site\cacti\templates_import.php on line 59
Warning: fread() [function.fread]: Length parameter must be greater than 0. in E:\site\cacti\templates_import.php on line 59
Warning: Cannot modify header information - headers already sent by (output started at E:\site\cacti\templates_import.php:59) in E:\site\cacti\templates_import.php on line 67
someone could help me ?
Warning: filesize() [function.filesize]: stat failed for C:\WINNT\TEMP\php13.tmp in E:\site\cacti\templates_import.php on line 59
Warning: fread() [function.fread]: Length parameter must be greater than 0. in E:\site\cacti\templates_import.php on line 59
Warning: Cannot modify header information - headers already sent by (output started at E:\site\cacti\templates_import.php:59) in E:\site\cacti\templates_import.php on line 67
Which version are you using - been having this problem with a few different templates as well.
http://forums.cacti.net/viewtopic.php?t=4908
http://forums.cacti.net/viewtopic.php?t=4908
You could always just use the Perl script I've provided and then setup your own data and graph template, it's not all that hard.
- Attachments
-
- cacti_graph_template_w32_cpu_load.xml
- Graph template exported in 0.8.6
- (4.03 KiB) Downloaded 2349 times
-
- Posts: 13
- Joined: Thu Sep 16, 2004 12:32 pm
Re:
Hi Devilsun,
I am using your script to get the CPU load on my Windows XP system. I am using cacti 0.8.6b. I imported the data and graph templates and created data source for the local host. The graph shows up, but the CPU load is always 100% . I am using the script to just get the load on one CPU. Can you help me in this?
My cacti log file says this.
10/20/2004 01:51:10 PM - CMDPHP: Poller[0] Host[0] CMD: perl C:\Apache2\htdocs\cacti/scripts/w32_query_cpu.pl 192.168.10.136 get LoadPercentage 1, output: 100
Thanks,
Jaya.
I am using your script to get the CPU load on my Windows XP system. I am using cacti 0.8.6b. I imported the data and graph templates and created data source for the local host. The graph shows up, but the CPU load is always 100% . I am using the script to just get the load on one CPU. Can you help me in this?
My cacti log file says this.
10/20/2004 01:51:10 PM - CMDPHP: Poller[0] Host[0] CMD: perl C:\Apache2\htdocs\cacti/scripts/w32_query_cpu.pl 192.168.10.136 get LoadPercentage 1, output: 100
Thanks,
Jaya.
Because it probably is at 100% (most of my queries get info right at that particular time they're queried). I had to stop graphing the CPU usage on my monitoring computer because at the time it requested the CPU usage, it was in the middle of polling a ton of devices (since polling is threaded) and at that time the CPU was being 100% used.
I know this is the case in my situation, because if I play around with the number of devices per thread and thread count for the poller, occasionally I'll get a lower value.
I know this is the case in my situation, because if I play around with the number of devices per thread and thread count for the poller, occasionally I'll get a lower value.
Who is online
Users browsing this forum: No registered users and 3 guests