Tuesday, April 06, 2021

Prometheus exporter in windows.

 Lets try to understand how the Prometheus work in its exporter in windows.

First lets install Prometheus in windows from below location.

https://prometheus.io/download/

Download the zip folder unzip it and run the following command

C:\prometheus-2.26.0.windows-amd64>prometheus.exe

You will be able to see the prometheus ui using this url.

http://localhost:9090/

Now as you know we had already started the prometheus if we check the target endpoint we will get this screen which shows it only listen to itself

Lets check if can get some of the graph for Prometheus

Now as you can see there are many exporter available for monitoring we are going to use memcached. So lets first installed it

https://github.com/nono303/memcached/tree/memcache-1.5.16

Extract the zip

and execute following commands

C:\memcached-memcache-1.5.16\cygwin\x64>memcached.exe -d install

C:\memcached-memcache-1.5.16\cygwin\x64>memcached.exe -d start

C:\memcached-memcache-1.5.16\cygwin\x64>

Now download the memcached exporter from following locations

https://prometheus.io/download/#memcached_exporter

As i am using window machine download window 64 setup.

https://github.com/prometheus/memcached_exporter/releases/download/v0.9.0/memcached_exporter-0.9.0.windows-amd64.zip

extract the zip
C:\memcached_exporter-0.9.0.windows-amd64

Now lets run the exporter

C:\memcached_exporter-0.9.0.windows-amd64>memcached_exporter.exe
level=info ts=2021-04-06T09:23:01.350Z caller=main.go:53 msg=”Starting memcached_exporter” version=”(version=0.9.0, branch=HEAD, revision=887a783c7d6d7a53cd1e626789b8a276f3accde1)”
level=info ts=2021-04-06T09:23:01.353Z caller=main.go:54 msg=”Build context” context=”(go=go1.16.2, user=root@b8a9c2538360, date=20210326-06:19:11)”
level=info ts=2021-04-06T09:23:01.355Z caller=main.go:88 msg=”Listening on address” address=:9150
level=info ts=2021-04-06T09:23:01.359Z caller=tls_config.go:191 msg=”TLS is disabled.” http2=false

open the url in browser

click on the Metrics link and you will be able to see the memcache metrics

Now as you know we had already started the prometheus if we check the target endpoint we will get this screen which shows it only listen to itself

Lets now add our memcached exporter end point into it. this can be done by modifying the prometheus.yml file as shown below

  • job_name: ‘memcached’ metrics_path defaults to ‘/metrics’ scheme defaults to ‘http’. static_configs:
    • targets: [‘localhost:9150’]

Note:- File is placed at location C:\prometheus-2.26.0.windows-amd64

now lets start the prometheus again using the below command and check if it is able to identify the new exporter we had configured.

C:\prometheus-2.26.0.windows-amd64>prometheus.exe

you can see now Prometheus has stared to pull the request form memcached running in our machine.
now lets see some of the graph of it.

click on the matric url of the memcached

Now you will get the type which we can observe

choose one of them and see the graph

No comments: