The Observability Blog

Categories:
  • Uncategorized

How to Monitor Microsoft IIS with OpenTelemetry

by Miguel Rodriguez on
May 14, 2022

The OpenTelemetry members at observIQ are excited to add Microsoft IIS metric monitoring support to OpenTelemetry! You can now easily monitor your IIS web servers with the oIQ OpenTelemetry Collector. 

You can add the IIS metric receiver to any OpenTelemetry collector. This post demonstrates just one configuration for shipping metrics with OpenTelemetry components. This configuration and many other observIQ OpenTelemetry configurations are available in the oIQ Opentelemetry Collector.

Installation and configuration is simple, but you may want to refine your configuration to your needs once the metric receiver is up and running. The configuration is easily editable as a yaml file. You can find more documentation, example configurations for other receivers, and observability tools on GitHub and on our blog.

What Matters for Microsoft IIS Metrics

Microsoft IIS is a general purpose platform for web servers and applications. The possible scale and scope of IIS monitoring is wide, so the specific metrics that matter most to you might vary. Uptime, data flow, and request metrics are the most commonly monitored. 

Step 1: Installing the Collector

The oIQ OpenTelemetry Collector can be installed on Windows, MacOS, and Linux using single line install commands that can be copied directly from GitHub. Be sure that you have administrator privileges on the device or VM that you are running the installation on. Since Microsoft IIS is a Windows-based product, only the Windows installation steps are shown below.

msiexec /i "https://github.com/observIQ/observiq-otel-collector/releases/latest/download/observiq-otel-collector.msi" /quiet

Step 2: Prerequisites and Authentication Credentials

In the following example, we are using Google Cloud Operations as the destination. However, OpenTelemtry offers exporters for many destinations. Check out the list of exporters here

Setting up Google Cloud exporter prerequisites:

If running outside of Google Cloud (On prem, AWS, etc) or without the Cloud Monitoring scope, the Google Exporter requires a service account.

Create a service account with the following roles:

  • Metrics: roles/monitoring.metricWriter
  • Logs: roles/logging.logWriter

Create a service account JSON key and place it on the system that is running the collector.

Windows

In this example, the key is placed at C:/observiq/collector/sa.json.

Set the GOOGLE_APPLICATION_CREDENTIALS with the command prompt setx command.

Run the following command

setx GOOGLE_APPLICATION_CREDENTIALS "C:/observiq/collector/sa.json" /m

Restart the service using the services application.

Step 3: Configure the Microsoft IIS Receiver

After installation, the config file for the collector can be found at:

Windows: C:\Program Files\observIQ OpenTelemetry Collector\config.yaml 

MacOS/Linux: /opt/observiq-otel-collector/config.yaml

Edit the config file with the following configuration:

receivers:
  iis:
    collection_interval: 60s

processors:
  # Resourcedetection is used to add a unique (host.name)
  # to the metric resource(s), allowing users to filter
  # between multiple agent systems.
  resourcedetection:
    detectors: ["system"]
    system:
      hostname_sources: ["os"]

  # Used for Google generic_node mapping.
  resource:
    attributes:
    - key: namespace
      value: "iis"
      action: upsert
    - key: location
      value: "global"
      action: upsert

  normalizesums:

  batch:

exporters:
  googlecloud:
    retry_on_failure:
      enabled: false
    metric:
      prefix: workload.googleapis.com
    resource_mappings:
    - source_type: ""
      target_type: generic_node
      label_mappings:
      - source_key: host.name
        target_key: node_id
      - source_key: location
        target_key: location
      - source_key: namespace
        target_key: namespace

service:
  pipelines:
    metrics:
      receivers:
      - iis
      processors:
      - resourcedetection
      - resource
      - normalizesums
      - batch
      exporters:
      - googlecloud

The configuration is set to receive metrics from the Microsoft IIS server to Google Cloud. You can specify your own destination and insert any necessary credentials in the “receivers” section of the config file, near the top. 

The following notes apply for Google Cloud:

  1. The interval for fetching metrics is 60 seconds by default.
  2. In the Google Cloud exporter, do the following mapping:
    • Set the target type to a generic node, to simplify filtering metrics from the collector in cloud monitoring.
    • Set node_id, location, and namespace for the metrics. Location and namespace are set from the resource processor. 
  3. The project ID is not set in the configuration. Google automatically detects the project ID.
  4. Add the normalizesums processor to exclude the first metric that has a zero value when the configuration is done and the collector is restarted. To know more about this processor, check the OpenTelemetry documentation.
  5. Add the batch processor to bundle the metrics from multiple receivers. We highly recommend using this processor in the configuration, especially for the benefit of the logging component of the collector.

Step 4: View Your Metrics

Below is a table of the metrics that are collected by OpenTelemetry on Microsoft IIS. You can exclude metrics by adding the following line to your config file with the metric name you want to exclude:

metrics:
  <metric_name>:
    enabled: <true|false>
NameDescription
iis.connection.active Number of active connections.
iis.connection.anonymous Number of connections established anonymously.
iis.connection.attempt.count Total number of attempts to connect to the server.
iis.network.blocked Number of bytes blocked due to bandwidth throttling.
iis.network.file.count Number of transmitted files.
iis.network.io Total amount of bytes sent and received.
iis.request.count Total number of requests of a given type.
iis.request.queue.age.max Age of oldest request in the queue.
iis.request.queue.count Current number of requests in the queue.
iis.request.rejected Total number of requests rejected.
iis.thread.active Current number of active threads.
iis.uptime The amount of time the server has been up.

observIQ’s distribution is a game-changer for companies looking to implement the OpenTelemetry standards. The single line installer, seamlessly integrated receivers, exporter, and processor pool make working with this collector simple. Follow this space to keep up with all our future posts and simplified configurations for various sources. For questions, requests, and suggestions, reach out to our support team at support@observIQ.com.