sysulq / nginx-vts-exporter

Simple server that scrapes Nginx vts stats and exports them via HTTP for Prometheus consumption
https://sysulq.github.io/nginx-vts-exporter/
MIT License
645 stars 142 forks source link

How to use with Graphana #35

Closed nsaeris closed 6 years ago

nsaeris commented 7 years ago
  1. I installed Prometheus and Graphana.
  2. Configured Prometheus Data Source in Graphana and setup prometheus Dashboard. This works.
  3. I ran the nginx-vts-exporter docker container with correct NGINX_STATUS url that returns json response. Following is the output.

NKS-AER:~ narendra$ docker run -ti --rm --env NGINX_STATUS="http://myhost.com/status/format/json" sophos/nginx-vts-exporter 2017/09/15 00:09:18 Starting nginx_vts_exporter (version=0.6, branch=HEAD, revision=ad91859ba2ee5b76887edb40c35f8991f0fa3df9) 2017/09/15 00:09:18 Build context (go=go1.8.3, user=travis@testing-gce-a196b404-c57f-47f5-b1bb-4cb5edab7d01, date=20170901-02:31:14) 2017/09/15 00:09:18 Starting Server at : :9913 2017/09/15 00:09:18 Metrics endpoint: /metrics 2017/09/15 00:09:18 Metrics namespace: nginx 2017/09/15 00:09:18 Scraping information from : http://myhost.com/status/format/json

  1. I added this exporter in the Prometheus config as following: global: scrape_interval: 15s # By default, scrape targets every 15 seconds.

    Attach these labels to any time series or alerts when communicating with

    external systems (federation, remote storage, Alertmanager).

    external_labels: monitor: 'codelab-monitor'

A scrape configuration containing exactly one endpoint to scrape:

Here it's Prometheus itself.

scrape_configs:

The job name is added as a label job=<job_name> to any timeseries scraped from this config.

  1. I imported https://grafana.com/dashboards/2949 dashboard into my Graphana instance

I see the dashboard but no data on it. The output on the exporter console is not changing.

I believe the way this would work is as following:

  1. Graphana UI will poll prometheus
  2. Prometheus will keep polling every 5s the exporter
  3. Exporter will fetch data from nginx whenever prometheus polls it.

Can someone guide me on this? I am new to both Graphana and Prometheus.

sysulq commented 7 years ago

A little suggestion, you can try to create graph in prometheus before you use grafana, you should find out which part has problem finnally in this way.