Skip to content

Commit

Permalink
docs(README) update README
Browse files Browse the repository at this point in the history
From #7
  • Loading branch information
hbagdi authored Aug 4, 2018
1 parent a44518e commit 53cabe1
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
# Kong Prometheus Plugin

# DOCUMENT STATE: WORK IN PROGRESS

This plugin exposes metrics in [Prometheus Exposition format](https://github.com/prometheus/docs/blob/master/content/docs/instrumenting/exposition_formats.md).


### Available metrics
- *Status codes*: HTTP status codes returned by upstream services.
These are available per service and across all services.
- *Latencies Histograms*: Latency as measured at Kong:
- *Request*: Total request latency
- *Kong*: Time taken for Kong to route, authenticate and run all plugins for a request
- *Upstream*: Time taken by the upstream to respond to the request.
- *Bandwidth*: Total Bandwidth (egress/ingress) flowing through Kong.
This metrics is availble per service and across all services.
- *DB reachability*: Can the Kong node reach it's Database or not (Guage 0/1).
- *Connections*: Various NGINX connection metrics like active, reading, writing,
accepted connections.
Expand Down Expand Up @@ -124,21 +120,25 @@ kong_nginx_metric_errors_total 0
In case Admin API of Kong is protected behind a firewall or requires
authentication, you've two options:

1. If your proxy nodes also serve the Admin API, then you can create a route
If your proxy nodes also serve the Admin API, then you can create a route
to `/metrics` endpoint and apply a IP restriction plugin.
```
curl -XPOST http://localhost:8001/services -d name=prometheusEndpoint -d url=http://localhost:8001/metrics
curl -XPOST http://localhost:8001/services/prometheusEndpoint/routes -d paths[]=/metrics
curl -XPOST http://localhost:8001/services/prometheusEndpoint/plugins -d name=ip-restriction -d config.whitelist=10.0.0.0/24
```

2. This plugin has the capability to serve the content on a
Alternatively, this plugin has the capability to serve the content on a
different port using a custom server block in Kong's NGINX template.

Please note that this requires a custom NGINX template for Kong.
If you're using Kong 0.14.0 or above, then you can inject the server block
using Kong's [injecting Nginx directives](https://docs.konghq.com/0.14.x/configuration/#injecting-nginx-directives)
feature.

Consider the below `server` block:

You can add the following block to a custom NGINX template which can be used by Kong:
```
# /path/to/prometheus-server.conf
server {
server_name kong_prometheus_exporter;
listen 0.0.0.0:9542; # can be any other port as well
Expand All @@ -158,3 +158,15 @@ server {
}
}
```

Assuming you've the above file available in your file-system on which
Kong is running, add the following line to your `kong.conf` to scrape metrics
from `9542` port.

```
nginx_http_include=/path/to/prometheus-server.conf
```

If you're running Kong version older than 0.14.0, then you can achieve the
same result by using a
[custom Nginx template](https://docs.konghq.com/0.14.x/configuration/#custom-nginx-templates-embedding-kong).

0 comments on commit 53cabe1

Please sign in to comment.