Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps]

In this article we are going to cover How Install Install Prometheus and Grafana on Windows with WMI Exporter, Configure Prometheus as Grafana DataSource.

What is prometheus?

  • Prometheus is a open source Linux Server Monitoring tool mainly used for metrics monitoring, event monitoring, alert management, etc.
  • Prometheus has changed the way of monitoring systems and that is why it has become the Top-Level project of Cloud Native Computing Foundation (CNCF).
  • Prometheus uses a powerful query language i.e. “PromQL”.
  • In Prometheus tabs are on and handles hundreds of services and microservices.
  • Prometheus use multiple modes used for graphing and dashboarding support.

Why we used prometheus?

  • A multi-dimensional data model with time series data identified by metric name and key/value pairs
  • PromQL, a flexible query language to leverage this dimensionality
  • Pushing time series is supported via an intermediary gateway
  • Multiple modes of graphing and dashboarding support

Prometheus Architecture 

Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 1

  • As above we can see an architecture of Prometheus monitoring tool.
  • We made a basic design to understand it easily for you people.

Now lets understand the Prometheus components one-by-one

Prometheus Components

1. Prometheus Server

  • Prometheus server is a first component of Prometheus architecture.
  • Prometheus server is a core of Prometheus architecture which is divided into several parts like Storage, PromQL, HTTP server, etc.
  • In Prometheus server data is scraped from the target nodes and then stored in the database.

1.a. Storage

  • Storage in Prometheus server has a local on disk storage.
  • Prometheus has many interfaces that allow integrating with remote storage systems.

1.b. PromQL

  • Prometheus uses its own query language i.e. PromQL which is a very powerful querying language.
  • PromQL allows the user to select and aggregate the data.

2. Service Discovery

  • Next and very important component of Prometheus Server is the Service Discovery.
  • With the help of Service discovery the services are identified which need to be scraped.
  • To Pull metrics, identification of services and finding the targets are compulsory needed.
  • Through Service discovery we monitor the entities and can also locate its targets.

3. Scrape Target

  • Once the services are identified and the targets are ready then we can pull metrics from it and can scrape the target.
  • We can export the data of the end point using node exporters.
  • Once the metrics or other data is pulled, Prometheus stores it in a local storage.

4. Alert Manager

  • Alert Manager handles the alerts which may occurs during the session.
  • Alert manager handles all the alerts which are sent by the Prometheus server.
  • Alert manager is one of the very useful components of the Prometheus tool.
  • If in case any big error or any issue occurs, alert manager manage those alerts and contact with human via E-mail, Text Messages, On-call, or any other chat application service.

5. User Interface

  • User interface is also an important component as it builds a bridge between the user and the system.
  • In Prometheus, user interfaces are note that much user friendly and can be used till graph queries.
  • For good exclusive dashboards Prometheus works together with Grafana (visualization tool).
  • Using Grafana over Prometheus to visualize properly we can use custom dashboards.
  • Grafana dashboards display via pie charts, line charts, tables, good data graphs of CPU usage, RAM utilization, network load, etc with indicators.
  • Grafana supports and run with Prometheus by querying language i.e. PromQL.
  • To fetch data from Prometheus and to display the results on Grafana dashboards PromQL is used.

What is Grafana ?

  • Grafana is a free and open source visualization tool mostly used with Prometheus to which monitor metrics.
  • Grafana provides various dashboards, charts, graphs, alerts for the particular data source.
  • Grafana allows us to query, visualize, explore metrics and set alerts for the data source which can be a system, server, nodes, cluster, etc.
  • We can also create our own dynamic dashboard for visualization and monitoring.
  • We can save the dashboard and can even share with our team members which is one of the main advantage of Grafana.

What is WMI Exporter?

  • It is same like Node Exporter but Node Exporter for Linux and WMI Exporter for Windows
  • WMI Exporter is an exporter utilized for windows servers to collects metrics like CPU usage, memory, and Disk usage.
  • It is open-source which can be installed on Windows servers using the .msi installer

Prerequisite: 

  • Good internet connectivity 
  • Security Groups Configured properly
  • Any web Browser

Security Groups Configured on EC2 Instances

  • Port 9090 — Prometheus Server
  • Port 9182—-WMI Exporter
  • Port 3000 — Grafana

How to Install Prometheus and Grafana on Windows

#1. Download Prometheus for windows

Now we will download the latest version of Prometheus. We can copy the download link as per our Operating System from Prometheus download page

Using the below command we can download Prometheus, here we are downloading Prometheus 2.32.1 version, you use the above link to download specific version.

Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 2
download prometheus

We have to install prometheus service but in windows we can not installl prometheus as a service for that here im using NSSM package to install Prometheus service 

Open your command prompt run as administrator 

Paste the directory path like below command:

cd c:\users\Administrator\Downloads\nssm-2.24\nssm-2.24\win64
dir
nssm.exe install prometheus<<and your prometheus application directory path>> \prometheus
Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 3
install prometheus

Now Prometheus is successfully installed in your machine

So let’s check the status in prometheus service on windows.

Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 4
start prometheus

For now Prometheus is stop after changing in configuration file we will start prometheus

After installation now we are going to install Grafana on Window

#2. Install Grafana on Windows

Now we will download the latest version of Grafana.from official page of Grafana select window operating system and download .msi installer

Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 5
install grafana

After download of grafana we will install grafana on window

Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 6
grafana

After installation of Grafana go to C:<<Program Files<<GrafanaLabs<<Grafana<< conf<<defaults

In default change the smtp enabled false replace with true you can check the below image

Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 7
smtp

To access Grafana Dashboard open your favorite browser, type server IP or Name followed by grafana default port 3000.

http://localhost:3000

Here you can see Login page of Grafana now you will have to login with below Grafana default UserName and Password.

Username – admin
Password – admin
Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 8
login grafana

It is always a good practice to change your login credentials.

Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 9
enter password

Provide your New Password and click on Change Password

Now here you can see Home Dashboard page of Grafana

Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 10
welcome to grafana

#3. Install WMI Exporter on Windows

For Windows hosts, you are going to use the Windows exporter.

You can download the latest version of windows installer from here

Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 11

When the download is done, simply click on the MSI file and start running the installer.

Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 12
wmi

After Installation of WMI Exporter lets check its successfully installed or not

So go to services and search windows exporter.

Make sure windows exporter service is running.

Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 13

Now that your exporter is running, it should start exposing metrics on

http://localhost:9182/metrics

So let’s check

Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 14

#4. Update Prometheus Configuration file

Go to the Prometheus file and open Prometheus.yml file and 

Update config file with below code:

 - job_name: "WMI Exporter"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["Host_ip:9182"]

Now save the file and exit

After changing in config file you need to start prometheus server 

So go the services and start the Prometheus Server

Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 15
start prometheus

Hit the URL in your web browser to check weather our target is successfully scraped by Prometheus or not

https://localhost:9090/targets
Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 16
prometheus target

#4. Configure Prometheus as Grafana DataSource

Once you logged into Grafana Now first Navigate to Settings Icon ->> Configuration ->> data sources

Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 17
configuration

Now lets click on Add Data sources and select Prometheus

Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 18
add data source

Now configure Prometheus data source by providing Prometheus URL

Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 19
config

As per your requirement you can do other changes or you can also keep remaining configuration as default.

Now click on Save & test so it will prompt a message Data Source is working.

Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 20
data source is working

#5.Creating Grafana Dashboard to monitor Windows server

Now lets build a dashboard in Grafana so then it will able to reflect the metrics of the Windows system.

So we will use 14510 to import Grafana.com, Lets come to Grafana Home page and you can see a “+” icon. Click on that and select “Import”

Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 21
import

On the next window, simply enter the dashboard ID in the corresponding field 

Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 22
import for window

Now provide the name and select the Prometheus Datasource and click on Import.

Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 23
window exporter

There you are done with the setup. Now your Dashboard is running up!.

Install Prometheus and Grafana on Windows with WMI Exporter [4 Steps] 24
window dashboard

Conclusion:

In this article we have covered How Install Install Prometheus and Grafana on Windows with WMI Exporter, Configure Prometheus as Grafana DataSource.

Related Articles:

Shweta Mamidwar

I am Shweta Mamidwar working as a Intern in Product Company. Likes to share knowledge.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link
Powered by Social Snap