Grafana dashboard: Nginx Overview
Description: Shows stats built from the Prometheus Nginx plugin.

Displays stats from the Nginx Prometheus exporter:

https://github.com/knyar/nginx-lua-prometheus

Assumes you have a 'role' attribute on your servers. 

{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "Prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__requires": [
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "panel",
      "id": "singlestat",
      "name": "Singlestat",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "3.1.1"
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    }
  ],
  "id": null,
  "title": "Nginx Overview",
  "tags": [
    "nginx"
  ],
  "style": "dark",
  "timezone": "browser",
  "editable": true,
  "hideControls": false,
  "sharedCrosshair": false,
  "rows": [
    {
      "collapse": false,
      "editable": true,
      "height": "250px",
      "panels": [
        {
          "aliasColors": {},
          "bars": false,
          "datasource": "${DS_PROMETHEUS}",
          "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": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "connected",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "span": 5,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "sum(irate(nginx_http_requests_total{role=~\"$role\",status=~\"$status\",host!=\"127.0.0.1\"}[5m])) by (status)",
              "hide": false,
              "interval": "1000ms",
              "intervalFactor": 1,
              "legendFormat": "{{status}}",
              "metric": "nginx_http_requests_total",
              "refId": "B",
              "step": 1
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "HTTP Responses",
          "tooltip": {
            "msResolution": false,
            "shared": true,
            "sort": 0,
            "value_type": "cumulative"
          },
          "type": "graph",
          "xaxis": {
            "show": true
          },
          "yaxes": [
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": 0,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ]
        },
        {
          "aliasColors": {},
          "bars": false,
          "datasource": "${DS_PROMETHEUS}",
          "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": 5,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "sum(irate(nginx_http_requests_total{role=~\"$role\",status=~\"$status\",host!=\"127.0.0.1\"}[5m])) by (alias,status)",
              "interval": "",
              "intervalFactor": 2,
              "legendFormat": "{{status}} {{alias}}",
              "metric": "nginx_http_requests_total",
              "refId": "A",
              "step": 10
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "HTTP Requests By Host",
          "tooltip": {
            "msResolution": false,
            "shared": true,
            "sort": 0,
            "value_type": "cumulative"
          },
          "type": "graph",
          "xaxis": {
            "show": true
          },
          "yaxes": [
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": 0,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ]
        },
        {
          "title": "Apdex",
          "error": false,
          "span": 2,
          "editable": true,
          "type": "singlestat",
          "isNew": true,
          "id": 7,
          "targets": [
            {
              "expr": "(sum(rate(nginx_http_request_duration_seconds_bucket{role=\"$role\",host!=\"127.0.0.1\",le=\"0.01\"}[1m]))+sum(rate(nginx_http_request_duration_seconds_bucket{role=\"$role\",host!=\"127.0.0.1\",le=\"0.01\"}[1m]))) / 2 / sum(rate(nginx_http_request_duration_seconds_count{role=\"$role\",host!=\"127.0.0.1\"}[1m]))",
              "intervalFactor": 2,
              "refId": "A",
              "step": 60
            }
          ],
          "links": [],
          "datasource": "${DS_PROMETHEUS}",
          "maxDataPoints": 100,
          "interval": null,
          "cacheTimeout": null,
          "format": "none",
          "prefix": "",
          "postfix": "",
          "nullText": null,
          "valueMaps": [
            {
              "value": "null",
              "op": "=",
              "text": "N/A"
            }
          ],
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "rangeMaps": [
            {
              "from": "null",
              "to": "null",
              "text": "N/A"
            }
          ],
          "mappingType": 1,
          "nullPointMode": "connected",
          "valueName": "avg",
          "prefixFontSize": "50%",
          "valueFontSize": "80%",
          "postfixFontSize": "50%",
          "thresholds": "0.9,0.97",
          "colorBackground": false,
          "colorValue": true,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "sparkline": {
            "show": true,
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "fillColor": "rgba(31, 118, 189, 0.18)"
          },
          "gauge": {
            "show": false,
            "minValue": 0,
            "maxValue": 1,
            "thresholdMarkers": true,
            "thresholdLabels": false
          }
        }
      ],
      "title": "Row"
    },
    {
      "collapse": false,
      "editable": true,
      "height": "250px",
      "panels": [
        {
          "aliasColors": {},
          "bars": false,
          "datasource": "${DS_PROMETHEUS}",
          "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": {
            "alignAsTable": true,
            "avg": true,
            "current": true,
            "max": true,
            "min": true,
            "rightSide": false,
            "show": true,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "connected",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "span": 5,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "sum(rate(nginx_http_request_duration_seconds_sum{role=\"$role\",host!=\"127.0.0.1\"}[1m])) / sum(rate(nginx_http_request_duration_seconds_count{role=\"$role\",host!=\"127.0.0.1\"}[1m]))",
              "intervalFactor": 2,
              "legendFormat": "seconds",
              "refId": "C",
              "step": 10,
              "hide": false
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "Response Time",
          "tooltip": {
            "msResolution": false,
            "shared": true,
            "sort": 0,
            "value_type": "cumulative"
          },
          "type": "graph",
          "xaxis": {
            "show": true
          },
          "yaxes": [
            {
              "format": "s",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": 0,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ]
        },
        {
          "aliasColors": {},
          "bars": false,
          "datasource": "${DS_PROMETHEUS}",
          "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": 4,
          "isNew": true,
          "legend": {
            "alignAsTable": true,
            "avg": true,
            "current": true,
            "max": true,
            "min": true,
            "show": true,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "connected",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "span": 5,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "sum(rate(nginx_http_request_duration_seconds_sum{role=\"$role\",host!=\"127.0.0.1\"}[1m])) by (alias) / sum(rate(nginx_http_request_duration_seconds_count{role=\"$role\",host!=\"127.0.0.1\"}[1m])) by (alias)",
              "intervalFactor": 2,
              "legendFormat": "{{alias}}",
              "refId": "A",
              "step": 10
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "Response time by Host",
          "tooltip": {
            "msResolution": false,
            "shared": true,
            "sort": 0,
            "value_type": "cumulative"
          },
          "type": "graph",
          "xaxis": {
            "show": true
          },
          "yaxes": [
            {
              "format": "s",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": 0,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ]
        },
        {
          "title": "Hosts",
          "error": false,
          "span": 2,
          "editable": true,
          "type": "singlestat",
          "isNew": true,
          "id": 8,
          "targets": [
            {
              "expr": "count(sum(nginx_http_request_duration_seconds_count{host!=\"127.0.0.1\",role=\"$role\"}) by (alias))",
              "intervalFactor": 2,
              "refId": "A",
              "step": 60
            }
          ],
          "links": [],
          "datasource": "${DS_PROMETHEUS}",
          "maxDataPoints": 100,
          "interval": null,
          "cacheTimeout": null,
          "format": "none",
          "prefix": "",
          "postfix": "",
          "nullText": null,
          "valueMaps": [
            {
              "value": "null",
              "op": "=",
              "text": "N/A"
            }
          ],
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "rangeMaps": [
            {
              "from": "null",
              "to": "null",
              "text": "N/A"
            }
          ],
          "mappingType": 1,
          "nullPointMode": "connected",
          "valueName": "avg",
          "prefixFontSize": "50%",
          "valueFontSize": "80%",
          "postfixFontSize": "50%",
          "thresholds": "0,.9",
          "colorBackground": false,
          "colorValue": true,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "sparkline": {
            "show": true,
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "fillColor": "rgba(31, 118, 189, 0.18)"
          },
          "gauge": {
            "show": false,
            "minValue": 0,
            "maxValue": 1,
            "thresholdMarkers": true,
            "thresholdLabels": false
          }
        }
      ],
      "title": "New row"
    }
  ],
  "time": {
    "from": "now-1h",
    "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": {},
        "datasource": "${DS_PROMETHEUS}",
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "role",
        "options": [],
        "query": "label_values(role)",
        "refresh": 1,
        "regex": "",
        "tagValuesQuery": "",
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": ".*",
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "hide": 0,
        "includeAll": true,
        "label": "response_code",
        "multi": true,
        "name": "status",
        "options": [],
        "query": "label_values(status)",
        "refresh": 1,
        "regex": "",
        "type": "query"
      }
    ]
  },
  "annotations": {
    "list": []
  },
  "refresh": "30s",
  "schemaVersion": 12,
  "version": 6,
  "links": [],
  "gnetId": 462,
  "description": "Shows stats built from the Prometheus Nginx plugin."
}