Grafana dashboard: Certificates
Description: A Grafana Dashboard for visualizing the data collected by the x509_cert Telegraf plugin for InfluxDB.

# Certificates

A Grafana Dashboard for visualizing the data collected by the x509_cert Telegraf plugin for InfluxDB.

The main purpose of this dashboard is to notify you about a certificate expiry but it can also display other certificate errors.
What is more, you can examine certificate chains by filtering your certificates by source.

You can contribute to the dashboard at: [Glusk/x509_cert-grafana-dashboard](https://github.com/Glusk/x509_cert-grafana-dashboard)

{
  "__inputs": [
    {
      "name": "DS_SSL_CERTS_INFO",
      "label": "ssl_certs_info",
      "description": "The name of the InfluxDB database that stores your x509_cert metrics",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "7.5.10"
    },
    {
      "type": "datasource",
      "id": "influxdb",
      "name": "InfluxDB",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": 16466,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1657317837594,
  "links": [],
  "panels": [
    {
      "datasource": "${DS_SSL_CERTS_INFO}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "rgb(0, 0, 0)",
            "mode": "fixed"
          },
          "custom": {
            "align": null,
            "displayMode": "color-background",
            "filterable": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Source"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "rgb(83, 154, 190)",
                  "mode": "fixed"
                }
              },
              {
                "id": "custom.displayMode",
                "value": "color-text"
              },
              {
                "id": "custom.filterable",
                "value": true
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Verification error message"
            },
            "properties": [
              {
                "id": "color"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Serial Number"
            },
            "properties": [
              {
                "id": "custom.filterable",
                "value": true
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 15,
        "w": 11,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "options": {
        "frameIndex": 5,
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "7.5.10",
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "source"
              ],
              "type": "tag"
            },
            {
              "params": [
                "serial_number"
              ],
              "type": "tag"
            }
          ],
          "limit": "1",
          "measurement": "x509_cert",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT \"startdate\"  * 1000, \"enddate\"  * 1000, \"expiry\", \"verification_error\", \"verification_code\" FROM \"x509_cert\" WHERE (\"environment\" =~ /^$environment$/ AND \"zone\" =~ /^$zone$/ AND \"verification\" = 'invalid') AND $timeFilter GROUP BY \"source\", \"serial_number\" LIMIT 1",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "table",
          "select": [
            [
              {
                "params": [
                  "startdate"
                ],
                "type": "field"
              },
              {
                "params": [
                  " * 1000"
                ],
                "type": "math"
              }
            ],
            [
              {
                "params": [
                  "enddate"
                ],
                "type": "field"
              },
              {
                "params": [
                  " * 1000"
                ],
                "type": "math"
              }
            ],
            [
              {
                "params": [
                  "expiry"
                ],
                "type": "field"
              }
            ],
            [
              {
                "params": [
                  "verification_error"
                ],
                "type": "field"
              }
            ],
            [
              {
                "params": [
                  "verification_code"
                ],
                "type": "field"
              }
            ]
          ],
          "tags": [
            {
              "key": "environment",
              "operator": "=~",
              "value": "/^$environment$/"
            },
            {
              "condition": "AND",
              "key": "zone",
              "operator": "=~",
              "value": "/^$zone$/"
            },
            {
              "condition": "AND",
              "key": "verification",
              "operator": "=",
              "value": "invalid"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Invalid certificates",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true,
              "enddate": true,
              "expiry": true,
              "startdate": true,
              "verification_code": true,
              "verification_error": false
            },
            "indexByName": {
              "Time": 0,
              "enddate": 5,
              "expiry": 6,
              "serial_number": 3,
              "source": 1,
              "startdate": 4,
              "verification_code": 7,
              "verification_error": 2
            },
            "renameByName": {
              "Expiry": "Expires in",
              "enddate": "Valid until",
              "expiry": "Expires in",
              "serial_number": "Serial Number",
              "source": "Source",
              "startdate": "Valid from",
              "startdate_1": "Expires in",
              "verification_code": "Status",
              "verification_error": "Verification error message"
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": "${DS_SSL_CERTS_INFO}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "rgb(0, 0, 0)",
            "mode": "fixed"
          },
          "custom": {
            "align": null,
            "displayMode": "color-background",
            "filterable": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Expires in"
            },
            "properties": [
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "red",
                      "value": null
                    },
                    {
                      "color": "orange",
                      "value": 604800
                    },
                    {
                      "color": "green",
                      "value": 2630000
                    }
                  ]
                }
              },
              {
                "id": "unit",
                "value": "s"
              },
              {
                "id": "color"
              },
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Valid from"
            },
            "properties": [
              {
                "id": "unit",
                "value": "dateTimeAsIso"
              },
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Valid until"
            },
            "properties": [
              {
                "id": "unit",
                "value": "dateTimeAsIso"
              },
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Source"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "color-text"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "rgb(83, 154, 190)",
                  "mode": "fixed"
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 15,
        "w": 13,
        "x": 11,
        "y": 0
      },
      "id": 5,
      "options": {
        "frameIndex": 5,
        "showHeader": true,
        "sortBy": [
          {
            "desc": false,
            "displayName": "Expires in"
          }
        ]
      },
      "pluginVersion": "7.5.10",
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "source"
              ],
              "type": "tag"
            },
            {
              "params": [
                "serial_number"
              ],
              "type": "tag"
            }
          ],
          "limit": "1",
          "measurement": "x509_cert",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT \"startdate\" * 1000, \"enddate\"  * 1000, \"expiry\", \"verification_error\", \"verification_code\" FROM \"x509_cert\" WHERE (\"environment\" =~ /^$environment$/ AND \"zone\" =~ /^$zone$/) AND $timeFilter GROUP BY \"source\", \"serial_number\" LIMIT 1",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "table",
          "select": [
            [
              {
                "params": [
                  "startdate"
                ],
                "type": "field"
              },
              {
                "params": [
                  "* 1000"
                ],
                "type": "math"
              }
            ],
            [
              {
                "params": [
                  "enddate"
                ],
                "type": "field"
              },
              {
                "params": [
                  " * 1000"
                ],
                "type": "math"
              }
            ],
            [
              {
                "params": [
                  "expiry"
                ],
                "type": "field"
              }
            ],
            [
              {
                "params": [
                  "verification_error"
                ],
                "type": "field"
              }
            ],
            [
              {
                "params": [
                  "verification_code"
                ],
                "type": "field"
              }
            ]
          ],
          "tags": [
            {
              "key": "environment",
              "operator": "=~",
              "value": "/^$environment$/"
            },
            {
              "condition": "AND",
              "key": "zone",
              "operator": "=~",
              "value": "/^$zone$/"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Certificate  expiration list",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true,
              "common_name": true,
              "enddate": false,
              "startdate": false,
              "verification_code": true,
              "verification_error": true
            },
            "indexByName": {
              "Time": 0,
              "enddate": 4,
              "expiry": 5,
              "serial_number": 2,
              "source": 1,
              "startdate": 3,
              "verification_code": 6,
              "verification_error": 7
            },
            "renameByName": {
              "Expiry": "Expires in",
              "enddate": "Valid until",
              "expiry": "Expires in",
              "serial_number": "Serial number",
              "source": "Source",
              "startdate": "Valid from",
              "startdate_1": "Expires in",
              "verification_code": "Status",
              "verification_error": "Verification error/warning message"
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": "${DS_SSL_CERTS_INFO}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "rgb(0, 0, 0)",
            "mode": "fixed"
          },
          "custom": {
            "align": null,
            "displayMode": "color-background",
            "filterable": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Source"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "color-text"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "rgb(83, 154, 190)",
                  "mode": "fixed"
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 7,
        "w": 24,
        "x": 0,
        "y": 15
      },
      "id": 10,
      "options": {
        "frameIndex": 5,
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "7.5.10",
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "source"
              ],
              "type": "tag"
            },
            {
              "params": [
                "common_name"
              ],
              "type": "tag"
            },
            {
              "params": [
                "country"
              ],
              "type": "tag"
            },
            {
              "params": [
                "issuer_common_name"
              ],
              "type": "tag"
            },
            {
              "params": [
                "locality"
              ],
              "type": "tag"
            },
            {
              "params": [
                "organization"
              ],
              "type": "tag"
            },
            {
              "params": [
                "organizational_unit"
              ],
              "type": "tag"
            },
            {
              "params": [
                "province"
              ],
              "type": "tag"
            },
            {
              "params": [
                "public_key_algorithm"
              ],
              "type": "tag"
            },
            {
              "params": [
                "signature_algorithm"
              ],
              "type": "tag"
            },
            {
              "params": [
                "serial_number"
              ],
              "type": "tag"
            },
            {
              "params": [
                "san"
              ],
              "type": "tag"
            }
          ],
          "limit": "1",
          "measurement": "x509_cert",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT \"expiry\" FROM \"x509_cert\" WHERE (\"environment\" =~ /^$environment$/ AND \"zone\" =~ /^$zone$/) AND $timeFilter GROUP BY \"source\", \"common_name\", \"country\", \"issuer_common_name\", \"locality\", \"organization\", \"organizational_unit\", \"province\", \"public_key_algorithm\", \"signature_algorithm\", \"serial_number\", \"san\" LIMIT 1",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "table",
          "select": [
            [
              {
                "params": [
                  "expiry"
                ],
                "type": "field"
              }
            ]
          ],
          "tags": [
            {
              "key": "environment",
              "operator": "=~",
              "value": "/^$environment$/"
            },
            {
              "condition": "AND",
              "key": "zone",
              "operator": "=~",
              "value": "/^$zone$/"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Certificate  details",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true,
              "enddate": true,
              "expiry": true,
              "startdate": true,
              "verification_code": true,
              "verification_error": true
            },
            "indexByName": {
              "Time": 0,
              "common_name": 9,
              "country": 4,
              "expiry": 3,
              "issuer_common_name": 10,
              "locality": 6,
              "organization": 7,
              "organizational_unit": 8,
              "province": 5,
              "public_key_algorithm": 11,
              "san": 13,
              "serial_number": 2,
              "signature_algorithm": 12,
              "source": 1
            },
            "renameByName": {
              "Expiry": "Expires in",
              "enddate": "Valid until",
              "expiry": "Expires in",
              "serial_number": "Serial Number",
              "source": "Source",
              "startdate": "Valid from",
              "startdate_1": "Expires in",
              "verification_code": "Status",
              "verification_error": "Verification error/warning message"
            }
          }
        }
      ],
      "type": "table"
    }
  ],
  "refresh": false,
  "schemaVersion": 27,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "ssl_certs_info",
          "value": "ssl_certs_info"
        },
        "description": "And InfluxDB datasource with measurement \"x509_cert\"",
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": "x509_cert datasource",
        "multi": false,
        "name": "x509_cert",
        "options": [],
        "query": "influxdb",
        "queryValue": "",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_SSL_CERTS_INFO}",
        "definition": "SHOW TAG VALUES ON \"ssl_certs_info\" WITH KEY = \"zone\"",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "zone",
        "options": [],
        "query": "SHOW TAG VALUES ON \"ssl_certs_info\" WITH KEY = \"zone\"",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_SSL_CERTS_INFO}",
        "definition": "SHOW TAG VALUES ON \"ssl_certs_info\" WITH KEY = \"environment\"",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "environment",
        "options": [],
        "query": "SHOW TAG VALUES ON \"ssl_certs_info\" WITH KEY = \"environment\"",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-24h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Certificates",
  "uid": "TJzB-KX7z",
  "version": 92,
  "description": "A Grafana Dashboard for visualizing the data collected by the x509_cert Telegraf plugin for InfluxDB."
}