How to monitor IIS with Monitis

How to monitor IIS with MonitisThe march to monitor everything from Monitis has reached a new frontier: Monitoring IIS. The IIS monitoring scripts uses the Monitis PowerShell module, and demonstrate how to get IIS performance statistics and upload it them to custom Monitis monitors.

What We’re Looking For

So what IIS performance metrics does this script handle?  Most bosses are business oriented, and so we’re going to watch the stats that are important to the bottom line:  Traffic and what it does to the server.

In this script, each of these metrics is represented by the some properties:

  • Attendance – number of connections, number of anonymous and non-anonymous users on website at current time and per second.
  • Server load measures – HTTP-requests (GET, POST, PUT, DELETE, OPTIONS, MKCOL, PUT, COPY, SEARCH, MOVE, LOCK), logon and connection attempts and CGI requests per second and their total amount. Also total not-found errors.
  • Traffic – amount of sent, received and reciprocal transferred bytes and files per second and  total.

Getting started

Before it executing make sure that you have permissions to execute scripts. Type “Get-ExecutionPolicy” in your PowerShell console. Script execution policy must set into RemoteSigned or Restricted. If not, type “Set-Execution-Policy RemoteSigned” or “Set-Execution-Policy Restricted”. Also, please make sure your module is copied to folder named “Monitis” underneath “MyDocuments\WindowsPowerShell\Modules”.  For this script, you should also ensure you’re running as an administrator.

But to execute it you need specify a few parameters: your API Key and API secret key from your monitis account at the top of the script.

Copy the script folder into any place on your server system where IIS works, or just open up the Windows PowerShell ISE and change the things you need to change and press F5.  You can execute it manually or create scheduled task. In first case run Windows PowerShell with as admin.  In second case you must run Windows Task Scheduler and create task which will be execute script by schedule. Task must have a highest priority (permissions).

The Script does following:

  • It queries performance data stored in WMI “Win32_PerfFormattedData_W3SVC_WebService” and picks up some helpful properties.
  • It creates monitor for each of the performance metrics
  • It uploads the values to monitis.


The full script collects the following metrics:

Current Connections; Current Non Anonimous Users; Current Anonimous Users; Total Bytes Sent; Total Bytes Received; Total Bytes Transferred; Total Get Requests; Total Post Requests; Total Not Found Errors; Anonymous Users Per sec; Bytes Received Per sec; Bytes Sent Per sec; Bytes Total Per sec; Files Received Per sec; Files Sent Per sec; Files Per sec; Total Files Received; Total Files Sent; Total Files Transferred; CGI Requests Per sec; Current CGI Requests; Connection Attemtps Per sec; Head Requests Per sec; Lock Requests Per sec; Logon Requests Per sec; Delete Requests Per sec; Mkcol Requests Per sec; Move Requests Per sec; Options Requests Per sec; Post Requests Per sec; Get Requests Per sec; Put Requests Per sec; Search Requests Per sec; Copy Requests Per sec; Service Uptime; Total CGI Requests; Total Copy Requests; Total Delete Requests; Total Head Requests; Total Lock Requests; Total Logon Attempts; Total Mkcol Requests; Total Move Requests; Total Options Requests; Total Put Requests

Example screenshots

We have made some screenshots after a week of monitoring our IIS.“Current connections count” chart. Shows how many connections at current time on specific website on IIS.

How to monitor IIS with Monitis

“Current connections count”

“Current anonymous users” chart. Shows how many anonymous users are on website at current time.

How to monitor IIS with Monitis

“Current anonymous users”

“Total bytes transferred by site” chart. Shows how many bytes transferred to and from website.

How to monitor IIS with Monitis

“Total bytes transferred by site”


“Total POST requests” chart. Shows total amount of POST requests to website.

How to monitor IIS with Monitis

“Total POST requests”


“Total ‘Not Found’ errors on site” chart. Shows how many “Not Found” errors were on website.

How to monitor IIS with Monitis

“Total ‘Not Found’ errors on site”


You can find the source codes in our exchange at Github. Feel free to experiment on the code and let us know what you think!