# Setup Kong/Prometheus/Grafana Statsd ## Run vagrant up ## Configure Kong ``` sudo cp /etc/kong/kong.conf.default /etc/kong/kong.conf ``` add the following: ``` admin_listen = 0.0.0.0:8001 database = postgres pg_host = 127.0.0.1 pg_port = 5432 pg_user = kong pg_password = kong pg_database = kong ``` Run Kong migrations and Kong ``` sudo kong migrations up sudo kong start ``` Then on local box run ``` ./setup_api.sh ``` ## Configure Statsd Exporter ``` cat < /tmp/statsd_exporter-0.6.0.linux-amd64/statsd.rules mappings: #proxied requests - match: kong.*.*.kong_latency name: "kong_latency" labels: job: "kong" api: "$2" environment: "$1" - match: kong.*.*.upstream_latency name: "upstream_latency" labels: job: "kong" api: "$2" environment: "$1" - match: kong.*.*.latency name: "upstream_latency" labels: job: "kong" api: "$2" environment: "$1" - match: kong.*.*.request.status.* name: "status" labels: job: "kong" api: "$2" http: "$3" environment: "$1" - match: kong.*.*.*.size name: "size" labels: job: "kong" api: "$2" phase: "$3" environment: "$1" EOF ``` Run the exporter ``` /tmp/statsd_exporter-0.6.0.linux-amd64$ ./statsd_exporter -statsd.mapping-config statsd.rules ``` ## Configure prometheus Add the following lines to the end of /etc/prometheus/prometheus.yml and sudo systemctl restart prometheus ``` - job_name: 'statsd' target_groups: - targets: ['localhost:9102'] ``` Restart Prometheus ``` sudo /etc/init.d/prometheus restart ``` ## Configure Grafana - Login to localhost:3000 admin/admin - Setup the prometheus data source ( Type: prometheus / URL http://localhost:9090/ / Access proxy ) - import the example dashboard (dashboard.json)