LoginSignup
3
0

More than 5 years have passed since last update.

Datadogのhttp_checkでSSL証明書の有効期限チェックを行う

Posted at

いつからサポートされていたかは追えてないですが、Datadog の agent に同梱されているhttp_checkを用いることで、Datadog の Agent から任意のサイトの SSL 証明書の有効期限チェックを行うことができます。

以前はこのような機能がhttp_checkにはなかったと思いますが、少なくとも Version 6後のリポジトリの History で当該機能の追加コミットが見当たらないので、その前から機能としては存在していたと思います。

設定としては、以下のように conf.yaml を設定して、Datadog Agent を restart するだけです。

init_config:

instances:
  - name: sada
    url: https://www.sada.co.jp/
    timeout: 1
    method: get
    check_certificate_expiration: true
    days_warning: 30
    days_critical: 7

有効期限の何日前になったらアラートを飛ばす、という事も設定できるようです。
上記では、30日前になったら Warning、7日前になったら Critical のアラートを送るように設定しています。

agent check コマンドの実行結果は以下。

=== Series ===
{
  "series": [
    {
      "metric": "network.http.response_time",
      "points": [
        [
          1540875810,
          0.09294414520263672
        ]
      ],
      "tags": [
        "env:prd",
        "site:sada",
        "url:https://www.sada.co.jp/"
      ],
      "host": "hogehoge",
      "type": "gauge",
      "interval": 0,
      "source_type_name": "System"
    },
(snip.)
    {
      "metric": "http.ssl.days_left",
      "points": [
        [
          1540875810,
          338
        ]
      ],
      "tags": [
        "env:prd",
        "site:sada",
        "url:https://www.sada.co.jp/"
      ],
      "host": "hogehoge",
      "type": "gauge",
      "interval": 0,
      "source_type_name": "System"
    },
(snip.)

Metrics Explorer での表示は以下のような感じになります。

image.png

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0