Grafana dashboard: localcert-exporter
Description: localcert exporter pour connaitre les dates de création et expiration des certificats en *.prem

* https://hub.docker.com/repository/docker/hetimop/localcert-exporter/general
* https://github.com/Hetimop/localcert-exporter

{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "Prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.3.6"
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "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,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "left",
            "displayMode": "color-text",
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Date d'expiration"
            },
            "properties": [
              {
                "id": "unit",
                "value": "dateTimeAsLocal"
              },
              {
                "id": "custom.align",
                "value": "left"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Date de création"
            },
            "properties": [
              {
                "id": "unit",
                "value": "dateTimeAsLocal"
              },
              {
                "id": "custom.width",
                "value": 188
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Hôte"
            },
            "properties": [
              {
                "id": "mappings",
                "value": [
                  {
                    "options": {
                      "pattern": "([^:]+):.+",
                      "result": {
                        "index": 0,
                        "text": "$1"
                      }
                    },
                    "type": "regex"
                  }
                ]
              },
              {
                "id": "custom.width",
                "value": 148
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Jours réstants"
            },
            "properties": [
              {
                "id": "mappings",
                "value": [
                  {
                    "options": {
                      "from": -9999,
                      "result": {
                        "color": "#000000",
                        "index": 0
                      },
                      "to": -1
                    },
                    "type": "range"
                  },
                  {
                    "options": {
                      "from": 0,
                      "result": {
                        "color": "red",
                        "index": 1
                      },
                      "to": 10
                    },
                    "type": "range"
                  },
                  {
                    "options": {
                      "from": 11,
                      "result": {
                        "color": "orange",
                        "index": 2
                      },
                      "to": 15
                    },
                    "type": "range"
                  },
                  {
                    "options": {
                      "from": 16,
                      "result": {
                        "color": "green",
                        "index": 3
                      },
                      "to": 30
                    },
                    "type": "range"
                  },
                  {
                    "options": {
                      "from": 31,
                      "result": {
                        "color": "dark-green",
                        "index": 4
                      },
                      "to": 100
                    },
                    "type": "range"
                  },
                  {
                    "options": {
                      "from": 101,
                      "result": {
                        "color": "dark-blue",
                        "index": 5
                      },
                      "to": 999999
                    },
                    "type": "range"
                  },
                  {
                    "options": {
                      "match": "null",
                      "result": {
                        "color": "transparent",
                        "index": 6
                      }
                    },
                    "type": "special"
                  }
                ]
              },
              {
                "id": "custom.displayMode",
                "value": "color-background-solid"
              },
              {
                "id": "custom.width",
                "value": 118
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Domaine"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 260
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "issuer 1"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 188
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "url"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 191
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Validitée"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 154
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Validitée"
            },
            "properties": [
              {
                "id": "mappings",
                "value": [
                  {
                    "options": {
                      "remote_cert_valide": {
                        "color": "dark-green",
                        "index": 0,
                        "text": "Certificat présent"
                      }
                    },
                    "type": "value"
                  },
                  {
                    "options": {
                      "match": "null",
                      "result": {
                        "color": "dark-red",
                        "index": 1,
                        "text": "Pas de certificat"
                      }
                    },
                    "type": "special"
                  }
                ]
              },
              {
                "id": "custom.displayMode",
                "value": "color-background"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "cert_file"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 343
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Type"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 237
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Chemin du fichier"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 452
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 14,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "links": [],
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "frameIndex": 0,
        "showHeader": true,
        "sortBy": [
          {
            "desc": false,
            "displayName": "Jours réstants"
          }
        ]
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "local_cert_not_before * 1000",
          "format": "table",
          "hide": false,
          "instant": true,
          "interval": "",
          "intervalFactor": 1,
          "legendFormat": "__auto",
          "range": false,
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "local_cert_expiration_date * 1000",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "{{value}}",
          "range": false,
          "refId": "B"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "local_cert_valide",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "{{value}}",
          "range": false,
          "refId": "C"
        }
      ],
      "title": "Validitée des certificats",
      "transformations": [
        {
          "id": "joinByField",
          "options": {
            "byField": "serial",
            "mode": "outer"
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true,
              "Time 1": true,
              "Time 2": true,
              "Time 3": true,
              "Time 4": true,
              "Value #A": false,
              "Value #B": false,
              "Value #C": true,
              "__name__": true,
              "__name__ 1": false,
              "__name__ 2": true,
              "cert_file 2": true,
              "cert_file 3": true,
              "domain 2": true,
              "instance 1": false,
              "instance 2": true,
              "instance 3": true,
              "instance 4": true,
              "issuer": false,
              "issuer 2": true,
              "issuer_name 1": false,
              "issuer_name 2": true,
              "job": true,
              "job 1": true,
              "job 2": true,
              "job 3": true,
              "job 4": true,
              "serial": true,
              "serial 2": true,
              "serial 3": true,
              "subject": true,
              "subject 1": true,
              "subject 2": true,
              "url 1": true,
              "url 2": true,
              "url 3": true
            },
            "indexByName": {
              "Time 1": 19,
              "Time 2": 20,
              "Time 3": 21,
              "Value #A": 9,
              "Value #B": 10,
              "Value #C": 11,
              "__name__": 12,
              "cert_file 1": 2,
              "cert_file 2": 6,
              "cert_file 3": 7,
              "instance 1": 1,
              "instance 2": 14,
              "instance 3": 15,
              "issuer": 8,
              "job 1": 16,
              "job 2": 17,
              "job 3": 18,
              "remaining_days": 13,
              "serial 1": 3,
              "serial 2": 4,
              "serial 3": 5,
              "url": 0
            },
            "renameByName": {
              "Value": "Date de création",
              "Value #A": "Date de création",
              "Value #B": "Date d'expiration",
              "Value #C": "",
              "Value #D": "Date d'expiration",
              "__name__": "",
              "__name__ 1": "Validitée",
              "__name__ 2": "",
              "cert_file": "Fichier",
              "cert_file 1": "Chemin du fichier",
              "days_remaining": "Jours réstants",
              "domain 1": "Domaine",
              "instance 1": "Hôte",
              "issuer": "Type",
              "issuer_name 1": "Autorité",
              "remaining_days": "Jours réstants",
              "serial": "Serial",
              "serial 1": "",
              "subject": "",
              "url": "Domaine"
            }
          }
        }
      ],
      "transparent": true,
      "type": "table"
    }
  ],
  "schemaVersion": 37,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m"
    ]
  },
  "timezone": "",
  "title": "localcert-exporter",
  "uid": "M-9lEMYVz",
  "version": 1,
  "weekStart": "",
  "gnetId": 18423,
  "description": "localcert exporter pour connaitre les dates de création et expiration des certificats en *.prem"
}