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 System via WMI

 
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: Mon Oct 18, 2004 11:23 am    Post subject: W32 System via WMI Reply with quote

Gets System Calls/sec, Context Switches/sec, Threads, Processes via WMI...

Usage:
Code:
perl <path_cacti>/scripts/w32_query_system.pl <hostname>


Tested on Windows 2003 Server platforms...



screen.gif
 Description:
Screenshot
 Filesize:  7.96 KB
 Viewed:  9409 Time(s)

screen.gif



w32_query_system.pl.txt
 Description:
Perl script

Download
 Filename:  w32_query_system.pl.txt
 Filesize:  3.4 KB
 Downloaded:  876 Time(s)


cacti_graph_template_w32_system_statistics.xml
 Description:
Graph template

Download
 Filename:  cacti_graph_template_w32_system_statistics.xml
 Filesize:  17.78 KB
 Downloaded:  643 Time(s)

Back to top
eddy



Joined: 03 Apr 2002
Posts: 31
Location: Mississauga, Ontario

PostPosted: Mon Oct 18, 2004 4:10 pm    Post subject: errors when executing wmi script Reply with quote

DevilSun please excuse a script fools ignorance but when I try to run your script on my Win2K Cacti server like so:

\Apache\htdocs\cacti\scripts>perl w32_query_OperatingSystem.pl localhost index

I get the following error message back:

Can't locate loadable object for module Win32::OLE in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at w32_query_system.pl line 4
Compilation failed in require at w32_query_system.pl line 4.
BEGIN failed--compilation aborted at w32_query_system.pl line 4.

What am I missing here?

P.S. thanks for the scripts.
Back to top
DevilSun
Cacti User


Joined: 16 Jul 2004
Posts: 166
Location: Oregon

PostPosted: Tue Oct 19, 2004 9:48 am    Post subject: Reply with quote

Now that's interesting...to me that seems like a Perl error, such as it doesn't have the OLE libraries or something. Unfortunately I can't help much with that error, being as this is the first time I've ever used Perl in depth in any environment, let alone on a windows platform.

This is my configuration and I haven't had any problems with it as far as that's concerned:
Win2003 w/ IIS6
Cacti 0.8.6
MySQL 4.0.20a
PHP 4.3.7.7
ActivePerl 5.8.4.810

Really sounds like you are missing a Perl library or two. In my C:\Perl\site\lib directory, I have a Win32 subdirectory with an OLE.pm in it, and also within that, a OLE directory. I'd say it's not recognizing them or they're missing.
Back to top
eddy



Joined: 03 Apr 2002
Posts: 31
Location: Mississauga, Ontario

PostPosted: Tue Oct 19, 2004 10:48 am    Post subject: Reply with quote

Thanks for the prompt reply.
I solved my problem by unistalling and reinstalling ActivePerl-5.8.4.810.

Now however when I run \perl w32_query_system.pl localhost I get this responce:

Check the computer and class name.
No information was found on the specified class!

Any ideas?

BTW if I run \perl w32_query_operatingsystem.pl I get valid data returned.
Back to top
DevilSun
Cacti User


Joined: 16 Jul 2004
Posts: 166
Location: Oregon

PostPosted: Tue Oct 19, 2004 4:23 pm    Post subject: Reply with quote

What OS are you querying?

The script I posted I know works on Win2003, but probably not many others. It's specifically looking at the "Win32_PerfFormattedData_PerfOS_System" class in \root\cimv2, and looking for "Threads,Processes,SystemCallsPersec,ContextSwitchesPersec".
Back to top
shreekarthik



Joined: 16 Sep 2004
Posts: 13

PostPosted: Tue Oct 19, 2004 5:13 pm    Post subject: Re: Reply with quote

Hi Devilsun,
The program runs on the command prompt and gives all the outputs after talking to WMI but when I try to graph it using cacti I am getting the following error in the cacti log file.

10/19/2004 03:12:37 PM - CMDPHP: Poller[0] Host[0] CMD: perl C:\Apache2\htdocs\cacti/scripts/w32_query_system.pl, output: U
10/19/2004 03:12:37 PM - CMDPHP: Poller[0] Host[0] WARNING: Result from CMD not valid. Partial Result: Display information

My OS is Windows XP. Am I missing something?

Thanks,
Jaya.
Back to top
eddy



Joined: 03 Apr 2002
Posts: 31
Location: Mississauga, Ontario

PostPosted: Tue Oct 19, 2004 5:27 pm    Post subject: Reply with quote

DevilSun I am running the query against a Win2K server and you are correct the WMI query does not work for Win2K.

I have found another script:w32_query_operatingsystem.pl that will run and I can get memory information when I run the script from the command prompt, but it fails to update the rrd thus no data in the graph.



Thanks for the help I'll keep plugging away and maybe I'll get lucky and find a solution that works.
Back to top
Guest






PostPosted: Wed Oct 20, 2004 8:48 am    Post subject: Reply with quote

I have tried to import this script into cacti v8.6b and nothing happens when i select save the page refreshes and there is no text stating what has been imported etc. This is also the case with the SQl server script in an earlier post, but havent had any problems importing any other scripts

Any ideas?
Back to top
DevilSun
Cacti User


Joined: 16 Jul 2004
Posts: 166
Location: Oregon

PostPosted: Wed Oct 20, 2004 10:09 am    Post subject: Reply with quote

I haven't been able to use the import file feature for a few versions...it doesn't do anything it seems; however pasting the contents of the file into the text box and importing seems to have always worked for me. Little more work, but at least it works -- I believe it's a cacti 0.8.6x problem that should be fixed soon but am not sure.
Back to top
otherguy



Joined: 28 Apr 2007
Posts: 5

PostPosted: Mon May 14, 2007 4:22 pm    Post subject: Reply with quote

I am randomly getting cactid failures and gaps on my graphs after adding this script to about 60 hosts. It seems to runs fine if from the command line, but every few polling cycles I get something like this in my logs:

05/14/2007 10:18:09 AM - CACTID: Poller[0] Host[21] DS[963] WARNING: Result from SCRIPT not valid. Partial Result: ...
05/14/2007 10:18:09 AM - CACTID: Poller[0] Host[21] ERROR: The POPEN timed out
05/14/2007 10:18:09 AM - CACTID: Poller[0] Host[21] ERROR: One or more of the file descriptor sets specified a file descriptor that is not a valid open file descriptor.

Occasionally cactid hangs completely and I have to kill the process. Because the failures are so intermittent I am not sure if the problem is with the script or something else.

Where I can look to get more information about what is happening? I've been trying to find out what the "file descriptor" error means but I haven't had any luck so far.

I'm running Cacti 0.8.6j on Windows with Perl 5 and mysql 5.0.37
Back to top
apperrault
Cacti User


Joined: 16 Feb 2007
Posts: 359
Location: Emeryville, CA

PostPosted: Mon May 14, 2007 5:05 pm    Post subject: Reply with quote

Hey OtherGuy, how did you get this graph template to import? I have tried two different times, and I keep getting XML Parse Errors.

Any assistance would be greatly appreciated.

app
Back to top
otherguy



Joined: 28 Apr 2007
Posts: 5

PostPosted: Mon May 14, 2007 6:26 pm    Post subject: Reply with quote

I don't know much about the xml errors, but from reading other people's comments I gather that they could happen when you try to import a template that has been created from a newer version. What version of cacti are you running?

FYI- I started noticing more weird issues after I had this script running for a while. In addition to the errors I already posted, MySQL stopped working after another hour or so, reporting "Too many connections" and all sorts of other nasty errors. I had to restart the server and wait about 30 minutes for it to begin working again. I have disabled this script until I have more time to look at it.
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
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group