Monitor windows server with Prometheus wmi_exporter

by Daniel Pham
Published: Updated:
This entry is part 12 of 14 in the series Install Prometheus and Grafana on Ubuntu 18

In this article we will monitor windows server with prometheus wmi_exporter. With linux server, you can read my following article.

Recommended Reading: Monitor linux server with Prometheus node exporter

Install wmi_exporter on windows server

First, you need to check the version to install at this link. The current version is v0.13.0.

Log in to the windows server you need to monitor, download the msi installation package with the link below.

https://github.com/prometheus-community/windows_exporter/releases/download/v0.13.0/windows_exporter-0.13.0-amd64.msi

After downloading, install the software like you install other software. Double click on the installation file and next until finished.

Then, open Task Manager and go to the Processes tab, find the windows_exporter process and see if it is running. If the process is running, it is ok.

Monitor windows server with Prometheus wmi_exporter
Monitor windows server with prometheus wmi_exporter.

Now the windows exporter will run on port 9182. You need to open the firewall on the windows server to allow access to port 9182.

Set up prometheus configuration

And now, we will set up prometheus to call the windows exporter on the windows server.

You open the configuration file.

nano /etc/prometheus/prometheus.yml

You add the content below at the end of the file.

  - job_name: 'wmi_exporter'
    metrics_path: /metrics
    scrape_interval: 5s
    static_configs:
    - targets:
      - hostname-winserver:9182

Next, find the paragraph below and declare the rule alert file path for the windows server.

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"
    - "/etc/prometheus/rules/windows.yml"

After editing, save the file but do not reload or restart the prometheus service.

Set up the alert server windows rule file

As you can see above, we set up prometheus to call a file containing alert rules for the windows server.

Now you create the file as below.

nano /etc/prometheus/rules/windows.yml

Then you use the rule structure as below to add it to the file.

groups:
- name: Windows Server
  rules:
  - alert: Server Windows Down
    expr: up{job="wmi_exporter"} == 0
    for: 10s
    labels:
      severity: "Critical"
    annotations:
      Summary: 'Server "{{ $labels.instance }}" down.'

You can download the full rule file for windows server at my gitlab link.

Now you have reloaded the prometheus service.

systemctl reload prometheus

Set up the Grafana monitor server windows dashboard

You can import and use the dashboard with ID 10467. However, this dashboard is displayed in Chinese.

If you want to use English, you can download the json file from my gitlab and import it.

Conclusion

Very fast and simple, isn’t it? You can now set up monitor server windows easily. Grafana provides you with a complete interface to view resources on the server. Alertmanager will ensure to send you notifications when the server has resource problems.

0 0 votes
Article Rating
Series Navigation«« Previous part: Monitor linux server with Prometheus node exporterNext part: Monitor VMware with Prometheus vmware_exporter »»

You may also like

Subscribe
Notify of
guest
1 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Baonguyen8188
Baonguyen8188
Guest
3 years ago

Em thử import json của anh nhưng không hiện thị metrics trên Grafana, anh hỗ trợ e với

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.

SUPPORT US

FOLLOW US

Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 DevOpsLite.com – All rights reserved.

Please write sources “DevOpsLite.com” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

2
0
Would love your thoughts, please comment.x
()
x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.