Use event subscription

Last Updated: Jul 04, 2017

Through Event Subscription, CloudMonitor pushes alerts to the specified MNS queue, so you can connect to your service system by using alert messages in the queue.

Note: The frequency of pushing an alert message to MNS is restricted by channel silence. If no status change occurs in 24 hours since an alert is triggered, no more notifications are sent for another alert triggered based on the same alert policy.

Procedure

  1. Activate MNS.

    • View the MNS product introduction. See activation link here.

    • For the MNS FAQs, click here.

  2. Go to the Event Subscription page on the CloudMonitor console to authorize CloudMonitor.

    If you use the event subscription function for the first time, you need to authorize CloudMonitor the write permission to MNS message queue.

  3. Create an event subscription.

    1. Click Create Event in the top-right corner to create an event to receive alert policies.

    2. To finish an event subscription, select the queue information for receiving alert policies and the type of the alerts to be received.

  4. Use alert messages.

    You can use alert messages through Message Service APIs, and view the delivery status through the MNS console.

Alert message format

Alert messages received in MNS are formatted as follows:

ECS alert content

  1. {
  2. "message":{
  3. "expression": "Average value > 80%", // Alert policy description
  4. "curValue":"85.65",
  5. "unit": "%", //Unit
  6. "levelDescription": "alert triggered", //Alert status, including "alert triggered" and "alert cleared".
  7. "time": 1464257700000, // Time when an alert is triggered
  8. "metricProject": "acs_ecs", //Product name
  9. "userId":"1078500464551219",
  10. "dimensions": "ECS name=yapot_server_1, ECS instance ID=AY14051913564762762e, IP=182.92.79.214, mountpoint=/mnt", //Monitoring dimensions
  11. "evaluationCount": "1", //Number of retries
  12. "period": "Five minutes", //Statistical period
  13. "metricName": "Disk usage", // Metric name
  14. "alertName":"AY14051913564762762e_98591490-9eb4-42a1-ba2a-3bdbe04196df"
  15. },
  16. "type":0
  17. }

Server Load Balancer alert content

  1. {
  2. "message":{
  3. "expression": "maximum value > 2.0 Kb/s", // Alert policy description
  4. "curValue":"5",
  5. "unit": "Kb/s", //Unit
  6. "levelDescription": "alert triggered", //Alert status, including "alert triggered" and "alert cleared".
  7. "time": 1451767500000, // Time when an alert is triggered
  8. "metricProject": "acs_slb", //Product name
  9. "userId":"UserName", //
  10. "dimensions": "instanceId=InstanceId, port=3306, vip=10.157.161.2", //Monitoring dimensions
  11. "evaluationCount": "3", //Number of retries
  12. "period": "15 minutes", //Statistical period
  13. "metricName": "incoming data volume per second", // Metric name
  14. "alertName":"14a850c9d49-cn-beijing-btc-a01_3306_3da5a7df-0821-4cce-93bf-dafe8ce56a68"
  15. },
  16. "type": 0 // A reserved field. 0 indicates a status alert, including "triggered" and "cleared"; 1 indicates an exception notification, with an alert triggered at the occurrence of the exception and no status is logged.
  17. }
Thank you! We've received your feedback.