Documentation OVH

Collect Windows Metrics

Collect Windows Metrics

Last updated 23 August, 2019

Objective

In this guide, you will learn how to use the telegraf tool or the Prometheus ecosystem to collect Windows data and send them to the Metrics Data Platform.

Requirements

  • a valid Metrics account.
  • a Windows machine

Instructions

Some known tools have the possibility to collect Windows data, and then send them to a Backend. We will see how the telegraf tool and the Prometheus ecosystem can be used to collect and store data on the Metrics Data Platform.

telegraf

Telegraf runs on Windows. Following this documentation and setting a configuration as described in our telegraf user documentation allow a user to push its own server and application data to Metrics.

First go to download telegraf page and select the Windows binaries.

Once telegraf is unzipped, you shoud have a .exe file and a .conf one. Edit the conf file to set-up your own Metrics account in the influxdb output:

# OUTPUTS
[[outputs.influxdb]]
  urls = ["https://influxdb.gra1-ovh.metrics.ovh.net" ]

  ## Timeout for HTTP messages.
  timeout = "15s"  # Set at least 15s to avoid possible timeout with our platform

  ## HTTP Basic Auth
  username = "windows"   # A random user name for the basic auth (not checked)
  password = WRITE_TOKEN

The telegraf basic configuration produced ~80 metrics for a single Windows 2016 server.

If you want to record the total Metrics on the whole field, you can set:

IncludeTotal=true    # Compute total metrics for current field

To record only the total metric, activate at the end of the win_perf_counter the following tagpass option:

[inputs.win_perf_counters.tagpass]    ## Tag pass will write list only the win_perf_counters metrics flags with an instance equals to _Total. To add other instances you can add several one in the instance list below.

  instance = [ "_Total" ]  

Otherwise to blacklist specific instance you can use tagdrop instead of tagpass. To learn more on how to configure telegraf, you can check this detailed guide.

Prometheus ecosystem

You can use the Prometheus ecosystem on Windows. An interesting Prometheus exporter for Windows is: wmi_exporter.

Telegraf supports Windows and can be used to record and forward Prometheus data to Metrics.

To collect metrics on a Windows 2016 server, simply download and install the latest wmi_exporter release available (.msi to install a windows service).

As by default WMI_EXPORTER listens to 0.0.0.0 install it with LISTEN_ADDR set to 127.0.0.1 by executing:

msiexec /i <path-to-msi-file> LISTEN_ADDR=127.0.0.1  # update the IP address used to bind WMI Exporter

Once WMI_EXPORTER is installed all the server metrics are available at http://127.0.0.1:9182/metrics.

If you want to access the WMI_EXPORTER metrics from internet you can expose them using 0.0.0.0 IP binded address but ensure that you apply sufficient security.

Then download Telegraf on Windows, and follow previous installation steps.

Configure Telegraf as declared previously and deactivate the inputs.win_perf_counter plugin if you do not want to record them by removing configuration lines or simply add a namedrop option to remove specific metrics:

[[inputs.win_perf_counters]] # Add a the start of the telegraf win_perf_counters input plugin:
  namedrop = [ "win_*" ]

Then configure Telegraf to use the prometheus plugin:

[[inputs.prometheus]] # Add the prometheus input plugin:
  urls = [ "http://127.0.0.1:9182/metrics" ]

    namedrop = [ "wmi_service_*" ]  # Discard all wmi_service as a large amount of series is created

The Telegraf prometheus plugin doesn't work on Telegraf test mode. Restart Telegraf Windows service and you should see your data on your Metrics account.

This telegraf configuration produced ~140 metrics for a single Windows 2016 server. Check the WMI exporter collector documentation to select and collect the right metrics.

In the same way, you can collect any kind of Metrics the Prometheus ecosystem exposed on a route using telegraf.

Happy collect on Windows!

Go further


Cette documentation vous a-t-elle été utile ?

Génial ! Ravi d'avoir pu vous aider.

Images, contenu, structure... N'hésitez pas à nous dire pourquoi afin de la faire évoluer ensemble !

Merci beaucoup pour votre aide ! Vos retours seront étudiés au plus vite par nos équipes..


Ces guides pourraient également vous intéresser...