/docker-grafana

:chart_with_upwards_trend: Query a PostgreSQL DB and create interactive charts easily using Grafana simple-json backend

Primary LanguagePythonMIT LicenseMIT

Grafana provides utilities to gain insights into the database, system status, logging, etc.

Image of metrics

Usage

Start up the backend services:

docker-compose up [--build]

Now, users may navigate to the grafana dashboard:

Setup Data source

http -a admin:secret POST ":3000/api/datasources" name=chameleon type="grafana-simple-json-datasource" url="http://chameleon:5445/api/" access="proxy" basicAuth:=false
HTTP/1.1 200 OK
Content-Length: 56
Content-Type: application/json; charset=UTF-8
Date: Wed, 03 May 2017 21:40:22 GMT

{
    "id": 1, 
    "message": "Datasource added", 
    "name": "chameleon"
}

Setup Dashboard

  • Go to import new dashboard
    • Select Upload .json File and navigate to user_metrics.json
    • Will have to select "chameleon" as the datasource
    • Select Import

Setup Templating

This dashboard comes with templating already configured. If you want to globally change parameters across all panels in a dashboard:

  • On the dashboard page, select ⚙ (Manage Dashboard) > Templating and New
    • Create a "source" template, of Query type, connected to the datasource we created
      • As an example: templates.metrics.orders_ordered.source
      • Check the Include All option [optional]
    • Now, change the metric to use the new $source template
      • Example: metrics.orders_ordered.source=$source
    • The dashboard will now have a template control header with dropdowns

Create a new user

$ http -a admin:secret POST ":3000/api/admin/users" name=UserP login=UserP password=pass1
HTTP/1.1 200 OK
Content-Length: 33
Content-Type: application/json; charset=UTF-8
Date: Wed, 03 May 2017 21:18:34 GMT

{
    "id": 3, 
    "message": "User created"
}

Quick Links

Swagger creates documentation of our internal API automagically 🎉 :

References