0
0

More than 3 years have passed since last update.

AWS CLIでAmazon CloudWatchのアラームの発砲をテストする

Last updated at Posted at 2020-11-13

はじめに

ローカルPCからAWS CLIを利用して、Amazon CloudWatchのアラームのステータスを強制的に変更し、Slackなどに発砲するか試験します。
発砲試験のために、アラームに設定している内容を変更するのは、試験内容にはならないことに注意です。
アラームの内容にもよりますが、アラームの数が多いとその分通知が飛ぶため、本来確認すべき内容が分からなくなう可能性があるため、アラーム名を直接指定する形にしています。

スクリプト

test_alerm.sh
#!/bin/sh

cd `dirname $0`

test_alerm () {

    ALERM_NAME=$1
    echo "test alerm: ${ALERM_NAME}"

    aws cloudwatch set-alarm-state \
    --alarm-name ${ALERM_NAME} \
    --state-value ALARM \
    --state-reason '【テストでやんす!!!!】'
}

test_alerm [アラーム名]
0
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
0
0