datadogでrecoverdされない問題をサポートに聞いたら色々教えてくれた
alert出た後にrecoverされない
alertが通知されたけど、その後、recoverdが来ないという現象
次の日になってrecoverされた
これはなんかやり方があるだろうとdatadogのサポートに連絡
原因
サポートの回答
> AWS Cloudwatch doesn't generate a metric value when there are zero httpcode elb 5xx errors.
つまり、0というmetricsはデータポイントとしては登録されてないので、Datadog的には正常になったということではなく、データがきてないということで計算が行われなかったということになる。
対応
こういう場合はどうするかというと、 Monitorのことろで設定できるこのオプションで After 1 hour automatically resove this event from a triggerd state. などを選ぶ。
こうすると、metricsが0、つまりデータがきていない状況(正常な状態)が続けば1時間後には自動的にrecoverされるということ。 この1時間後というのは最小の値なのでこれ以上は短くできないんだけど、とりあえずこれをやっておくしかない
AWS integrationのメトリクスは遅れている
Datadogのサポートは返信も早いし、こんな風に質問したこと以外にもユーザーの設定とかを見ておかしなところをつっこんでくれたりする。
これは、monitorの評価を 5 minutes
にしてたんだけど、AWS cloudwatchのmetricsはdelayがあるから変えた方がいいよみたいな話だった。
以下、サポートからの返信
> However, I would like to ask about you told in side note. > I think if I set 1 hours timeframe, monitor will not recover > until it triggerd after 1 hours. That's correct indeed. > The aws integration is getting cloud watch metrics by every 10 times. > So, I think It is right that timeframe value is 10 minutes for aws > integration metrics. It's slightly more complex than that, because Cloudwatch publishes metrics with a ~7 min delay in certain cases. More details here: https://help.datadoghq.com/hc/en-us/articles/203826415-Are-my-AWS-CloudWatch-metrics-delayed- I'd recommend using a 15 min alert window at least in your case.
- Are my AWS CloudWatch metrics delayed?
- AWS cloudwatch自体が1〜7分ぐらい遅れているのと、Datadogのクローラーがevery 10 minuitesなので合計で最悪15分ぐらいは遅れてしまう可能性がある
まとめ
- AWSメトリクスの5xxの数などのやつは 1hour automaticaly resoveを設定しよう
- AWSのインテグレーションの値でalertを作成するのはリアルタイム性に欠ける
- 本当にリアルタイムのalertが欲しい場合は、cloudwatch alarmで設定するのが筋なのかもしれない