LoginSignup
0
1

AWS CloudWatchアラーム履歴が30日間に延長!

Posted at

CloudWatchの地味アプデがありました
アラーム履歴にアクセスできる期間を延長されたとの事です。

あまり普段アラーム履歴について見る事がないので、この際活用方法など考えてみようかと思います。(結果特に思いつきませんでしたが)

Amazon CloudWatch が 30 日間のアラーム履歴を提供開始

■CloudWatchのアラーム履歴について

CloudWatchアラームを開いて「履歴」から確認できます

履歴1.png

少し勘違いしていた部分があったんですが、ここで見れるのはアラームの変移履歴だけではありません。
具体的には以下の3つを確認する事ができます。

・StateUpdate(状態更新)
→ アラームの状態には、「OK(閾値内)」「ALARM(閾値外)」「INSUFFICIENT_DATA(データ不足)」の3つがあります。

・Action(アクション)
→ 例えば、SNSトピックに通知を送信したり、Auto Scalingグループをスケールアップまたはスケールダウンしたなどです。

・ConfigurationUpdate(設定更新)
→ アラームの設定更新に関する項目です。

■どんなアップデートがあったのか

元々は2週間のアラーム履歴を遡る事ができましたが、最大30日遡ってアラーム状態の変化の履歴を確認できるようになりました。

ただ30日間全ての履歴が見れるという条件ではありますが、状態変移が多かったアラームを見ると履歴の最大数は「50件まで」のような気がします。
(明記されている場所が見つかりませんでした…)

なので10日で100件の項目が発生しても50件しか残らないって事ですね。
必ずしも30日の履歴を確認できるって訳でもなさそうです。

■履歴の内容

json形式で見る事もできます。
AWS CLIで引き出す事も可能みたいなので、情報収集やCloudWatchをトリガーとする場合の確認では有用なシーンも訪れるかもしれません。

AWS CLIを使用してアラーム履歴を取得し、ファイルに保存する簡単な例です↓

aws cloudwatch describe-alarm-history --alarm-name "your-alarm-name" > alarm-history.json

・OKからアラーム状態に更新したアラームの例

{
  "alarmName": "[xx]xxxxxxxxxxxxxx-CPU-Utilization",
  "alarmType": "MetricAlarm",
  "timestamp": "2024-05-21T12:36:20.199Z",
  "historyItemType": "StateUpdate",
  "historySummary": "Alarm updated from OK to ALARM",
  "historyData": {
    "version": "1.0",
    "oldState": {
      "stateValue": "OK",
      "stateReason": "Threshold Crossed: 1 out of the last 1 datapoints [89.91787094261954 (23/04/24 15:25:00)] was not greater than the threshold (90.0) (minimum 1 datapoint for ALARM -> OK transition).",
      "stateReasonData": {
        "version": "1.0",
        "queryDate": "2024-04-23T15:30:15.219+0000",
        "startDate": "2024-04-23T15:25:00.000+0000",
        "statistic": "Average",
        "period": 300,
        "recentDatapoints": [
          89.91787094261954
        ],
        "threshold": 90,
        "evaluatedDatapoints": [
          {
            "timestamp": "2024-04-23T15:25:00.000+0000",
            "sampleCount": 5,
            "value": 89.91787094261954
          }
        ]
      }
    },
    "newState": {
      "stateValue": "ALARM",
      "stateReason": "Threshold Crossed: 1 out of the last 1 datapoints [99.60029977516862 (21/05/24 12:31:00)] was greater than the threshold (90.0) (minimum 1 datapoint for OK -> ALARM transition).",
      "stateReasonData": {
        "version": "1.0",
        "queryDate": "2024-05-21T12:36:20.194+0000",
        "startDate": "2024-05-21T12:31:00.000+0000",
        "statistic": "Average",
        "period": 300,
        "recentDatapoints": [
          99.60029977516862
        ],
        "threshold": 90,
        "evaluatedDatapoints": [
          {
            "timestamp": "2024-05-21T12:31:00.000+0000",
            "sampleCount": 1,
            "value": 99.60029977516862
          }
        ]
      }
    }
  }
}

以上です!

0
1
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
0
1