Grafana dashboard: SSL Monitoring x509
Description: telegraf x509 ssl monitoring (influxdb2)

# influxdb2 / telegraf
x509 SSL certificates

remaining time monitoring

used `telegraf`


[[inputs.x509_cert]]
  sources = ["https://example.com:443", "https://example2.com:8200",
            "https://test.example.com:443" ]

{
  "__inputs": [
    {
      "name": "DS_INFLUXDB",
      "label": "InfluxDB",
      "description": "influxdb2",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    }
  ],
  "__elements": [],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.0.0"
    },
    {
      "type": "datasource",
      "id": "influxdb",
      "name": "InfluxDB",
      "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": "grafana",
          "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,
  "iteration": 1655458793186,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 0,
          "displayName": "${__field.labels.common_name}",
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "semi-dark-red",
                "value": null
              },
              {
                "color": "yellow",
                "value": 14
              },
              {
                "color": "dark-green",
                "value": 30
              }
            ]
          },
          "unit": "days"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 0,
        "y": 0
      },
      "id": 4,
      "maxPerRow": 12,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "center",
        "orientation": "vertical",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "text": {
          "titleSize": 10
        },
        "textMode": "value"
      },
      "pluginVersion": "9.0.0",
      "repeat": "cert",
      "repeatDirection": "h",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB}"
          },
          "query": "from(bucket: \"${buckets}\")\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => r[\"_measurement\"] == \"${measurements}\")\n  |> filter(fn: (r) => r[\"common_name\"] == \"${cert}\")\n  |> filter(fn: (r) => r[\"_field\"] == \"expiry\")\n  |> map(fn: (r) => ({ r with _value: r._value / 60 / 60 / 24 }))\n  |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)\n  |> yield(name: \"last\")",
          "refId": "A"
        }
      ],
      "title": "${cert}",
      "transformations": [],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "_value"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 287
              },
              {
                "id": "custom.displayMode",
                "value": "color-background"
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "semi-dark-red",
                      "value": null
                    },
                    {
                      "color": "yellow",
                      "value": 14
                    },
                    {
                      "color": "dark-green",
                      "value": 30
                    }
                  ]
                }
              },
              {
                "id": "unit",
                "value": "days"
              },
              {
                "id": "decimals",
                "value": 0
              },
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "verification"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "color-background"
              },
              {
                "id": "mappings",
                "value": [
                  {
                    "options": {
                      "invalid": {
                        "color": "dark-red",
                        "index": 0
                      },
                      "valid": {
                        "color": "dark-green",
                        "index": 1
                      }
                    },
                    "type": "value"
                  }
                ]
              },
              {
                "id": "custom.width",
                "value": 117
              },
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "issuer common name"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 165
              },
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "signature_algorithm"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 175
              },
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "algorithm"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 115
              },
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "cert"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 228
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 10,
        "w": 24,
        "x": 0,
        "y": 4
      },
      "id": 19,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "frameIndex": 3,
        "showHeader": true,
        "sortBy": [
          {
            "desc": false,
            "displayName": "expire"
          }
        ]
      },
      "pluginVersion": "9.0.0",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB}"
          },
          "query": "from(bucket: \"nnzbucket\")\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => r[\"_measurement\"] == \"${measurements}\")\n  |> filter(fn: (r) => r[\"_field\"] == \"expiry\")\n  |> group(columns: [\"common_name\"])\n  |> map(fn: (r) => ({ r with _value: r._value / 60 / 60 / 24 }))\n  |> tail(n: 1)\n  |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)\n  |> yield(name: \"last\")",
          "refId": "A"
        }
      ],
      "title": "Table",
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "_field": true,
              "_measurement": true,
              "_time": true,
              "country": true,
              "host": true,
              "issuer_common_name": false,
              "organization": true,
              "san": false,
              "serial_number": false,
              "source": true,
              "verification": false
            },
            "indexByName": {
              "_field": 6,
              "_measurement": 5,
              "_time": 9,
              "_value": 1,
              "country": 7,
              "host": 8,
              "issuer_common_name": 10,
              "organization": 11,
              "public_key_algorithm": 3,
              "san": 0,
              "serial_number": 12,
              "signature_algorithm": 4,
              "source": 13,
              "verification": 2
            },
            "renameByName": {
              "_field": "",
              "_value": "expire",
              "issuer_common_name": "issuer common name",
              "organization": "",
              "public_key_algorithm": "algorithm",
              "san": "cert",
              "serial_number": "",
              "signature_algorithm": "",
              "verification": ""
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "smooth",
            "lineWidth": 2,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "displayName": "${__field.labels.common_name}",
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "hours"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 10,
        "w": 24,
        "x": 0,
        "y": 14
      },
      "id": 25,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "right"
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.0.0",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB}"
          },
          "query": "from(bucket: \"nnzbucket\")\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => r[\"_measurement\"] == \"${measurements}\")\n  |> filter(fn: (r) => r[\"_field\"] == \"expiry\")\n  |> group(columns: [\"common_name\"])\n  |> map(fn: (r) => ({ r with _value: r._value / 60 / 60 }))\n  |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)\n  |> yield(name: \"last\")",
          "refId": "A"
        }
      ],
      "title": "Time series",
      "transformations": [],
      "type": "timeseries"
    }
  ],
  "schemaVersion": 36,
  "style": "dark",
  "tags": [
    "x509",
    "ssl",
    "cert"
  ],
  "templating": {
    "list": [
      {
        "current": {},
        "datasource": {
          "type": "influxdb",
          "uid": "${DS_INFLUXDB}"
        },
        "definition": "buckets()",
        "hide": 2,
        "includeAll": false,
        "multi": false,
        "name": "buckets",
        "options": [],
        "query": "buckets()",
        "refresh": 1,
        "regex": "/^[a-zA-Z0-9]/",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {},
        "datasource": {
          "type": "influxdb",
          "uid": "${DS_INFLUXDB}"
        },
        "definition": "import \"influxdata/influxdb/schema\"\n\nschema.measurements(bucket: \"${buckets}\")",
        "hide": 2,
        "includeAll": false,
        "multi": false,
        "name": "measurements",
        "options": [],
        "query": "import \"influxdata/influxdb/schema\"\n\nschema.measurements(bucket: \"${buckets}\")",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {},
        "datasource": {
          "type": "influxdb",
          "uid": "${DS_INFLUXDB}"
        },
        "definition": "import \"influxdata/influxdb/schema\"\n\nschema.measurementTagValues(\n    bucket: \"${buckets}\",\n    tag: \"common_name\",\n    measurement: \"${measurements}\",\n)",
        "hide": 0,
        "includeAll": true,
        "multi": false,
        "name": "cert",
        "options": [],
        "query": "import \"influxdata/influxdb/schema\"\n\nschema.measurementTagValues(\n    bucket: \"${buckets}\",\n    tag: \"common_name\",\n    measurement: \"${measurements}\",\n)",
        "refresh": 1,
        "regex": "/^(?!R3|ISRG Root X1).*/",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      }
    ]
  },
  "time": {
    "from": "now-2d",
    "to": "now"
  },
  "timepicker": {
    "hidden": false,
    "refresh_intervals": [
      "12h"
    ]
  },
  "timezone": "",
  "title": "SSL Monitoring x509",
  "uid": "sRPtVQC7k",
  "version": 49,
  "weekStart": "",
  "gnetId": 16465,
  "description": "telegraf x509 ssl monitoring (influxdb2)"
}