Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


W32 CPU (any number of processors) Perl Script via WMI
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
DevilSun
Cacti User


Joined: 16 Jul 2004
Posts: 166
Location: Oregon

PostPosted: Fri Jul 16, 2004 2:36 pm    Post subject: W32 CPU (any number of processors) Perl Script via WMI Reply with quote

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!



cacti_data_template_w32_cpu_load_2_cpus.xml
 Description:
Data template (dual processor)

Download
 Filename:  cacti_data_template_w32_cpu_load_2_cpus.xml
 Filesize:  4.44 KB
 Downloaded:  3081 Time(s)


cacti_data_template_w32_cpu_load.xml
 Description:
Data template (single processor)

Download
 Filename:  cacti_data_template_w32_cpu_load.xml
 Filesize:  3.46 KB
 Downloaded:  2556 Time(s)


w32_query_cpu.pl.txt
 Description:
Perl script

Download
 Filename:  w32_query_cpu.pl.txt
 Filesize:  5.84 KB
 Downloaded:  4546 Time(s)

Back to top
DevilSun
Cacti User


Joined: 16 Jul 2004
Posts: 166
Location: Oregon

PostPosted: Fri Jul 16, 2004 2:38 pm    Post subject: Reply with quote

Graph screenshot


w32cpu.gif
 Description:
 Filesize:  7.97 KB
 Viewed:  30177 Time(s)

w32cpu.gif


Back to top
Sunksat
Guest





PostPosted: Wed Sep 08, 2004 2:05 pm    Post subject: Can't get the Graph to work... Reply with quote

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
Back to top
DevilSun
Cacti User


Joined: 16 Jul 2004
Posts: 166
Location: Oregon

PostPosted: Thu Sep 09, 2004 12:47 pm    Post subject: Reply with quote

Graphs


cacti_graph_template_w32_cpu_load_2_cpus.xml
 Description:
2 CPU graph

Download
 Filename:  cacti_graph_template_w32_cpu_load_2_cpus.xml
 Filesize:  10.89 KB
 Downloaded:  1932 Time(s)


cacti_graph_template_w32_cpu_load.xml
 Description:
1 CPU Graph

Download
 Filename:  cacti_graph_template_w32_cpu_load.xml
 Filesize:  7.47 KB
 Downloaded:  1807 Time(s)

Back to top
Sunksat



Joined: 09 Sep 2004
Posts: 2
Location: DK

PostPosted: Thu Sep 09, 2004 1:26 pm    Post subject: Reply with quote

Thx a bunch for the Graph template
Everything works fine now
Back to top
DevilSun
Cacti User


Joined: 16 Jul 2004
Posts: 166
Location: Oregon

PostPosted: Fri Sep 17, 2004 10:00 am    Post subject: Reply with quote

For 4 processors


w32_4cpu.gif
 Description:
Screenshot
 Filesize:  8.48 KB
 Viewed:  29836 Time(s)

w32_4cpu.gif



cacti_graph_template_w32_cpu_load_4_cpus.xml
 Description:
Graph Template

Download
 Filename:  cacti_graph_template_w32_cpu_load_4_cpus.xml
 Filesize:  17.66 KB
 Downloaded:  1807 Time(s)


cacti_data_template_w32_cpu_load_4_cpus.xml
 Description:
Data Template

Download
 Filename:  cacti_data_template_w32_cpu_load_4_cpus.xml
 Filesize:  6.35 KB
 Downloaded:  1532 Time(s)

Back to top
Guest






PostPosted: Thu Sep 23, 2004 10:50 am    Post subject: Reply with quote

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
Back to top
Guest






PostPosted: Thu Sep 23, 2004 2:49 pm    Post subject: Reply with quote

Which version are you using - been having this problem with a few different templates as well.

http://forums.cacti.net/viewtopic.php?t=4908
Back to top
Guest






PostPosted: Fri Sep 24, 2004 8:42 am    Post subject: Reply with quote

Im using 0.8.6, Windows 2000 Server, PHP

Could you help me ?

Thank you,

Alvaro
Back to top
DevilSun
Cacti User


Joined: 16 Jul 2004
Posts: 166
Location: Oregon

PostPosted: Fri Sep 24, 2004 10:12 am    Post subject: Reply with quote

I assume this is a Cacti 0.8.6 bug...the people that used it in here had it in before that came out, and it seems it has a few problems. I can try exporting now that I'm using 0.8.6 if you'd like...
Back to top
Guest






PostPosted: Mon Sep 27, 2004 8:11 am    Post subject: Reply with quote

Thank you !! if you can export will be wonderfull !

Al.
Back to top
DevilSun
Cacti User


Joined: 16 Jul 2004
Posts: 166
Location: Oregon

PostPosted: Mon Sep 27, 2004 11:00 am    Post subject: Reply with quote

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.


cacti_graph_template_w32_cpu_load.xml
 Description:
Graph template exported in 0.8.6

Download
 Filename:  cacti_graph_template_w32_cpu_load.xml
 Filesize:  4.03 KB
 Downloaded:  1294 Time(s)

Back to top
Guest






PostPosted: Mon Sep 27, 2004 12:30 pm    Post subject: Reply with quote

Thank you brother !!! works great !
Back to top
shreekarthik



Joined: 16 Sep 2004
Posts: 13

PostPosted: Wed Oct 20, 2004 3:49 pm    Post subject: Re: Reply with quote

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.
Back to top
DevilSun
Cacti User


Joined: 16 Jul 2004
Posts: 166
Location: Oregon

PostPosted: Wed Oct 20, 2004 5:30 pm    Post subject: Reply with quote

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.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 



Powered by phpBB © 2001, 2005 phpBB Group