IBM Cloud Docs
タイプ別のアラートの作成

タイプ別のアラートの作成

IBM Cloud® Internet Services イベント発生時に警告を発するよう設定できるアラートがあります。 E メールまたは Webhook を使用してアラートを受信します。

アラートは、エンタープライズ・プランでのみ使用可能です。

各タイプのアラートについて詳しくは、 アラートのタイプ を参照してください。

UIを使用して電子メールアラートを作成する

UI を使用して、アラート・タイプごとに E メール・アラートを作成できます。 コンソールを使用した E メール・アラートの作成について詳しくは、 アラート・ポリシーの構成 を参照してください。

CLIを使用して電子メールアラートを作成する

CLI を使用して、アラート・タイプごとに E メール・アラートを作成できます。

DDoS 攻撃レイヤー 7 コマンド

以下のコマンドを実行して、 DDoS 攻撃レイヤー 7 のアラート・ポリシーを作成します。

ibmcloud cis alert-policy ddos-attack-l7-alert-create --name NAME (--emails EMAILS | --webhooks WEBHOOKS) --enabled (true | false) [--description DESCRIPTION] [-i, --instance INSTANCE] [--output FORMAT]

ここで、

    • -nameはアラートポリシーの名前です。
    • -descriptionはアラートポリシーの説明です。
    • -emailsは、アラート通知を送信するための電子メールアドレスです。 例: --emails test1@cn.ibm.com,test2@cn.ibm.com
    • -webhooksは、アラート通知をディスパッチするためのウェブフックIDです。 例: --webhook webhookID1,webhookID2
  • -- enabled は、アラート・ポリシーを有効にするかどうかを設定します。
  • -i, --instance は、インスタンスの名前または ID です。 設定されていない場合は、 ibmcloud cis instance-set INSTANCE で指定されたコンテキスト・インスタンスが使用される。
  • --output は出力形式を指定します。JSON のみがサポートされます。

プール・トグル・アラート・コマンド

プールトグルアラート用のアラートポリシーを作成する。

ibmcloud cis alert-policy pool-toggle-alert-create --name NAME (--emails EMAILS | --webhooks WEBHOOKS) --enabled (true | false) --pools POOLS --trigger-condition (enabled | disabled | either) [--include-future-pools (true | false)] [--description DESCRIPTION] [-i, --instance INSTANCE] [--output FORMAT]

ここで、

    • -nameはアラートポリシーの名前です。
    • -descriptionはアラートポリシーの説明です。
    • -emailsは、アラート通知を送信するための電子メールアドレスです。 例: --emails test1@cn.ibm.com,test2@cn.ibm.com
    • -webhooksは、アラート通知をディスパッチするためのウェブフックIDです。 例: --webhook webhookID1,webhookID2
  • -- enabled は、アラート・ポリシーを有効にするかどうかを設定します。
    • -poolsはオリジン・プールのIDで、allに設定するとすべてのプールIDが使用される。
    • -trigger-conditionは、プールトグルステータスの条件である。
  • --include-future-pools は、将来のプールを含めるかどうかを設定します。
  • -i, --instance は、インスタンスの名前または ID です。 設定されていない場合は、 ibmcloud cis instance-set INSTANCE で指定されたコンテキスト・インスタンスが使用される。
  • --output は出力形式を指定します。JSON のみがサポートされます。

WAF アラート・コマンドおよび拡張 WAF アラート・コマンド

ファイアウォール・イベントのスパイクに関するアラート・ポリシーを作成します。 ファイアウォール・イベント・アラートは、過去6時間および5分間のイベント・バケットのzスコア計算を使用します。 アラートは、z スコアが 3.5 (しきい値) を超えるとトリガーされます。 同じ 2 時間の時間フレーム内に重複するアラートを受け取ることはありません。

ibmcloud cis alert-policy firewall-events-alert-create --name NAME (--emails EMAILS | --webhooks WEBHOOKS) --enabled (true | false) --domains DOMAINS [--services SERVICES] [--description DESCRIPTION] [-i, --instance INSTANCE] [--output FORMAT]

ここで、

    • -nameはアラートポリシーの名前です。
    • -descriptionはアラートポリシーの説明です。
    • -emailsは、アラート通知を送信するための電子メールアドレスです。 例: --emails test1@cn.ibm.com,test2@cn.ibm.com
    • -webhooksは、アラート通知をディスパッチするためのウェブフックIDです。 例: --webhook webhookID1,webhookID2
  • -- enabled は、アラート・ポリシーを有効にするかどうかを設定します。
    • -domainsは警告ポリシーのドメインIDである。 例: --domains domainID1,domainID2
  • -- services (拡張 WAF) は、アラートがモニターするサービスを指定します。 有効な値: "country-access-rules"、"waf"、"firewall-rules"、"ratelimit"、"securitylevel"、"ip-access-rules"、"browser-integrity-check"、"ua-rules"、"lockdowns"、"iprange-access-rules"、"asn-access-rules"
  • -i, --instance は、インスタンスの名前または ID です。 設定されていない場合は、 ibmcloud cis instance-set INSTANCE で指定されたコンテキスト・インスタンスが使用される。
  • --output は出力形式を指定します。JSON のみがサポートされます。

Universal SSL アラート・コマンド

証明書イベントのアラート・ポリシーを作成します。

ibmcloud cis alert-policy certificate-alert-create --type (universal | dedicated) --name NAME (--emails EMAILS | --webhooks WEBHOOKS) --enabled (true | false) [--description DESCRIPTION] [-i, --instance INSTANCE] [--output FORMAT]

ここで、

    • -typeは証明書のタイプ。
    • -nameはアラートポリシーの名前です。
    • -descriptionはアラートポリシーの説明です。
    • -emailsは、アラート通知を送信するための電子メールアドレスです。 例: --emails test1@cn.ibm.com,test2@cn.ibm.com
    • -webhooksは、アラート通知をディスパッチするためのウェブフックIDです。 例: --webhook webhookID1,webhookID2
  • -- enabled は、アラート・ポリシーを有効にするかどうかを設定します。
  • -i, --instance は、インスタンスの名前または ID です。 設定されていない場合は、 ibmcloud cis instance-set INSTANCE で指定されたコンテキスト・インスタンスが使用される。
  • --output は出力形式を指定します。JSON のみがサポートされます。

ロード・バランシング・ヘルス・チェック・アラート・コマンド

グローバル・ロード・バランサー、プール、および起点の正常性状況の変更に対するアラート・ポリシーを作成します。

ibmcloud cis alert-policy glb-healthcheck-alert-create --name NAME (--emails EMAILS | --webhooks WEBHOOKS) --enabled (true | false) --pools POOLS [--include-future-pools (true | false)] [--health-status-trigger (healthy | unhealthy | either)] [--event-source-trigger (pool | origin | either)] [--description DESCRIPTION] [-i, --instance INSTANCE] [--output FORMAT]

ここで、

    • -nameはアラートポリシーの名前です。
    • -descriptionはアラートポリシーの説明です。
    • -emailsは、アラート通知を送信するための電子メールアドレスです。 例: --emails test1@cn.ibm.com,test2@cn.ibm.com
    • -webhooksは、アラート通知をディスパッチするためのウェブフックIDです。 例えば、--webhook webhookID1,webhookID2 です。
  • -- enabled は、アラート・ポリシーを有効にするかどうかを設定します。
    • -poolsはオリジン・プールのIDである。 all に設定すると、すべてのプールIDが使用される。
  • --include-future-pools は、将来のプールを含めるかどうかを設定します (デフォルトは「false」)。
    • -health-status-triggerは通知を発するトリガー条件です。 有効な値は、「healthy」、「unhealthy」、「either」(デフォルトは「either」) です。
    • -event-source-triggerは、通知を発するトリガーのイベントソースです。 有効な値は、「pool」、「origin」、「either」(デフォルトは「either」) です。
  • -i, --instance は、インスタンスの名前または ID です。 設定されていない場合は、 ibmcloud cis instance-set INSTANCE で指定されたコンテキスト・インスタンスが使用される。
  • --output は出力形式を指定します。JSON のみがサポートされます。

API を使用した E メール・アラートの作成

E メール・アラートを作成するには、以下の手順を実行します。

  1. IBM Cloud アカウントにログインします。
  2. トークンを取得します。
  3. そのトークンを使用して、以下のいずれかのコマンドを実行します。

DDoS 攻撃レイヤー 7 コマンド

curl -X POST \
  https://api.cis.cloud.ibm.com/v1/:crn/alerting/policies \
  -H 'content-type: application/json' \
  -H 'x-auth-user-token: Bearer xxxxxx' \
  -d '{"name":"Example Policy","enabled":true,"alert_type":"dos_attack_l7","mechanisms":{"email":[{"id":"cistestemail@ibm.com"}],"webhooks":[]}}'

ここで、

    • dはアラートを作成するために必要な属性の配列である。
    • 名前 はアラートの名前です。
    • 有効 は、アラートの状態 ( truefalseのいずれか) です。
    • alert_type は、アラートのタイプ ( dos_attack_l7load_balancing_pool_enablement_alertclickhouse_alert_fw_anomalyclickhouse_alert_fw_ent_anomalydedicated_ssl_certificate_event_typeuniversal_ssl_event_type、または load_balancing_health_alert のいずれか) です。
    • メカニズム は、 emailwebhooksの少なくとも 1 つです。
    • 説明 (オプション) は、アラートの説明です。

プール・トグル・アラート・コマンド

curl -X POST \
  https://api.cis.cloud.ibm.com/v1/:crn/alerting/policies \
  -H 'content-type: application/json' \
  -H 'x-auth-user-token: Bearer xxxxxx' \
  -d '{"name":"Example Policy","enabled":true,"alert_type":"load_balancing_pool_enablement_alert","mechanisms":{"email":[{"id":"cistestemail@ibm.com"}],"webhooks":[]},
       “filters”: {
       “enabled”: [
         “false”,
         “true”
       ],
       “pool_id”: [
         “6e67c08e3bae7eb398101d08def8a68a”,
         “df2d9d70fcb194ea60d2e58397cb35a6”
       ]
       }}'

ここで、

    • dはアラートを作成するために必要な属性の配列である。
    • 名前 はアラートの名前です。
    • 有効 は、アラートの状態 ( truefalseのいずれか) です。
    • alert_type は、アラートのタイプ ( dos_attack_l7load_balancing_pool_enablement_alertclickhouse_alert_fw_anomalyclickhouse_alert_fw_ent_anomalydedicated_ssl_certificate_event_typeuniversal_ssl_event_type、または load_balancing_health_alert のいずれか) です。
    • メカニズム は、 emailwebhooksの少なくとも 1 つです。
    • 説明 (オプション) は、アラートの説明です。
    • フィルター は、プール・トグル・アラートのすべての使用可能化状況およびプール ID のリストです。

WAF アラート・コマンド

WAF アラートを設定するには、以下のコマンドを使用します。

curl -X POST \
  https://api.cis.cloud.ibm.com/v1/:crn/alerting/policies \
  -H 'Content-Type: application/json' \
  -H 'X-Auth-User-Token: Bearer xxxxxx' \
  -d '{
  "name": "WAF Alerter",
  "description": "Send an email on spike in firewall events for any service",
  "enabled": true,
  "alert_type": "clickhouse_alert_fw_anomaly",
  "mechanisms": {
    "email": [
      {
        "id": "sreteam@techcompany.com"
      }
    ]
  },
  "filters": {
    "zones": [
      "123456ab7d8e9f0g12h2j34l5mn6op78"
    ]
  }
}'

ここで、

    • dはアラートを作成するために必要な属性の配列である。
    • 名前 はアラートの名前です。
    • 説明 (オプション) は、アラートの説明です。
    • 有効 は、アラートの状態 ( truefalseのいずれか) です。
    • alert_type は、アラートのタイプ ( dos_attack_l7load_balancing_pool_enablement_alertclickhouse_alert_fw_anomalyclickhouse_alert_fw_ent_anomalydedicated_ssl_certificate_event_typeuniversal_ssl_event_type、または load_balancing_health_alert のいずれか) です。
    • メカニズム は、 emailwebhooksの少なくとも 1 つです。
    • フィルター は、WAF アラートのすべてのゾーンのリストです。

拡張 WAF アラート・コマンド

拡張 WAF アラートを設定するには、以下のコマンドを使用します。

curl -X POST \
  https://api.cis.cloud.ibm.com/v1/:crn/alerting/policies \
  -H 'Content-Type: application/json' \
  -H 'X-Auth-User-Token: Bearer xxxxxx' \
  -d '{
  "name": "WAF Alerter",
  "description": "Send an email on spike in firewall events for WAF or browser integrity check",
  "enabled": true,
  "alert_type": "clickhouse_alert_fw_ent_anomaly",
  "mechanisms": {
    "email": [
      {
        "id": "sreteam@techcompany.com"
      }
    ]
  },
  "filters": {
    "services": [
      "waf",
      "bic"
    ],
    "zones": [
      "123456ab7d8e9f0g12h2j34l5mn6op78"
    ]
  }
}'

ここで、

    • dはアラートを作成するために必要な属性の配列である。
    • 名前 はアラートの名前です。
    • 説明 (オプション) は、アラートの説明です。
    • 有効 は、アラートの状態 ( truefalseのいずれか) です。
    • alert_type は、アラートのタイプ ( dos_attack_l7load_balancing_pool_enablement_alertclickhouse_alert_fw_anomalyclickhouse_alert_fw_ent_anomalydedicated_ssl_certificate_event_typeuniversal_ssl_event_type、または load_balancing_health_alert のいずれか) です。
    • メカニズム は、 emailwebhooksの少なくとも 1 つです。
    • フィルター は、拡張 WAF アラートのセキュリティー・イベントおよびゾーンをモニターするすべてのサービスのリストです。

以下のサービスをモニターできます。

高度なWAFアラートで監視できるサービス
サービス ログ値
国別 IP アクセス規則 country
WAF waf
ファイアウォール規則 firewallrules
速度制限 ratelimit
セキュリティー・レベル securitylevel
IP アクセス規則 ip
検証 validation
ブラウザーの保全性チェック bic
ホット・リンク保護 hot
ユーザー・エージェント・ブロック uablock
ゾーン・ロックダウン zonelockdown
IP 範囲アクセス規則 iprange
ASN IP アクセス規則 asn
カスタム・ファイアウォール firewallCustom
管理対象ファイアウォール firewallManaged
データ損失防止 dlp

Universal SSL アラート・コマンド

ユニバーサルSSLアラートを設定するには、以下のコマンドを使用する:

curl -X POST \
  https://api.cis.cloud.ibm.com/v1/:crn/alerting/policies \
  -H 'content-type: application/json' \
  -H 'x-auth-user-token: Bearer xxxxxx' \
  -d '{"name":"Example Policy","enabled":true,"alert_type":"universal_ssl_event_type","mechanisms":{"email":[{"id":"cistestemail@ibm.com"}],"webhooks":[]}}'

ここで、

    • dはアラートを作成するために必要な属性の配列である。
    • 名前 はアラートの名前です。
    • 有効 は、アラートの状態 ( truefalseのいずれか) です。
    • alert_type は、アラートのタイプ ( dos_attack_l7load_balancing_pool_enablement_alertclickhouse_alert_fw_anomalyclickhouse_alert_fw_ent_anomalydedicated_ssl_certificate_event_typeuniversal_ssl_event_type、または load_balancing_health_alert のいずれか) です。
    • メカニズム は、 emailwebhooksの少なくとも 1 つです。
    • 説明 (オプション) は、アラートの説明です。

ロード・バランシング・ヘルス・チェック・アラート・コマンド

ロード・バランシング・ヘルス・チェック・アラートを構成するには、次のコマンドを使用します。

curl -X POST \
  https://api.cis.cloud.ibm.com/v1/:crn/alerting/policies \
  -H 'content-type: application/json' \
  -H 'x-auth-user-token: Bearer xxxxxx' \
  -d '{"name":"Example Policy","enabled":true,"alert_type":"load_balancing_health_alert","mechanisms":{"email":[{"id":"cistestemail@ibm.com"}],"webhooks":[]},
       “filters”: {
       “event_source”: [
         “pool”,
         “origin”
       ],
       “new_health”: [
         “Healthy”,
         “Unhealthy”
       ],
       “pool_id”: [
         “6e67c08e3bae7eb398101d08def8a68a”,
         “df2d9d70fcb194ea60d2e58397cb35a6”
       ]
       }}'

ここで、

    • dはアラートを作成するために必要な属性の配列である。
    • 名前 はアラートの名前です。
    • 有効 は、アラートの状態 ( truefalseのいずれか) です。
    • alert_type は、アラートのタイプ ( dos_attack_l7load_balancing_pool_enablement_alertclickhouse_alert_fw_anomalyclickhouse_alert_fw_ent_anomalydedicated_ssl_certificate_event_typeuniversal_ssl_event_type、または load_balancing_health_alert のいずれか) です。
    • メカニズム は、 emailwebhooksの少なくとも 1 つです。
    • 説明 (オプション) は、アラートの説明です。
    • filter は、ロード・バランシング・ヘルス・アラートのすべてのソース、プール、ヘルス状況のリストです。

API を使用した Webhook アラートの作成

Webhookアラートの作成は、2つのステップで行います。

  1. Webhook を作成するには、以下の要求を送信します。

    curl -X POST \
      https://api.cis.cloud.ibm.com/v1/:crn/alerting/destinations/webhooks \
      -H 'content-type: application/json' \
      -H 'x-auth-user-token: Bearer xxxxxx' \
      -d '{"name":"Example Webhook","url":"https://hooks.slack.com/services/Ds3fdBFbV/456464Gdd"}'
    

    以下の応答が返されます。

    {
        "result": {
            "id": "6d16fcab3e8044b3b59ba3716237832e"
        },
        "success": true,
        "errors": [],
        "messages": []
    }
    
  2. 受信した応答内の ID を使用して、アラートを作成します。

        curl -X POST \
          https://api.cis.cloud.ibm.com/v1/:crn/alerting/policies \
          -H 'content-type: application/json' \
          -H 'x-auth-user-token: Bearer xxxxxx' \
          -d '{"name":"Example Policy","enabled":true,"alert_type":"dos_attack_l7","mechanisms":{"email":[{"id":"cistestemail@ibm.com"}],"webhooks": [{"id": "6d16fcab3e8044b3b59ba3716237832e"}]}}'
    

API を使用したアラートの編集

E メール・アラートを編集するには、以下のコマンドを実行します。

curl -X PUT \
  https://api.cis.cloud.ibm.com/v1/:crn/alerting/policies/:policy_id \
  -H 'content-type: application/json' \
  -H 'x-auth-user-token: Bearer xxxxxx' \
  -d '{"name":"Example Policy","enabled":true,"alert_type":"dos_attack_l7","conditions":{},"mechanisms":{"email":[{"id":"cistestemail@ibm.com"}],"webhooks":[]}}'

条件 フィールドは、空の場合もありますが、必須です。

Webhook を編集するには、以下の PUT 要求を使用します。

curl -X PUT \
  https://api.cis.cloud.ibm.com/v1/:crn/alerting/destinations/webhooks/:webhook_id \
  -H 'content-type: application/json' \
  -H 'x-auth-user-token: Bearer xxxxxx' \
  -d '{"name":"Example Webhook","url":"https://hooks.slack.com/services/Ds3fdBFbV/456464Gdd"}'

API を使用したアラートの削除

E メール・アラートを削除するには、以下のコマンドを実行します。

curl -X DELETE \
  https://api.cis.cloud.ibm.com/v1/:crn/alerting/policies/:policy_id \
  -H 'content-type: application/json' \
  -H 'accept: application/json' \
  -H 'x-auth-user-token: Bearer xxxxxx'

Webhook を削除するには、以下の DELETE 要求を使用します。

curl -X DELETE \
  https://api.cis.cloud.ibm.com/v1/:crn/alerting/destinations/webhooks/:webhook_id \
  -H 'content-type: application/json' \
  -H 'accept: application/json' \
  -H 'x-auth-user-token: Bearer xxxxxx'