IIS

Stay organized with collections Save and categorize content based on your preferences.

The Internet Information Services integration collects telemetry from your IIS web servers. The metrics provide connection information and also data on transferred bytes. The integration also collects information from access logs.

For more information on IIS, see the Internet Information Services documentation.

Before you begin

The Ops Agent version 2.15.0 introduces support for a new set of IIS metrics using the workload.googleapis.com/ prefix. You must configure the agent to collect these metrics, as described in Example configuration.

The Ops Agent has always supported a limited set of IIS metrics; these metrics use the agent.googleapis.com/iis/ prefix. No additional configuration is needed to collect these metrics on Windows VMs.

This document refers to the agent-prefixed metrics as the v1 metrics and to the workload-prefixed metrics as the v2 metrics. For tables of these metrics, see What is monitored.

Starting with the Ops Agent version 2.15.0, you can configure the agent to collect v1 metrics, v2 metrics, or both.

Prerequisites

To collect IIS telemetry, you must install the Ops Agent:

  • For metrics v1, install version 1.0.0 or higher.
  • For metrics v2, install version 2.15.0 or higher
  • For logs, install version 2.14.0 or higher.

This integration supports IIS versions 8.5 and 10.0.

Configure the Ops Agent for IIS

Following the guide to configure the Ops Agent, add the required elements to collect telemetry from IIS instances, and restart the agent.

Example configuration

The following command creates the configuration to collect and ingest telemetry for IIS and restarts the Ops Agent.

# This config gets merged with the built-in Ops Agent config, which already
# includes the v1 receiver in the default pipeline.
# Because the v2 receiver here uses a unique ID, it does not overwrite
# the default receiver and so both receivers will be active simultaneously
# during the test.

# Create a back up of the existing file so existing configurations are not lost.
Copy-Item -Path 'C:\Program Files\Google\Cloud Operations\Ops Agent\config\config.yaml' -Destination 'C:\Program Files\Google\Cloud Operations\Ops Agent\config\config.yaml.bak'

# Configure the Ops Agent.
Add-Content 'C:\Program Files\Google\Cloud Operations\Ops Agent\config\config.yaml' "
metrics:
  receivers:
    iis_v2:
      type: iis
      receiver_version: 2
  service:
    pipelines:
      iispipeline:
        receivers:
          - iis_v2
logging:
  receivers:
    iis_access:
      type: iis_access
  service:
    pipelines:
      iis:
        receivers:
        - iis_access
"

Stop-Service google-cloud-ops-agent -Force
Start-Service google-cloud-ops-agent* 

This receiver supports only the default W3C logging format.

Configure logs collection

To ingest access logs from IIS, you must create receivers for the logs and then create a pipeline for the new receivers.

To configure a receiver for your iis_access logs, specify the following fields:

Field Default Description
exclude_paths [] A list of filesystem path patterns to exclude from the set matched by include_paths.
include_paths ['C:\inetpub\logs\LogFiles\W3SVC1\u_ex*'] A list of filesystem paths to read by tailing each file. A wild card (*) can be used in the paths; for example, C:\inetpub\logs\LogFiles\W3SVC1\u_ex*.
type The value must be iis_access.
record_log_file_path false If set to true, then the path to the specific file from which the log record was obtained appears in the output log entry as the value of the agent.googleapis.com/log_file_path label. When using a wildcard, only the path of the file from which the record was obtained is recorded.
wildcard_refresh_interval 60s The interval at which wildcard file paths in include_paths are refreshed. Specified as a time interval parsable by time.ParseDuration, for example 30s or 2m. This property might be useful under high logging throughputs where log files are rotated faster than the default interval.

What is logged

The logName is derived from the receiver IDs specified in the configuration. Detailed fields inside the LogEntry are as follows.

iis_access logs contain the following fields in the LogEntry:

Field Type Description
httpRequest.referer string Contents of the Referer header
httpRequest.remoteIp string IP of the client that made the request
httpRequest.requestMethod string HTTP method
httpRequest.requestUrl string Request URL (typically just the path part of the URL)
httpRequest.serverIp string The server's IP and port that was requested
httpRequest.status number HTTP status code
httpRequest.userAgent string Contents of the User-Agent header
jsonPayload.sc_substatus number The substatus error code
jsonPayload.sc_win32_status number The Windows status code
jsonPayload.time_taken number The length of time that the action took, in milliseconds
jsonPayload.user string Authenticated username for the request
timestamp string (Timestamp) Time the request was received

Configure v1 metrics collection

The Ops Agent on a Microsoft Windows VM automatically collects IIS v1 metrics. No additional configuration is required. For information about collecting only v2 metrics, see Configure v2 metrics collection.

After you set up a new IIS instance, IIS might not immediately report any metrics. Using the Server Manager console that comes installed on Windows Server, you might see that your server has a status of Online - Performance Counters not started in the Manageability column.

One way to enable IIS to generate metrics is to right click on your IIS server in the Server Manager console and select Start Performance Counters. Your server should begin sending metrics to the Ops Agent.

Configure v2 metrics collection

To ingest v2 metrics from IIS, you must create receivers for the metrics that IIS produces and then create a pipeline for the new receivers.

To configure a receiver for your iis metrics, specify the following fields:

Field Default Description
collection_interval 60s A time.Duration value, such as 30s or 5m.
receiver_version Version of the metrics collected; use 2 to collect v2 metrics.
type This value must be iis.

By default, the v1 metrics are collected automatically. You can either augment the v1 metrics by additionally collecting v2 metrics, or you can override the v1 metrics to collect only v2 metrics.

  • To collect only v2 metrics, do the following:

    • Name your receiver iis.
    • Set the type field to iis.
    • Set the receiver_version field to 2.
    • Use this receiver in your default_pipeline pipeline. This configuration overrides the built-in configuration of the iis receiver.
  • To collect both v1 and v2 metrics, do the following:

    • Name your receiver something other than iis, like iis_v2.
    • Set the type field to iis.
    • Set the receiver_version to 2.
    • Use this receiver in your new pipeline. This configuration adds a v2 receiver rather than overriding the built-in receiver. The script in Example configuration uses this approach.

What is monitored

Starting with version 2.15.0, the Ops Agent can collect two different sets of metrics:

  • The v1 metrics: agent.googleapis.com/iis/.
  • The v2 metrics: workload.googleapis.com/.
V1 metrics

The following table provides the list of v1 metrics that the Ops Agent collects from the IIS instance.

The "metric type" strings in this table must be prefixed with agent.googleapis.com/iis/. That prefix has been omitted from the entries in the table.

Metric type Launch stage
Display name
Kind, Type, Unit
Monitored resources
Description
Labels
current_connections GA
IIS open connections
GAUGEDOUBLE1
aws_ec2_instance, gce_instance
Currently open connections to IIS. Sampled every 60 seconds.
network/transferred_bytes_count GA
IIS transferred bytes
CUMULATIVEINT64By
aws_ec2_instance, gce_instance
Network bytes transferred by IIS. Sampled every 60 seconds.
direction: Direction (sent, received)
new_connection_count GA
IIS connections
CUMULATIVEINT641
aws_ec2_instance, gce_instance
Connections opened to IIS. Sampled every 60 seconds.
request_count GA
IIS requests
CUMULATIVEINT641
aws_ec2_instance, gce_instance
Requests made to IIS. Sampled every 60 seconds.
http_method: Http method (post, put, get, delete, option, trace, head)

Table generated at 2022-09-30 02:55:28 UTC.

V2 metrics

The following table provides the list of v2 metrics that the Ops Agent collects from the IIS instance.

Metric type 
Kind, Type
Monitored resources
Labels
workload.googleapis.com/iis.request.count
CUMULATIVEINT64
gce_instance
request
workload.googleapis.com/iis.request.rejected
CUMULATIVEINT64
gce_instance
 
workload.googleapis.com/iis.request.queue.count
GAUGEINT64
gce_instance
 
workload.googleapis.com/iis.request.queue.age.max
GAUGEINT64
gce_instance
 
workload.googleapis.com/iis.network.file.count
CUMULATIVEINT64
gce_instance
direction
workload.googleapis.com/iis.network.blocked
CUMULATIVEINT64
gce_instance
 
workload.googleapis.com/iis.network.io
CUMULATIVEINT64
gce_instance
direction
workload.googleapis.com/iis.connection.attempt.count
CUMULATIVEINT64
gce_instance
 
workload.googleapis.com/iis.connection.active
GAUGEINT64
gce_instance
 
workload.googleapis.com/iis.connection.anonymous
CUMULATIVEINT64
gce_instance
 
workload.googleapis.com/iis.thread.active
GAUGEINT64
gce_instance
 
workload.googleapis.com/iis.uptime
GAUGEINT64
gce_instance
 

Sample dashboard

To view your IIS metrics, you must have a chart or dashboard configured. Cloud Monitoring provides a library of sample dashboards for integrations, which contain preconfigured charts. For information about installing these dashboards, see Installing sample dashboards.

Verify the configuration

This section describes how to verify that you correctly configured the IIS receiver. It might take one or two minutes for the Ops Agent to begin collecting telemetry.

To verify that the logs are ingested, go to the Logs Explorer and run the following query to view the IIS logs:

resource.type="gce_instance"
logName=("projects/PROJECT_ID/logs/iis_access")

To verify that the metrics are ingested, go to Metrics Explorer and run one of the following queries in the MQL tab.

  • For v1 metrics:

    fetch gce_instance
    | metric 'agent.googleapis.com/iis/request_count'
    | every 1m
    
  • For v2 metrics:

    fetch gce_instance
    | metric 'workload.googleapis.com/iis.request.count'
    | every 1m
    

What's next

For a walkthrough on how to use Ansible to install the Ops Agent, configure a third-party application, and install a sample dashboard, see the Install the Ops Agent to troubleshoot third-party applications video.