Do you want to monitor what is a number of current users on your website? You can use Win32_PerfRawData_W3SVC_WebService object.
1. Get current annonymous users
'n' is number of AnonymousUsers for whole server. You can use web site name instead of "_Total".
But there is no good idea to query this value each time on hi-loaded servers. You can use next algorithm to cache this number in application dictionary for 30 second period.
2. List more values for each web site :
Win32_PerfRawData_W3SVC_WebService object contains many values. You can get a list of these values using getObjectText_ method:
Next code is a list of all local web-sites as an HTML table with basic IIS load info
3. Connect to another computer
First method is using wmi URL - simple append computer name to path:
You cannot access to a second computer with other user account using GetObject. Next source code uses ConnectServer method of SWbemLocator object.
for 'Get number of current users and other IIS performance values.' article
Copyright and use this code
The source code on this page and other samples at http://www.motobit.com/tips/ are a free code, you can use it as you want: copy it, modify it, use it in your products, ...
If you use this code, please:
1. Leave the author note in the source.
2. Link this sample from you page.
<A Href="http://www.motobit.com/tips/detpg_wmi-iis-performance/" Title="Short working wmi samples to show several IIS performance monitoring values - Current annonymous users, isapi extensions, etc." >Get number of current users and other IIS performance values.</A>
© 1996 - 2013 Antonin Foller, Motobit Software | About, Contacts | (Find us on Google+)
Partner sites: Search Czech Last minute Zajezdy Obsah na mobil Hry na mobil Java Hry Print-shop Affiliate programy
|IISTracer - IIS ISAPI real-time monitor IISTracer is a real-time monitoring tool for Microsoft IIS, which will show/log you what is happenning on IIS server right now. It let's you reveal problems with long-running scripts (.asp, .cgi, cfm...), hang-up states and low resource situations and lets you stop long-running requests (uploads/downloads).||ActiveX User account Manager - Set of simple objects for creating, deleting, and managing user accounts, groups, servers and domains in the Windows NT environment.|
|Active log file - Hi-performance text file logging for ASP/VBS/VBA applications. Lets you create daily/weekly/monthly log files with variable number of logged values and extra timing and performance info.||ActiveX windows registry editor - Intuitive, easy to use COM interface to windows registry. Set of classes to read/enumerate/modify windows registry keys and values from ASP, VBS and T-SQL.|
|ActiveX/ASP Multi Dictionary object - Free-threaded hi-speed dictionary algorithm with unique/nonunique keys (map/multimap). Connect to another dictionary object in the same process. Lock and Unlock methods to synchronize tasks (application scope). Share ASP Application/Session objects.||Export DBF/MDB from ASP - Conversion from recordset to MDB/DBF. Direct binary output of MDB or DBF files from ASP pages with one row of code.|
|Pure-ASP upload - lets you upload files using Pure ASP VBS code (using multipart/form-data and input type=file).||ByteArray - Works with safearray binary data (VT_UI1 | VT_ARRAY) - save/restore binary data from disk, find, work with code pages, convert to string/hexstring(SQL).|
|WebChecker - Checks http, https, ftp and gopher internet connections in regular intervals. Lets you monitor web site functionality (uptime). Enables restart or notification on problems.||HTTPLog ISAPI filter - Lets you log incomming/outgoing http header and document data to separate files. Monitor of IIS service input/output.|