Grafana dashboard: Smokeping blackbox_exporter
Description: Smokeping-like latency and loss graphs from blackbox_exporter and prometheus

This dashboard generates Smokeping-like visualizations from blackbox_exporter measurements stored in prometheus.  With a scrape interval of 15 seconds you get 20 packets every 5 minutes, which is an equivalent resolution to Smokeping, but lower intervals can be used for higher sensitivity.

The "smoke" shows the range of minimum RTT, 10th percentile, 20th percentile ... 90th percentile, and maximum.  The median is shown with a strong green line.  Packet loss is overlaid.

For ICMP probes: probe_icmp_duration_seconds{phase="rtt"} is used, giving the ping time without DNS lookup or other overheads.

For other probes (HTTP or DNS): probe_duration_seconds is used, giving the complete request/response cycle time.

{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__elements": [],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "8.4.2"
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1667428610104,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "#131062",
            "mode": "fixed"
          },
          "custom": {
            "axisLabel": "RTT",
            "axisPlacement": "auto",
            "axisSoftMin": 0,
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "dark-yellow",
                "value": 0.01
              },
              {
                "color": "dark-orange",
                "value": 0.05
              },
              {
                "color": "dark-red",
                "value": 0.1
              }
            ]
          },
          "unit": "s"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "1"
            },
            "properties": [
              {
                "id": "custom.fillBelowTo",
                "value": "0"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "#78787833",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "0.9"
            },
            "properties": [
              {
                "id": "custom.fillBelowTo",
                "value": "0.1"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "#78787833",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "0.8"
            },
            "properties": [
              {
                "id": "custom.fillBelowTo",
                "value": "0.2"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "#78787833",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "0.7"
            },
            "properties": [
              {
                "id": "custom.fillBelowTo",
                "value": "0.3"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "#78787833",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "0.6"
            },
            "properties": [
              {
                "id": "custom.fillBelowTo",
                "value": "0.4"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "#78787833",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "0.5"
            },
            "properties": [
              {
                "id": "custom.lineWidth",
                "value": 2
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "green",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Packet loss"
            },
            "properties": [
              {
                "id": "custom.axisPlacement",
                "value": "right"
              },
              {
                "id": "custom.axisLabel",
                "value": "%loss"
              },
              {
                "id": "unit",
                "value": "percentunit"
              },
              {
                "id": "color",
                "value": {
                  "mode": "thresholds",
                  "seriesBy": "max"
                }
              },
              {
                "id": "custom.lineWidth",
                "value": 1
              },
              {
                "id": "custom.gradientMode",
                "value": "opacity"
              },
              {
                "id": "custom.fillOpacity",
                "value": 25
              },
              {
                "id": "custom.axisSoftMax",
                "value": 0.05
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 10,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "hidden",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "repeat": "instance",
      "repeatDirection": "v",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": true,
          "expr": "min_over_time((\n  (probe_icmp_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\",phase=\"rtt\"}\n  or ignoring(phase) probe_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\"})\n  * ignoring(phase) probe_success > 0\n)[$range:$interval])",
          "interval": "",
          "legendFormat": "0",
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": true,
          "expr": "quantile_over_time(0.1, (\n  (probe_icmp_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\",phase=\"rtt\"}\n  or ignoring(phase) probe_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\"})\n  * ignoring(phase) probe_success > 0\n)[$range:$interval])",
          "hide": false,
          "interval": "",
          "legendFormat": "0.1",
          "refId": "B"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": true,
          "expr": "quantile_over_time(0.2, (\n  (probe_icmp_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\",phase=\"rtt\"}\n  or ignoring(phase) probe_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\"})\n  * ignoring(phase) probe_success > 0\n)[$range:$interval])",
          "hide": false,
          "interval": "",
          "legendFormat": "0.2",
          "refId": "C"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": true,
          "expr": "quantile_over_time(0.3, (\n  (probe_icmp_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\",phase=\"rtt\"}\n  or ignoring(phase) probe_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\"})\n  * ignoring(phase) probe_success > 0\n)[$range:$interval])",
          "hide": false,
          "interval": "",
          "legendFormat": "0.3",
          "refId": "D"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": true,
          "expr": "quantile_over_time(0.4, (\n  (probe_icmp_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\",phase=\"rtt\"}\n  or ignoring(phase) probe_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\"})\n  * ignoring(phase) probe_success > 0\n)[$range:$interval])",
          "hide": false,
          "interval": "",
          "legendFormat": "0.4",
          "refId": "E"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": true,
          "expr": "quantile_over_time(0.5, (\n  (probe_icmp_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\",phase=\"rtt\"}\n  or ignoring(phase) probe_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\"})\n  * ignoring(phase) probe_success > 0\n)[$range:$interval])",
          "hide": false,
          "interval": "",
          "legendFormat": "0.5",
          "refId": "F"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": true,
          "expr": "quantile_over_time(0.6, (\n  (probe_icmp_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\",phase=\"rtt\"}\n  or ignoring(phase) probe_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\"})\n  * ignoring(phase) probe_success > 0\n)[$range:$interval])",
          "hide": false,
          "interval": "",
          "legendFormat": "0.6",
          "refId": "G"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": true,
          "expr": "quantile_over_time(0.7, (\n  (probe_icmp_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\",phase=\"rtt\"}\n  or ignoring(phase) probe_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\"})\n  * ignoring(phase) probe_success > 0\n)[$range:$interval])",
          "hide": false,
          "interval": "",
          "legendFormat": "0.7",
          "refId": "H"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": true,
          "expr": "quantile_over_time(0.8, (\n  (probe_icmp_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\",phase=\"rtt\"}\n  or ignoring(phase) probe_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\"})\n  * ignoring(phase) probe_success > 0\n)[$range:$interval])",
          "hide": false,
          "interval": "",
          "legendFormat": "0.8",
          "refId": "I"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": true,
          "expr": "quantile_over_time(0.9, (\n  (probe_icmp_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\",phase=\"rtt\"}\n  or ignoring(phase) probe_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\"})\n  * ignoring(phase) probe_success > 0\n)[$range:$interval])",
          "hide": false,
          "interval": "",
          "legendFormat": "0.9",
          "refId": "J"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": true,
          "expr": "max_over_time((\n  (probe_icmp_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\",phase=\"rtt\"}\n  or ignoring(phase) probe_duration_seconds{job=\"$job\",module=\"$module\",instance=~\"$instance\"})\n  * ignoring(phase) probe_success > 0\n)[$range:$interval])",
          "hide": false,
          "interval": "",
          "legendFormat": "1",
          "refId": "K"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": true,
          "expr": "1 - avg_over_time(probe_success{job=\"$job\",module=\"$module\",instance=~\"$instance\"}[$range])",
          "hide": false,
          "interval": "",
          "legendFormat": "Packet loss",
          "refId": "L"
        }
      ],
      "title": "$instance",
      "type": "timeseries"
    }
  ],
  "refresh": false,
  "schemaVersion": 35,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {},
        "definition": "label_values(probe_duration_seconds, job)",
        "hide": 0,
        "includeAll": false,
        "label": "Job",
        "multi": false,
        "name": "job",
        "options": [],
        "query": {
          "query": "label_values(probe_duration_seconds, job)",
          "refId": "StandardVariableQuery"
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query",
        "datasource": "${DS_PROMETHEUS}"
      },
      {
        "current": {},
        "definition": "label_values(probe_duration_seconds{job=\"$job\"}, module)",
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "module",
        "options": [],
        "query": {
          "query": "label_values(probe_duration_seconds{job=\"$job\"}, module)",
          "refId": "StandardVariableQuery"
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query",
        "datasource": "${DS_PROMETHEUS}"
      },
      {
        "current": {},
        "definition": "label_values(probe_duration_seconds{job=\"$job\",module=\"$module\"}, instance)",
        "hide": 0,
        "includeAll": false,
        "multi": true,
        "name": "instance",
        "options": [],
        "query": {
          "query": "label_values(probe_duration_seconds{job=\"$job\",module=\"$module\"}, instance)",
          "refId": "StandardVariableQuery"
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query",
        "datasource": "${DS_PROMETHEUS}"
      },
      {
        "auto": false,
        "auto_count": 30,
        "auto_min": "10s",
        "current": {
          "selected": false,
          "text": "5m",
          "value": "5m"
        },
        "description": "The time interval over which probes are averaged",
        "hide": 0,
        "label": "Average over",
        "name": "range",
        "options": [
          {
            "selected": false,
            "text": "1m",
            "value": "1m"
          },
          {
            "selected": false,
            "text": "2m",
            "value": "2m"
          },
          {
            "selected": true,
            "text": "5m",
            "value": "5m"
          },
          {
            "selected": false,
            "text": "10m",
            "value": "10m"
          },
          {
            "selected": false,
            "text": "15m",
            "value": "15m"
          },
          {
            "selected": false,
            "text": "20m",
            "value": "20m"
          },
          {
            "selected": false,
            "text": "30m",
            "value": "30m"
          }
        ],
        "query": "1m,2m,5m,10m,15m,20m,30m",
        "queryValue": "",
        "refresh": 2,
        "skipUrlSync": false,
        "type": "interval"
      },
      {
        "auto": false,
        "auto_count": 30,
        "auto_min": "10s",
        "current": {
          "selected": false,
          "text": "15s",
          "value": "15s"
        },
        "description": "The time period between individual probes",
        "hide": 0,
        "label": "Sample interval",
        "name": "interval",
        "options": [
          {
            "selected": false,
            "text": "1s",
            "value": "1s"
          },
          {
            "selected": false,
            "text": "2s",
            "value": "2s"
          },
          {
            "selected": false,
            "text": "5s",
            "value": "5s"
          },
          {
            "selected": false,
            "text": "10s",
            "value": "10s"
          },
          {
            "selected": true,
            "text": "15s",
            "value": "15s"
          },
          {
            "selected": false,
            "text": "30s",
            "value": "30s"
          },
          {
            "selected": false,
            "text": "1m",
            "value": "1m"
          }
        ],
        "query": "1s,2s,5s,10s,15s,30s,1m",
        "queryValue": "",
        "refresh": 2,
        "skipUrlSync": false,
        "type": "interval"
      }
    ]
  },
  "time": {
    "from": "2022-11-02T12:30:00.000Z",
    "to": "2022-11-02T18:29:59.000Z"
  },
  "timepicker": {
    "refresh_intervals": [
      "15s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ]
  },
  "timezone": "",
  "title": "Smokeping blackbox_exporter",
  "uid": "L4MYHlW4z",
  "version": 18,
  "weekStart": "",
  "gnetId": 17335,
  "description": "Smokeping-like latency and loss graphs from blackbox_exporter and prometheus"
}