Windows metrics with Prometheus and Grafana

A quick post where we will see how easily and in a jiffy we have compiled the most common metrics in a Microsoft Windows environment, for both Windows Server and Windows workstations. We will obtain and visualize metrics thanks to the Prometheus agent and dashboards from the Grafana community!

Continuing with the Prometheus series and obtaining metrics, Today we will look at a standard, how to get metrics out of our Windows servers (or positions); so if you don't already have Prometheus or Grafana deployed, Take a look at This post. Well, because on a Windows computer we will need a metrics exporter, in this case called Windows Exporter, it will display the metrics in a port for Prometheus to collect and store (and so we can consult them from Grafana).

We begin by deploying Windows Exporter for Prometheus, We will download the version that suits us, In my case an installer for x64, The truth is that the installation can be done in different ways, or by passing on the arguments of the collections from which we want to obtain metrics, or by passing you a configuration file. As you can see on their GitHub there are a few collectors, and it will depend on the functions that Windows has, we can add more or less. For example, to install it on a normal Windows it would be enough to run:

MSIEXEC /I windows_exporter-0.30.5-amd64.msi ENABLED_COLLECTORS="[defaults],process,memory" /Qn

Or if you had IIS installed:

MSIEXEC /I windows_exporter-0.28.2-amd64.msi ENABLED_COLLECTORS="[defaults],Yis,process,memory" /Qn

Or if you are a domain controller, has the role of DNS…

MSIEXEC /I windows_exporter-0.28.2-amd64.msi ENABLED_COLLECTORS="[defaults],Ad,DNS,Yis,Time,process,memory" /Qn

What I said, Review the available collectors and adjust the installation indicating what we want to collect. Once installed, it will have created a service called 'windows_exporter’ Automatic and started. It will expose and we will be able to see our metrics from http://127.0.0.1:9182/Metrics.

The next thing will be in the Prometheus configuration file to add the Windows machines that we have installed the metrics exporter, So in the 'prometheus.yml’ we will add the works:

...
  - job_name: Win-NOMBRE_WINDOWS-Prometheus scrape_interval: 5scrape_timeout: 5static_configs:
      - Targets:
        - DIRECCION_IP_WINDOWS:9182
...

And as always, after tapping the settings, We restarted Prometheus!

sudo Docker Restart Prometheus

Now all that's left is to go to our beloved Grafana and import a dashboard that we like of the community, with that we will already have it and we will begin to visualize and interpret the data that comes to us from each Windows computer. We can, for example, use the ID of this dashboard as a guide: 14694.

As usual, I hope you find it interesting, that you are encouraged to add visualizations of the status of your organization, Expand your visibility, customize the dashboards and put a TV spinning around (And we'll see the alerts soon)… And those things I always tell you, I know that you behave very well and that you are chic@s buen@s, So keep going like this 😉 a huge kiss, Have a great week!!

Recommended Posts

Author

nheobug@bujarra.com
Autor del blog Bujarra.com Cualquier necesidad que tengas, Do not hesitate to contact me, I will try to help you whenever I can, Sharing is living ;) . Enjoy documents!!!