Grafana dashboard: Nginx Stats
Description: Nginx Stats Dashboard using CollectD and Graphite

Basic Nginx Stats Dashboard. 

## Metrics shown 
* Requests/s
* Connection state breakdown
* Connections handled vs accepted 

## Configure Nginx
You need to enable stub_status module in a location to make metrics available for collectd. 
 
```
location /nginx_status {
    stub_status on;
    access_log off;
    allow 127.0.0.1;
    deny all;
}
```

## Configure CollectD 

The relevant parts for this dashboard is 

```
LoadPlugin nginx
<Plugin "nginx">
    URL "http://localhost:8080/nginx_status"
</Plugin>
```

## Metric Prefix
When you import the dasbhoard you will have to specify your collectd metric prefix, this is by defauilt just `collectd`. The dashboard assumes the following metric structure `$prefix.$server.nginx...`.  So if you have a non standard collectd prefix like `prod.cacheservers` then specify that in the prefix field when you import the dashboard. During import when you specify the prefix do not include the last dot (`.`). 

## Make this dashboard better
For feedback and ideas to improve this dashboard please open an issue here: 
[https://github.com/torkelo/dashboards](https://github.com/torkelo/dashboards)

{
  "__inputs": [
    {
      "name": "DS_GRAPHITE",
      "label": "Graphite",
      "description": "",
      "type": "datasource",
      "pluginId": "graphite",
      "pluginName": "Graphite"
    },
    {
      "name": "VAR_PREFIX",
      "type": "constant",
      "label": "CollectD Metric Prefix",
      "value": "collectd",
      "description": ""
    }
  ],
  "__requires": [
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "3.1.0"
    },
    {
      "type": "datasource",
      "id": "graphite",
      "name": "Graphite",
      "version": "1.0.0"
    }
  ],
  "id": null,
  "title": "Nginx Stats",
  "tags": [],
  "style": "dark",
  "timezone": "browser",
  "editable": true,
  "hideControls": false,
  "sharedCrosshair": false,
  "rows": [
    {
      "collapse": false,
      "editable": true,
      "height": "250px",
      "panels": [
        {
          "aliasColors": {},
          "bars": false,
          "datasource": "${DS_GRAPHITE}",
          "editable": true,
          "error": false,
          "fill": 1,
          "grid": {
            "threshold1": null,
            "threshold1Color": "rgba(216, 200, 27, 0.27)",
            "threshold2": null,
            "threshold2Color": "rgba(234, 112, 112, 0.22)"
          },
          "id": 1,
          "isNew": true,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": false,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "connected",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "span": 6,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "refId": "A",
              "target": "$prefix.$server.nginx.nginx_requests"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "Requests/s",
          "tooltip": {
            "msResolution": false,
            "ordering": "alphabetical",
            "shared": true,
            "value_type": "cumulative"
          },
          "type": "graph",
          "xaxis": {
            "show": true
          },
          "yaxes": [
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ]
        },
        {
          "aliasColors": {},
          "bars": false,
          "datasource": "${DS_GRAPHITE}",
          "editable": true,
          "error": false,
          "fill": 1,
          "grid": {
            "threshold1": null,
            "threshold1Color": "rgba(216, 200, 27, 0.27)",
            "threshold2": null,
            "threshold2Color": "rgba(234, 112, 112, 0.22)"
          },
          "id": 3,
          "isNew": true,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "connected",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "span": 6,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "refId": "A",
              "target": "aliasByNode($prefix.$server.nginx.nginx_connections.*, 4)"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "Connections",
          "tooltip": {
            "msResolution": false,
            "ordering": "alphabetical",
            "shared": true,
            "value_type": "cumulative"
          },
          "type": "graph",
          "xaxis": {
            "show": true
          },
          "yaxes": [
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ]
        }
      ],
      "title": "Row"
    },
    {
      "collapse": false,
      "editable": true,
      "height": "250px",
      "panels": [
        {
          "aliasColors": {},
          "bars": false,
          "datasource": "${DS_GRAPHITE}",
          "editable": true,
          "error": false,
          "fill": 1,
          "grid": {
            "threshold1": null,
            "threshold1Color": "rgba(216, 200, 27, 0.27)",
            "threshold2": null,
            "threshold2Color": "rgba(234, 112, 112, 0.22)"
          },
          "id": 2,
          "isNew": true,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "connected",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "span": 12,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "refId": "A",
              "target": "aliasByNode($prefix.$server.nginx.connections.*, 4)"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "Accepted & Handled  / s",
          "tooltip": {
            "msResolution": false,
            "ordering": "alphabetical",
            "shared": true,
            "value_type": "cumulative"
          },
          "type": "graph",
          "xaxis": {
            "show": true
          },
          "yaxes": [
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ]
        }
      ],
      "title": "New row"
    }
  ],
  "time": {
    "from": "now-30m",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "templating": {
    "list": [
      {
        "current": {
          "value": "${VAR_PREFIX}",
          "text": "${VAR_PREFIX}"
        },
        "datasource": null,
        "hide": 2,
        "includeAll": false,
        "multi": false,
        "name": "prefix",
        "options": [
          {
            "value": "${VAR_PREFIX}",
            "text": "${VAR_PREFIX}"
          }
        ],
        "query": "${VAR_PREFIX}",
        "refresh": 0,
        "type": "constant"
      },
      {
        "current": {},
        "datasource": "${DS_GRAPHITE}",
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "server",
        "options": [],
        "query": "$prefix.*",
        "refresh": 1,
        "type": "query"
      }
    ]
  },
  "annotations": {
    "list": []
  },
  "schemaVersion": 12,
  "version": 8,
  "links": [],
  "gnetId": 49,
  "description": "Nginx Stats Dashboard using CollectD and Graphite"
}