Grafana dashboard: a Nginx Connections Overview
Description: Shows stats built from the Prometheus Nginx status page exporter rebuy-de/nginx-exporter or ndiazg/nginx-prometheus-exporter.

This dashboard which utilize data from [rebuy-de/nginx-exporter](https://github.com/rebuy-de/nginx-exporter) or [discordianfish/nginx_exporter](https://github.com/discordianfish/nginx_exporter).

{
  "__inputs": [],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "5.3.4"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": "5.0.0"
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "5.0.0"
    },
    {
      "type": "panel",
      "id": "singlestat",
      "name": "Singlestat",
      "version": "5.0.0"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "Shows stats built from the Prometheus Nginx status page exporter rebuy-de/nginx-exporter or ndiazg/nginx-prometheus-exporter.",
  "editable": true,
  "gnetId": 9512,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1544715569736,
  "links": [],
  "panels": [
    {
      "cacheTimeout": null,
      "colorBackground": true,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "$datasource",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 7,
        "w": 2,
        "x": 0,
        "y": 0
      },
      "id": 18,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "expr": "nginx_up{namespace=~\"$namespace\", app=~\"$app\", instance=~\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "thresholds": "Up,Down",
      "timeFrom": "30s",
      "timeShift": null,
      "title": "Status",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        },
        {
          "op": "=",
          "text": "Down",
          "value": "0"
        },
        {
          "op": "=",
          "text": "Up",
          "value": "1"
        }
      ],
      "valueName": "current"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "$datasource",
      "description": "",
      "fill": 1,
      "gridPos": {
        "h": 7,
        "w": 22,
        "x": 2,
        "y": 0
      },
      "id": 26,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "hideEmpty": true,
        "hideZero": true,
        "max": true,
        "min": true,
        "show": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "irate(nginx_connections_processed_total{instance=~\"$instance\", app=~\"$app\", stage=\"handled\", namespace=~\"$namespace\"}[5m])",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "[{{app}}] {{stage}} (Handled connections)",
          "refId": "C"
        },
        {
          "expr": "irate(nginx_connections_processed_total{instance=~\"$instance\", app=~\"$app\", stage=\"accepted\", namespace=~\"$namespace\"}[5m])",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "[{{app}}] {{stage}} (Accepted client connections.)",
          "refId": "B"
        },
        {
          "expr": "irate(nginx_connections_processed_total{instance=~\"$instance\", app=~\"$app\", stage=\"any\", namespace=~\"$namespace\"}[5m])",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "[{{app}}] {{stage}} (Client requests)",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "Processed Connections",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": null,
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "$datasource",
      "format": "s",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 9,
        "w": 2,
        "x": 0,
        "y": 7
      },
      "id": 22,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "expr": "time() - process_start_time_seconds{job=~\"kubernetes-pods\", app=~\"$app\", instance=~\"$instance\", namespace=~\"$namespace\"}",
          "format": "time_series",
          "interval": "",
          "intervalFactor": 2,
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "thresholds": "Up,Down",
      "timeFrom": null,
      "timeShift": null,
      "title": "Exporter Uptime",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "current"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "$datasource",
      "decimals": 0,
      "fill": 1,
      "gridPos": {
        "h": 9,
        "w": 22,
        "x": 2,
        "y": 7
      },
      "id": 24,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "hideEmpty": true,
        "hideZero": true,
        "max": true,
        "min": true,
        "show": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "",
          "expr": "nginx_connections_current{state=\"active\", app=~\"$app\", instance=~\"$instance\", namespace=~\"$namespace\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "[{{app}}] {{state}} (Active client connections including Waiting connections)",
          "rawSql": "SELECT\n  $__time(time_column),\n  value1\nFROM\n  metric_table\nWHERE\n  $__timeFilter(time_column)\n",
          "refId": "A"
        },
        {
          "expr": "nginx_connections_current{state=\"reading\", app=~\"$app\", instance=~\"$instance\", namespace=~\"$namespace\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "[{{app}}] {{state}} (Connections where nginx is reading the request header)",
          "refId": "B"
        },
        {
          "expr": "nginx_connections_current{state=\"writing\", app=~\"$app\", instance=~\"$instance\", namespace=~\"$namespace\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "[{{app}}] {{state}} (Connections where nginx is writing the response back to the client)",
          "refId": "D"
        },
        {
          "expr": "nginx_connections_current{state=\"waiting\", app=~\"$app\", instance=~\"$instance\", namespace=~\"$namespace\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "[{{app}}] {{state}} (Idle client connections waiting for a request)",
          "refId": "C"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "Connections",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": 0,
          "format": "none",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    }
  ],
  "refresh": false,
  "schemaVersion": 16,
  "style": "dark",
  "tags": [
    "nginx",
    "http"
  ],
  "templating": {
    "list": [
      {
        "current": {
          "text": "Prometheus",
          "value": "Prometheus"
        },
        "hide": 0,
        "label": null,
        "name": "datasource",
        "options": [],
        "query": "prometheus",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "allValue": ".*",
        "current": {},
        "datasource": "$datasource",
        "hide": 0,
        "includeAll": true,
        "label": "",
        "multi": false,
        "name": "namespace",
        "options": [],
        "query": "label_values(nginx_up, namespace)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": ".*",
        "current": {},
        "datasource": "$datasource",
        "hide": 0,
        "includeAll": true,
        "label": "",
        "multi": false,
        "name": "app",
        "options": [],
        "query": "label_values(nginx_up{namespace=~\"$namespace\"}, app)",
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": ".*",
        "current": {},
        "datasource": "$datasource",
        "hide": 0,
        "includeAll": true,
        "label": "",
        "multi": false,
        "name": "instance",
        "options": [],
        "query": "label_values(nginx_up{namespace=~\"$namespace\",  app=~\"$app\"}, instance)",
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "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"
    ]
  },
  "timezone": "browser",
  "title": "a Nginx Connections Overview",
  "uid": "InCH_PPiz",
  "version": 1
}