Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Tue Jul 16, 2019 9:36 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: W32 System via WMI
PostPosted: Mon Oct 18, 2004 11:23 am 
Offline
Cacti User

Joined: Fri Jul 16, 2004 1:59 pm
Posts: 166
Location: Oregon
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...


Attachments:
File comment: Screenshot
screen.gif
screen.gif [ 7.96 KiB | Viewed 26312 times ]
File comment: Perl script
w32_query_system.pl.txt [3.4 KiB]
Downloaded 1902 times
File comment: Graph template
cacti_graph_template_w32_system_statistics.xml [17.78 KiB]
Downloaded 1602 times
Top
 Profile  
 
 Post subject: errors when executing wmi script
PostPosted: Mon Oct 18, 2004 4:10 pm 
Offline
User avatar

Joined: Wed Apr 03, 2002 8:48 am
Posts: 32
Location: Mississauga, Ontario
DevilSun please excuse a script fools ignorance :o 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.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 19, 2004 9:48 am 
Offline
Cacti User

Joined: Fri Jul 16, 2004 1:59 pm
Posts: 166
Location: Oregon
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.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 19, 2004 10:48 am 
Offline
User avatar

Joined: Wed Apr 03, 2002 8:48 am
Posts: 32
Location: Mississauga, Ontario
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.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 19, 2004 4:23 pm 
Offline
Cacti User

Joined: Fri Jul 16, 2004 1:59 pm
Posts: 166
Location: Oregon
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".


Top
 Profile  
 
 Post subject: Re:
PostPosted: Tue Oct 19, 2004 5:13 pm 
Offline

Joined: Thu Sep 16, 2004 12:32 pm
Posts: 13
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.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 19, 2004 5:27 pm 
Offline
User avatar

Joined: Wed Apr 03, 2002 8:48 am
Posts: 32
Location: Mississauga, Ontario
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.

:o

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


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 20, 2004 8:48 am 
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?


Top
  
 
 Post subject:
PostPosted: Wed Oct 20, 2004 10:09 am 
Offline
Cacti User

Joined: Fri Jul 16, 2004 1:59 pm
Posts: 166
Location: Oregon
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.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 14, 2007 4:22 pm 
Offline

Joined: Sat Apr 28, 2007 7:24 pm
Posts: 8
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


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 14, 2007 5:05 pm 
Offline
Cacti User

Joined: Fri Feb 16, 2007 11:37 am
Posts: 372
Location: Emeryville, CA
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

_________________
Cacti Version - 0.8.7b
Plugin Architecture - 2.2 Beta
Poller Type - CMD.php
Server Info - Linux 2.6.9-78.0.1.ELsmp
Web Server - Apache/2.0.52 (Red Hat)
PHP - 4.3.9
MySQL - 4.1.22
RRDTool - 1.2.23
SNMP - 5.1.2
Plugins
    Global Plugin Settings (settings - v0.5)
    SuperLinks (superlinks - v0.72)
    Host Info (hostinfo - v0.2)
    Report Creator (reports - v0.3)
    Update Checker (update - v0.4)
    Realtime for Cacti (realtime - v0.35)
    Cacti Log View (clog - v1.1)
    RRD File Cleaner (rrdclean - v0.36)
    Network Discovery (discovery - v0.9)
    Uptime (uptime - v0.4)


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 14, 2007 6:26 pm 
Offline

Joined: Sat Apr 28, 2007 7:24 pm
Posts: 8
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.


Top
 Profile  
 
 Post subject: CISCO SCE 1000 CPU (3) load template
PostPosted: Fri Mar 20, 2009 5:34 am 
Offline

Joined: Fri Dec 05, 2008 5:49 am
Posts: 34
Location: Vilnius, Lithuania
Today I had a need of that and couldn't find anywhere else so created it mysql.


Attachments:
cacti_graph_template_cisco_sce_-_cpu_usage.xml [26.11 KiB]
Downloaded 688 times
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: Google [Bot] and 3 guests


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