Grafana dashboard: OPNSense Metrics

This will gather usage metrics, filterlog, and unbound logs from opnsense. These configs are are a part of ShiftMon. The full ShiftMon setup for metrics, logs, and grafana can be found below. 

https://gitlab.com/shiftsystems/shift-rmm

{
  "__inputs": [
    {
      "name": "DS_SHIFT-METRICS",
      "label": "shift-metrics",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    },
    {
      "name": "DS_SHIFT-LOGS",
      "label": "shift-logs",
      "description": "",
      "type": "datasource",
      "pluginId": "loki",
      "pluginName": "Loki"
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "panel",
      "id": "bargauge",
      "name": "Bar gauge",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.3.6"
    },
    {
      "type": "panel",
      "id": "logs",
      "name": "Logs",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "loki",
      "name": "Loki",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "piechart",
      "name": "Pie chart",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "datasource",
          "uid": "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,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_SHIFT-METRICS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "bytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 3,
        "x": 0,
        "y": 0
      },
      "id": 24,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_SHIFT-METRICS}"
          },
          "exemplar": false,
          "expr": "mem_total{host=\"$host\",db=\"opnsense\"}",
          "instant": true,
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "title": "Memory",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_SHIFT-METRICS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 3,
        "x": 3,
        "y": 0
      },
      "id": 22,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_SHIFT-METRICS}"
          },
          "exemplar": true,
          "expr": "system_n_cpus{host=\"$host\",db=\"opnsense\"}",
          "instant": true,
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "title": "CPU Count",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_SHIFT-METRICS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 4,
        "x": 6,
        "y": 0
      },
      "id": 20,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_SHIFT-METRICS}"
          },
          "exemplar": true,
          "expr": "(system_uptime{host=\"$host\",db=\"opnsense\"}) / 86400",
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "title": "uptime in days",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_SHIFT-METRICS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "bytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 10,
        "x": 10,
        "y": 0
      },
      "id": 26,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_SHIFT-METRICS}"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "disk_total{host=\"$host\",db=\"opnsense\",fstype!=\"devfs\",path!~`/var/.*|/usr/.*`}",
          "instant": true,
          "interval": "",
          "legendFormat": "{{path}}",
          "refId": "A"
        }
      ],
      "title": "Disk Size",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true
            },
            "indexByName": {},
            "renameByName": {}
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${DS_SHIFT-LOGS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "center",
            "displayMode": "auto",
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 20,
        "y": 0
      },
      "id": 16,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "frameIndex": 0,
        "showHeader": false
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "${DS_SHIFT-LOGS}"
          },
          "editorMode": "code",
          "expr": "{host=\"$host\",__name=\"exec\"} |~ \"OPNsense\"",
          "hide": false,
          "instant": false,
          "queryType": "range",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "OS Version",
      "transformations": [
        {
          "id": "reduce",
          "options": {
            "includeTimeField": false,
            "mode": "reduceFields",
            "reducers": [
              "lastNotNull"
            ]
          }
        },
        {
          "id": "extractFields",
          "options": {
            "source": "Line"
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Field": true,
              "Line": true,
              "id": true,
              "labels": true,
              "tsNs": true
            },
            "indexByName": {},
            "renameByName": {}
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_SHIFT-METRICS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 0,
        "y": 2
      },
      "id": 2,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_SHIFT-METRICS}"
          },
          "editorMode": "code",
          "exemplar": true,
          "expr": "100 - cpu_usage_idle{host=\"$host\",db=\"opnsense\",cpu=\"cpu-total\"}",
          "interval": "",
          "legendFormat": "",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "CPU Percent",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_SHIFT-METRICS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 7,
        "x": 6,
        "y": 2
      },
      "id": 4,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_SHIFT-METRICS}"
          },
          "exemplar": true,
          "expr": "mem_used_percent{db=\"opnsense\",host=\"$host\"}",
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "title": "Percent Memory",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_SHIFT-METRICS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "#EAB839",
                "value": 50
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 7,
        "x": 13,
        "y": 2
      },
      "id": 6,
      "options": {
        "displayMode": "lcd",
        "minVizHeight": 10,
        "minVizWidth": 0,
        "orientation": "vertical",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true,
        "text": {}
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_SHIFT-METRICS}"
          },
          "editorMode": "code",
          "exemplar": true,
          "expr": "disk_used_percent{host=\"$host\",db=\"opnsense\",fstype!=\"devfs\",path!~`/var/.*|/usr/.*`}",
          "interval": "",
          "legendFormat": "{{path}}",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "disk usage",
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_SHIFT-METRICS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 20,
        "y": 3
      },
      "id": 44,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_SHIFT-METRICS}"
          },
          "editorMode": "code",
          "exemplar": true,
          "expr": "pf_state_limit{host=\"$host\",db=\"opnsense\"}",
          "interval": "",
          "legendFormat": "",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "States Limited",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_SHIFT-METRICS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "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": "red",
                "value": 80
              }
            ]
          },
          "unit": "binBps"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 10,
        "w": 6,
        "x": 0,
        "y": 6
      },
      "id": 8,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "max",
            "mean"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "none"
        }
      },
      "pluginVersion": "8.0.5",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_SHIFT-METRICS}"
          },
          "exemplar": true,
          "expr": "deriv(net_bytes_recv{host=\"$host\",db=\"opnsense\"})",
          "interval": "",
          "legendFormat": "{{interface}}",
          "refId": "A"
        }
      ],
      "title": "Inbound Traffic",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_SHIFT-METRICS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "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": "red",
                "value": 80
              }
            ]
          },
          "unit": "binBps"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 10,
        "w": 7,
        "x": 6,
        "y": 6
      },
      "id": 10,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "max",
            "mean"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "none"
        }
      },
      "pluginVersion": "8.0.5",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_SHIFT-METRICS}"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "deriv(net_bytes_sent{host=\"$host\",db=\"opnsense\"}) / 1000000",
          "instant": false,
          "interval": "",
          "legendFormat": "{{interface}}",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Outbound Traffic",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_SHIFT-METRICS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 20,
        "y": 7
      },
      "id": 12,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_SHIFT-METRICS}"
          },
          "exemplar": true,
          "expr": "system_load1{host=\"$host\",db=\"opnsense\"}",
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "title": "Load 1",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_SHIFT-METRICS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "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": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 7,
        "x": 13,
        "y": 8
      },
      "id": 43,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "min",
            "max",
            "mean"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_SHIFT-METRICS}"
          },
          "editorMode": "code",
          "expr": "pf_entries{}",
          "legendFormat": "states",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Current PF States",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_SHIFT-METRICS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 4,
        "x": 20,
        "y": 11
      },
      "id": 18,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_SHIFT-METRICS}"
          },
          "exemplar": true,
          "expr": "system_load15{host=\"$host\",db=\"opnsense\"}",
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "title": "Load 15",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${DS_SHIFT-LOGS}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": []
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 0,
        "y": 16
      },
      "id": 36,
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "right",
          "showLegend": true,
          "values": [
            "value"
          ]
        },
        "pieType": "donut",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "",
          "values": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "8.3.4",
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "${DS_SHIFT-LOGS}"
          },
          "expr": "topk(20,sum(count_over_time({__name=\"syslog\",hostname=\"$host\",appname=\"filterlog\"} |~ \".*$interface.*out.*\" | pattern `<_>,,,<rule_id>,<interface>,<reason>,<action>,<direction>,<version>,<tos>,,<ttl>,<id>,<offset>,<ipflags>,<protonum>,<protocol>,<length>,<source_ip>,<dest_ip>,`[1m])) by (source_ip))",
          "legendFormat": "{{ source_ip }}",
          "refId": "A"
        }
      ],
      "title": "top outbound talkers",
      "type": "piechart"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${DS_SHIFT-LOGS}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": []
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 8,
        "y": 16
      },
      "id": 40,
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "right",
          "showLegend": true,
          "values": [
            "value"
          ]
        },
        "pieType": "donut",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "",
          "values": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "8.3.4",
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "${DS_SHIFT-LOGS}"
          },
          "expr": "topk(5,sum(count_over_time({__name=\"syslog\",hostname=\"$host\",appname=\"filterlog\"} |~ \".*$interface.*in.*\" | pattern `<_>,,,<rule_id>,<interface>,<reason>,<action>,<direction>,<version>,<tos>,,<ttl>,<id>,<offset>,<ipflags>,<protonum>,<protocol>,<length>,<source_ip>,<dest_ip>,`[1m])) by (source_ip))",
          "legendFormat": "{{ source_ip }}",
          "refId": "A"
        }
      ],
      "title": "inbound talkers",
      "type": "piechart"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${DS_SHIFT-LOGS}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": [
            {
              "options": {
                "pattern": "443",
                "result": {
                  "index": 1,
                  "text": "HTTP"
                }
              },
              "type": "regex"
            }
          ]
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 16,
        "y": 16
      },
      "id": 41,
      "options": {
        "displayLabels": [],
        "legend": {
          "displayMode": "table",
          "placement": "right",
          "showLegend": true,
          "values": [
            "percent",
            "value"
          ]
        },
        "pieType": "donut",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "",
          "values": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "${DS_SHIFT-LOGS}"
          },
          "expr": "topk(15,sum(count_over_time({__name=\"syslog\",hostname=\"$host\",appname=\"filterlog\"} |~ \".*$interface.*out.*\" | pattern `<_>,,,<rule_id>,<interface>,<reason>,<action>,<direction>,<version>,<tos>,,<ttl>,<id>,<offset>,<ipflags>,<protonum>,<protocol>,<length>,<source_ip>,<dest_ip>,<source_port>,<dest_port>,`[1m])) by (dest_port))",
          "legendFormat": "{{ dest_port }}",
          "refId": "A"
        }
      ],
      "title": "Dest ports",
      "type": "piechart"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${DS_SHIFT-LOGS}"
      },
      "gridPos": {
        "h": 10,
        "w": 21,
        "x": 0,
        "y": 25
      },
      "id": 29,
      "options": {
        "dedupStrategy": "none",
        "enableLogDetails": true,
        "prettifyLogMessage": false,
        "showCommonLabels": false,
        "showLabels": false,
        "showTime": false,
        "sortOrder": "Descending",
        "wrapLogMessage": false
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "${DS_SHIFT-LOGS}"
          },
          "expr": "{__name=\"suricata\",host=\"$host\"}| logfmt",
          "refId": "A"
        }
      ],
      "title": "Suricata alerts",
      "transformations": [],
      "type": "logs"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${DS_SHIFT-LOGS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green"
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 10,
        "w": 3,
        "x": 21,
        "y": 25
      },
      "id": 45,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "${DS_SHIFT-LOGS}"
          },
          "editorMode": "builder",
          "expr": "count(rate({__name=\"suricata\", host=\"$host\"} [$__range]))",
          "queryType": "range",
          "refId": "A"
        }
      ],
      "title": "Suricata alerts",
      "transformations": [],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${DS_SHIFT-LOGS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": []
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 5,
        "x": 0,
        "y": 35
      },
      "id": 33,
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "right",
          "showLegend": true,
          "values": [
            "value"
          ]
        },
        "pieType": "donut",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "/^ts \\(count\\)$/",
          "values": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "8.3.2",
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "${DS_SHIFT-LOGS}"
          },
          "editorMode": "code",
          "expr": "{__name=\"resolver\",host=\"$host\"} | logfmt",
          "queryType": "range",
          "refId": "A"
        }
      ],
      "title": "Queried Domains",
      "transformations": [
        {
          "id": "labelsToFields",
          "options": {}
        },
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "domain": {
                "aggregations": [],
                "operation": "groupby"
              },
              "id": {
                "aggregations": [
                  "count"
                ]
              },
              "querying_ip": {
                "aggregations": []
              },
              "ts": {
                "aggregations": [
                  "count"
                ],
                "operation": "aggregate"
              }
            }
          }
        }
      ],
      "type": "piechart"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${DS_SHIFT-LOGS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": []
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 7,
        "x": 5,
        "y": 35
      },
      "id": 32,
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "right",
          "showLegend": true,
          "values": [
            "value"
          ]
        },
        "pieType": "donut",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "/^ts \\(count\\)$/",
          "values": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "8.3.2",
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "${DS_SHIFT-LOGS}"
          },
          "editorMode": "code",
          "expr": "{__name=\"resolver\",host=\"$host\"} | logfmt",
          "queryType": "range",
          "refId": "A"
        }
      ],
      "title": "Querying IPs",
      "transformations": [
        {
          "id": "labelsToFields",
          "options": {
            "valueLabel": "path"
          }
        },
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "id": {
                "aggregations": [
                  "count"
                ]
              },
              "querying_ip": {
                "aggregations": [],
                "operation": "groupby"
              },
              "ts": {
                "aggregations": [
                  "count"
                ],
                "operation": "aggregate"
              }
            }
          }
        }
      ],
      "type": "piechart"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${DS_SHIFT-LOGS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green"
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 35
      },
      "id": 31,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "${DS_SHIFT-LOGS}"
          },
          "editorMode": "code",
          "expr": "{__name=\"resolver\",host=\"$host\"} | logfmt",
          "queryType": "range",
          "refId": "A"
        }
      ],
      "title": "unbound logs",
      "transformations": [
        {
          "id": "labelsToFields",
          "options": {}
        },
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "__name": true,
              "host": true,
              "hostname": true,
              "id": true,
              "level": true,
              "line": true,
              "path": true,
              "pid": true,
              "thread": true,
              "timestamp": false,
              "ts": true,
              "tsNs": true
            },
            "indexByName": {
              "__name": 9,
              "domain": 1,
              "host": 11,
              "hostname": 12,
              "id": 7,
              "level": 13,
              "line": 6,
              "path": 14,
              "pid": 10,
              "querying_ip": 2,
              "record_type": 3,
              "thread": 5,
              "timestamp": 0,
              "ts": 4,
              "tsNs": 8
            },
            "renameByName": {}
          }
        }
      ],
      "type": "table"
    }
  ],
  "refresh": "",
  "schemaVersion": 37,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {},
        "datasource": {
          "type": "prometheus",
          "uid": "${DS_SHIFT-METRICS}"
        },
        "definition": "label_values(cpu_usage_idle{db=\"opnsense\"},host)",
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "host",
        "options": [],
        "query": {
          "query": "label_values(cpu_usage_idle{db=\"opnsense\"},host)",
          "refId": "StandardVariableQuery"
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {
          "selected": false,
          "text": "shift-metrics",
          "value": "shift-metrics"
        },
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "metrics",
        "options": [],
        "query": "prometheus",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "current": {
          "selected": false,
          "text": "shift-logs",
          "value": "shift-logs"
        },
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "logs",
        "options": [],
        "query": "loki",
        "queryValue": "",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "current": {},
        "datasource": {
          "type": "prometheus",
          "uid": "${DS_SHIFT-METRICS}"
        },
        "definition": "label_values(net_bytes_sent{db=\"opnsense\",host=\"$host\"},interface)",
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "interface",
        "options": [],
        "query": {
          "query": "label_values(net_bytes_sent{db=\"opnsense\",host=\"$host\"},interface)",
          "refId": "StandardVariableQuery"
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      }
    ]
  },
  "time": {
    "from": "now-1h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "OPNSense Metrics",
  "uid": "CqBhDX77z",
  "version": 6,
  "weekStart": "",
  "gnetId": 16052
}