Skip to main content

Microsoft IIS Server Restapi

Overview​

Internet Information Services (IIS, formerly Internet Information Server) is an extensible web server software created by Microsoft for use with the Windows NT family. IIS supports HTTP, HTTP/2, HTTPS, FTP, FTPS, SMTP and NNTP.

Monitoring Connector assets​

Monitored objects​

  • ApplicationPools
  • Websites

Discovery rules​

Rule nameDescription
App-IIS-Restapi-ApplicationPools-NameDiscover application pools hosted by your IIS server
App-IIS-Restapi-Websites-NameDiscover websites hosted by your IIS server

Monitored metrics​

Metric nameDescription
statusStatus of the application pool.
applicationpool.requests.persecondNumber of requests per second by application pools. Unit: requests/second

Prerequisites​

IIS configuration​

To use this Monitoring Connector, you must enable the Microsoft IIS Administration API. Microsoft provides an official documentation to achieve this: https://docs.microsoft.com/en-us/iis-administration/

Setup​

  1. Install the Centreon package on every Centreon poller expected to monitor IIS resources:
yum install centreon-plugin-Applications-Webservers-Iis-Restapi
  1. On the Centreon Web interface, install the 'Microsoft IIS Server Restapi' Centreon Monitoring Connector on the Configuration > Monitoring Connector Manager page

Configuration​

  • Log into Centreon and add a new Host through "Configuration > Hosts".
  • Apply the template App-Webserver-IIS-Restapi-custom and configure all the Macros :
MandatoryNomDescription
XIISAPIPORTPort used. Default is 55539
XIISAPIPROTOProtocol used. Default is https
XIISAPIUSERNAMEUsername to access to the API.
XIISAPIPASSWORDPassword to access to the API.
XIISTOKENAPIToken to access to the API.
IISAPIEXTRAOPTIONSAny extra option you may want to add to the command (eg. a --verbose flag)

By default IISAPIEXTRAOPTIONS contains : --http-backend=curl --curl-opt="CURLOPT_SSL_VERIFYPEER => 0" options to use the curl backend and to ignore the validity's check of the SSL certificate.

Use the discovery module to add the monitoring of your application pools and websites, Go to Configuration > Services > Scan to perform a scan

FAQ​

How do I test my configuration through the CLI and what do the main parameters stand for?​

Once the Centreon plugin installed, you can test it logging with the centreon-engine user:

/usr/lib/centreon/plugins/centreon_iis_restapi.pl \ 
--plugin=apps::iis::restapi::plugin \
--mode=websites \
--hostname='www.int.centreon.com' \
--port='55539' \
--proto='https' \
--api-username='John.Doe' \
--api-password='6fbadZEJbsLG' \
--api-token='ZHppZCWPzREgSb9SDYOegsY0_D4KJKgZ5q8QavEWBPmmi8fgt2-8Cw' \
--http-backend='curl' \
--curl-opt="CURLOPT_SSL_VERIFYPEER => 0" \
--filter-name='^www$' \
--critical-status='%{status} !~ /starting|started/' \
--verbose

The command above checks the status and the usage of the Website www (--filter-name=^www$) hosted by the IIS server www.int.centreon.com (--hostname='www.int.centreon.com'). It uses an API username (--api-username='John.doe'), API password (--api-password='6fbadZEJbsLG') and API token (--api-token='ZHppZCWPzREgSb9SDYOegsY0_D4KJKgZ5q8QavEWBPmmi8fgt2-8Cw') generated from the IIS Administration API. The curl backend is used (--http-backend='curl') and the SSL certificate validity is not checked (--curl-opt="CURLOPT_SSL_VERIFYPEER => 0").

This command would trigger a CRITICAL alert if:

  • the status of the website is different of starting or started.

Expected command output is shown below:

OK: Website 'www' traffic in: 5.41 Kb/s, traffic out: 59.74 Kb/s, current connections: 0, total connections: 8.05/s | 'www#website.traffic.in.bitspersecond'=5407.86206896552b/s;;;0; 'www#website.traffic.out.bitspersecond'=59744b/s;;;0; 'www#website.connections.current.count'=0;;;0; 'www#website.connections.total.persecond'=8.05/s;;;0;
Website 'www' traffic in: 5.41 Kb/s, traffic out: 59.74 Kb/s, current connections: 0, total connections: 8.05/s

Some thresholds can also be set on metrics with options --warning-* and --critical-*.

The available thresholds as well as all the options that can be used with this Plugin can be displayed by adding the --help parameter to the command:

/usr/lib/centreon/plugins/centreon_iis_restapi.pl \ 
--plugin apps::iis::restapi::plugin \
--mode websites \
--help

You can display all the modes that come with the Plugin with the command below:

/usr/lib/centreon/plugins//centreon_iis_restapi.pl \
--plugin=apps::iis::restapi::plugin \
--list-mode

Why do I get the following error:​

UNKNOWN: Cannot load module 'Net::Curl::Easy'​

This error message means that a Perl library required to use the curl backend is missing.

In order to fix this issue, install the Net::Curl::Easy Perl library using the following command:

yum install perl-Net-Curl

UNKNOWN: curl perform error : Couldn't connect to server​

This error message means that the Centreon Plugin couldn't successfully connect to the IIS API. Check that no third party device (such as a firewall) is blocking the request. A proxy connection may also be necessary to connect to the API. This can be done by using the --proxyurl option in the command.