W32 IIS W3SVC Perl Script via WMI

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

DevilSun
Cacti User
Posts: 166
Joined: Fri Jul 16, 2004 1:59 pm
Location: Oregon

W32 IIS W3SVC Perl Script via WMI

Post by DevilSun »

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! (Exchange, etc).

Code: Select all

perl <path_cacti>/scripts/w32_iis_query_w3svc.pl <hostname> get CurrentConnections,CurrentAnonymousUsers,CurrentNonAnonymousUsers <instance>
<instance> is the name of the website instance shown in the IIS Manager, however "_Total" is a great one to use if you don't want to break up graphs for different sites.

Don't ask me how and where Microsoft comes up with these numbers...

Enjoy!
Attachments
cacti_data_template_iis_www_connections.xml
Data template
(6.04 KiB) Downloaded 1273 times
cacti_graph_template_iis_www_connections.xml
Graph template
(14.96 KiB) Downloaded 1705 times
Screenshot
Screenshot
iis_w3svc.gif (7.86 KiB) Viewed 22776 times
DevilSun
Cacti User
Posts: 166
Joined: Fri Jul 16, 2004 1:59 pm
Location: Oregon

Post by DevilSun »

Whoops, forgot the script...
Attachments
w32_iis_query_w3svc.pl.txt
Perl Script
(5.84 KiB) Downloaded 1931 times
Ghandi
Cacti User
Posts: 73
Joined: Tue May 04, 2004 5:09 am
Location: Graz / Austria

Post by Ghandi »

hi devilsun, thanks for this great idea of script... but i have one problem/question..

i have import the data and the graph template.. i have copied the script to my script folder and modified the path in the data input methods field...

the graphs will be shown, but no data :( only -1#. i would like to fiew a win2000 server with iis wmi is activated.

i use the IP adress in the hostname field, and in the instance field i put the complete url (www.xxx.xx) without http://

uses wmi another port as snmp? because my server is behind a firewall..


greetings and thanks!
haimlevi

can't import

Post by haimlevi »

is there some trick in importing templates ?

I went to the import template, browse to the xml file and press create ...

but I cannot see any new template :-(

please help ...
DevilSun
Cacti User
Posts: 166
Joined: Fri Jul 16, 2004 1:59 pm
Location: Oregon

Ghandi...

Post by DevilSun »

All of my perl scripts were written and tested on Win2003 Server boxes, and I'm not sure if they're compatible as far as class names with Win2000 server boxes or not; they should be.

Ghandi, try running the Perl script manually and seeing what you get back. This is how I test the scripts...open command prompt on windows box with perl installed, go to the cacti scripts directory, then run

perl w32_iis_query_w3svc.pl webserver browse
- or -
perl w32_iis_query_w3svc.pl webserver index
- or -
perl w32_iis_query_w3svc.pl webserver get CurrentConnections _Total

That should return you the full set of items for the class the script uses, which is "Win32_PerfFormattedData_W3SVC_WebService". That'll also tell you the instance names and all that, otherwise it should error out. If it says something about can't find server or class name, make sure you have access to view WMI data (by querying "Win32_Processor" class -- make copy of this script, open it, change class to Win32_Processor and run index on it). If WMI works but you still get class errors, there is a chance the class I'm referencing is a Win2003 / IIS6 only performance class.
DevilSun
Cacti User
Posts: 166
Joined: Fri Jul 16, 2004 1:59 pm
Location: Oregon

haimlevi...

Post by DevilSun »

I haven't had anyone say anything, and it looks like Ghandi got it installed so I don't think there is anything wrong with it. The scripts/templates were all done from 0.8.5a...not sure what's wrong for ya.
Ghandi
Cacti User
Posts: 73
Joined: Tue May 04, 2004 5:09 am
Location: Graz / Austria

Post by Ghandi »

hi,

i think your'e right, i can access the wmi, on the index command, i get the Processor Information back, is there a chance to find out, which class i must use for win2000 server?

thanks for your help :)
Scratty

Post by Scratty »

It doesn't work with Win2000 just Win2003.
Ghandi
Cacti User
Posts: 73
Joined: Tue May 04, 2004 5:09 am
Location: Graz / Austria

Post by Ghandi »

also no chance for me make this run, before i install win2003 on our webserver?! :-?

bad...
DevilSun
Cacti User
Posts: 166
Joined: Fri Jul 16, 2004 1:59 pm
Location: Oregon

Post by DevilSun »

Yeah sorry I did some searching and there is no WMI information for anything before IIS 5.1. I believe 5.1 is XP, so XP and higher should work...but 2003 for sure.

You can get this information via SNMP I believe. Have you tried that? I have the Win2003 MIBs, but not the 2000 ones.

Here are the 2000 ones from Microsoft -- Link.

Looks like 1.3.6.1.4.1.311.1.7.3 is the oid tree you want...
Ghandi
Cacti User
Posts: 73
Joined: Tue May 04, 2004 5:09 am
Location: Graz / Austria

Post by Ghandi »

great!

thanks for your BIG help! ;) i get the mibs, ok, now its on my to create stats with this mibs...

thanks again! ;)
Guest

Post by Guest »

I cannot seem to get this to work.

Can someone provide a simple explanation on how to go about installing this stuff

I imported the graph data and data xml's and i added the .pl scripts to the cacti/scripts folder, and it doesn't graph anything for me. I get a graph but no data ever appears. I'm very new to cacti so I'm not exactly sure I'm adding the new template correctly.

Can someone give some quick instructions so i can assure I'm doing that part right?

Thanks i appreciate it.
Jtb
Posts: 30
Joined: Thu Aug 19, 2004 8:13 am
Location: Germany
Contact:

Post by Jtb »

Lackatee wrote:I cannot seem to get this to work.

Can someone provide a simple explanation on how to go about installing this stuff

I imported the graph data and data xml's and i added the .pl scripts to the cacti/scripts folder, and it doesn't graph anything for me. I get a graph but no data ever appears. I'm very new to cacti so I'm not exactly sure I'm adding the new template correctly.

Can someone give some quick instructions so i can assure I'm doing that part right?
have you tried to just execute the perl-file? -> First check that the script works correctly
Jens
antondw
Posts: 1
Joined: Sat Aug 28, 2004 12:31 pm

Post by antondw »

hi when i try it says

D:\webroot\cacti\scripts>perl w32_iis_query_w3svc.pl webserver browse
Unable to talk to WMI for webserver.

on windows 2003?

do i have to enable wmi or something like that?

in the service wmi is started :cry:
Jtb
Posts: 30
Joined: Thu Aug 19, 2004 8:13 am
Location: Germany
Contact:

Post by Jtb »

check http://www.raxnet.net/board/viewtopic.php?p=16705

I run in that error when I tested this script a few days ago..
Jens
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests