Remote Cert exporter
Exporter to get cert date/time expire for remote domain
Based on docker with xinetd
* https://github.com/Hetimop/remotecert-exporter
* https://hub.docker.com/repository/docker/hetimop/remotecert-exporter/general

# Quick start

`docker run hetimop/remotecert-exporter -e METRICS_PORT=9006 URLS="google.com" "grafana.com" -p 9006:9006  hetimop/remotecert-exporter:v1.0 `
{
  "__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"
              },
              {
                "id": "mappings",
                "value": []
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Date de création"
            },
            "properties": [
              {
                "id": "unit",
                "value": "dateTimeAsLocal"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Hôte"
            },
            "properties": [
              {
                "id": "mappings",
                "value": [
                  {
                    "options": {
                      "pattern": "([^:]+):.+",
                      "result": {
                        "index": 0,
                        "text": "$1"
                      }
                    },
                    "type": "regex"
                  }
                ]
              },
              {
                "id": "custom.width",
                "value": 214
              }
            ]
          },
          {
            "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": 185
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Domaine"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 343
              }
            ]
          },
          {
            "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": "serial"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 339
              }
            ]
          }
        ]
      },
      "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": "remote_cert_valide",
          "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": "remote_cert_invalid",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "{{value}}",
          "range": false,
          "refId": "B"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "remote_cert_not_before * 1000",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "{{value}}",
          "range": false,
          "refId": "C"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "remote_cert_expiration_date * 1000",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "{{value}}",
          "range": false,
          "refId": "D"
        }
      ],
      "title": "Validitée des certificats",
      "transformations": [
        {
          "id": "joinByField",
          "options": {
            "byField": "url",
            "mode": "outer"
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true,
              "Time 1": true,
              "Time 2": true,
              "Time 3": true,
              "Time 4": true,
              "Value #A": true,
              "Value #B": true,
              "__name__": false,
              "__name__ 1": false,
              "__name__ 2": true,
              "domain 2": true,
              "instance 1": true,
              "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 2": true,
              "serial 3": true,
              "subject": true,
              "subject 1": true,
              "subject 2": true,
              "url 2": true
            },
            "indexByName": {
              "Time 1": 12,
              "Time 2": 13,
              "Time 3": 16,
              "Time 4": 20,
              "Value #A": 8,
              "Value #B": 9,
              "Value #C": 4,
              "Value #D": 5,
              "__name__ 1": 2,
              "__name__ 2": 7,
              "days_remaining": 6,
              "instance 1": 10,
              "instance 2": 11,
              "instance 3": 17,
              "instance 4": 21,
              "issuer": 3,
              "job 1": 14,
              "job 2": 15,
              "job 3": 18,
              "job 4": 22,
              "serial 1": 1,
              "serial 2": 19,
              "serial 3": 23,
              "subject": 24,
              "url": 0
            },
            "renameByName": {
              "Value": "Date de création",
              "Value #A": "",
              "Value #B": "",
              "Value #C": "Date de création",
              "Value #D": "Date d'expiration",
              "__name__ 1": "Validitée",
              "__name__ 2": "",
              "cert_file": "Fichier",
              "days_remaining": "Jours réstants",
              "domain 1": "Domaine",
              "instance 1": "Hôte",
              "issuer": "Type",
              "issuer_name 1": "Autorité",
              "serial": "Serial",
              "subject": "",
              "url": "Domaine"
            }
          }
        }
      ],
      "transparent": true,
      "type": "table"
    }
  ],
  "refresh": "5s",
  "schemaVersion": 37,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now-5m",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m"
    ]
  },
  "timezone": "",
  "title": "Remote Cert exporter",
  "uid": "LIz5CWL4z",
  "version": 5,
  "weekStart": "",
  "gnetId": 18422,
  "description": "Exporter to get cert date/time expire for remote domain"
}