CloudMonitor integrates with Web Application Firewall (WAF) to send alerts when WAF detects attacks or when service metrics cross a threshold you define. This topic explains how to set up alert contacts, configure event-triggered alerts for attack events, and configure threshold-based alerts for service metrics.
Alert types at a glance:
Alert type | What it monitors | Where to configure |
Attack events | A notification each time WAF detects a specific attack type (for example, an HTTP flood or a web attack). | Event Center > System Events |
Service metrics | A notification when a measured metric—such as QPS or the block rate—crosses a threshold you define. | Alerts > Alert Rules |
Custom metrics | Custom metrics defined in Simple Log Service (SLS). | See Overview |
Prerequisites
Before you begin, ensure that you have:
A website added to WAF. For more information, see Tutorial
Create a contact and a contact group
Alert contacts are the people who receive notifications. Organize them into contact groups, then assign a group when creating any alert rule.
Log on to the CloudMonitor console.
In the left-side navigation pane, choose Alerts > Alert Contacts.
Create a contact.
On the Alert Contacts tab, click Create Alert Contact.
In the Set Alert Contact panel, enter the name, email address, and webhook URL of the contact. Leave Language of Alert Notifications set to the default value Automatic.
NoteAutomatic means CloudMonitor selects the notification language based on the language used to create your Alibaba Cloud account.
Click Confirm.
Create a contact group.
On the Alert Contact Group tab, click Create Alert Contact Group.
In the Create Alert Contact Group panel, enter a group name, select the contacts to include, and then click Confirm.
(Optional) Add contacts to a group in bulk.
On the Alert Contacts tab, select the contacts you want to add, and then click Add to Contact Group.
In the Confirm dialog box, select the target group and click OK.
Configure monitoring and alerting for attack events
Set up event-triggered alert rules to receive notifications when WAF detects specific attack events. When you receive an alert, go to the Event Monitoring tab in the CloudMonitor console to view recent events and identify the attack.
Log on to the CloudMonitor console.
In the left-side navigation pane, choose Event Center > System Events.
On the Event Monitoring tab, click Old Event Alarm Rules in the upper-right corner, and then click Create Alert Rule.
In the Create/Modify Event-triggered Alert Rule panel, configure the parameters and click OK.
Parameter
Description
Alert Rule Name
The name of the event-triggered alert rule.
Product
The cloud service. Select WAF.
Event Type
The category of event to monitor. Valid values: Attack, Exceed, and Event.
Event Level
The severity level that triggers alerts. All WAF events are classified as CRITICAL.
Event name
The specific event to monitor. Event names that contain v3 are WAF 3.0 events. All other events are WAF 2.0 events. For the full list of WAF 2.0 events, see Attack events that can be monitored by CloudMonitor.
Keyword Filtering
Filters events by keyword before sending alerts. Contains any of the keywords: suppress alerts when the event matches a keyword. Does not contain any of the keywords: suppress alerts when the event does not match a keyword.
SQL Filter
SQL statements used for additional filtering.
Resource Scope
The resources this rule covers. Valid values: All Resources and Application Groups.
Contact Group
The contact groups that receive alert notifications.
Notification method
The severity level and delivery channels for notifications. Valid values: Critical (Phone Call + SMS Message + Email + Webhook), Warning (SMS Message + Email + Webhook), Info (Email + Webhook).
Simple Message Queue (formerly MNS)(SMQ) - Queue
The Simple Message Queue (SMQ, formerly MNS) queue to receive alert deliveries.
Function Compute
The Function Compute function to receive alert deliveries.
URL Callback
A publicly accessible HTTP URL. CloudMonitor sends HTTP POST requests to push alert notifications to this URL. Only HTTP is supported. For configuration steps, see Configure callbacks for system event-triggered alerts (old).
Simple Log Service
The SLS Logstore to receive alert deliveries.
Mute Period
How long CloudMonitor waits before resending an alert that has not been cleared. Valid values: 5 Minutes, 15 Minutes, 30 Minutes, 60 Minutes, 3 Hours, 6 Hours, 12 Hours, and 24 Hours.
After the rule is saved, the contacts in the specified groups receive notifications whenever WAF detects the configured attack events.
To view recent attack events, on the Event Monitoring tab, select WAF from the All Products drop-down list, select an event name that does not contain v3 from the Select Event Name drop-down list, and then click Search.
Configure monitoring and alerting for service metrics
Set up threshold-based alert rules to receive notifications when a WAF service metric crosses a value you define. When you receive an alert, check the Alert Rules page to identify which metric triggered the rule.
Log on to the CloudMonitor console.
In the left-side navigation pane, choose Alerts > Alert Rules.
On the Alert Rules page, click Create Alert Rule.
In the Create Alert Rule panel, configure the parameters and click OK.
Parameter
Description
Product
Select WAF from the drop-down list.
Resource Scope
The resources this rule covers. Valid values: All Resources (all WAF resources), Application Groups (all resources in a specified application group), Instances (specific WAF resources).
Rule Description
The alert condition. Click Add Rule, and in the Add Rule Description panel configure the alert rule, metric type, metric, threshold, and alert level. For the list of available service metrics, see Service metrics that can be monitored by CloudMonitor.
Mute Period
How long CloudMonitor waits before resending an active alert. Valid values: 5 Minutes, 15 Minutes, 30 Minutes, 60 Minutes, 3 Hours, 6 Hours, 12 Hours, and 24 Hours. If the alert condition is met again within the mute period, CloudMonitor suppresses the duplicate notification.
Effective Period
The time window during which CloudMonitor monitors the resources and generates alerts.
Alert Contact Group
The contact groups that receive alert notifications.
Alert Callback
A publicly accessible HTTP URL. CloudMonitor sends HTTP POST requests to push alert notifications to this URL. Only HTTP is supported. For configuration steps, see Use the alert callback feature to send notifications about threshold-triggered alerts. Click Advanced Settings to configure this parameter.
Auto Scaling
When enabled, triggers the specified scaling rule when an alert fires. Configure Region, ESS Group, and ESS Rule. For details, see Manage scaling groups and Configure scaling rules. Click Advanced Settings to configure this parameter.
Simple Log Service
When enabled, writes alert data to a specified SLS Logstore. Configure Region, ProjectName, and Logstore. For details, see Getting started. Click Advanced Settings to configure this parameter.
Simple Message Queue (formerly MNS) - Topic
When enabled, writes alert data to a specified MNS topic. Configure Region and topicName. For details, see Create a topic. Click Advanced Settings to configure this parameter.
NoDataPolicy
How to handle the alert state when data is unavailable. Valid values: Do not do anything (default), Send alert notifications, Treated as normal. Click Advanced Settings to configure this parameter.
Tag
A name-value tag attached to the alert rule.
After the rule is saved, find it on the Alert Rules page by selecting Web Application Firewall (WAF) from the Application grouping drop-down list and selecting a metric dimension from the Monitoring indicators drop-down list.
The Monitoring indicators drop-down list controls which WAF version's metrics are displayed:
domain: WAF 2.0 metrics
resource: WAF 3.0 metrics
Instance: Hybrid Cloud WAF metrics. Metric names that contain v3 are WAF 3.0 metrics; all others are WAF 2.0 metrics.
Configure monitoring and alerting for custom metrics
Use Simple Log Service to configure monitoring and alerting for custom metrics. For more information, see Overview.
Attack events that can be monitored by CloudMonitor
CloudMonitor can monitor web attacks, HTTP flood attacks, scan attacks, and access control events on domain names added to WAF. All WAF events have a severity level of CRITICAL.
Event type | Event name | Description | Event status | Severity level |
Attack | waf_event_aclattack | An access control event occurs. | acl | Critical |
Exceed | waf_event_bandwidth_exceed | The bandwidth exceeds the upper limit. | overrun | Critical |
Attack | waf_event_ccattack | An HTTP flood attack occurs. | cc | Critical |
Exceed | waf_event_qps_exceed | The number of queries per second (QPS) exceeds the upper limit. | overrun | Critical |
Attack | waf_event_webattack | A web attack occurs. | web | Critical |
Attack | waf_event_webscan | A scan attack occurs. | webscan | Critical |
Service metrics that can be monitored by CloudMonitor
CloudMonitor can monitor WAF service metrics for domain names added to WAF. All metrics have a domain name dimension.
Metric | Description | Remarks |
4XX_ratio | Proportion of HTTP 4xx status codes returned per minute. Excludes HTTP 405. | Displayed as a decimal. |
5XX_ratio | Proportion of HTTP 5xx status codes returned per minute. | Displayed as a decimal. |
acl_blocks_5m | Number of requests blocked by access control policies in the previous 5 minutes. | — |
acl_rate_5m | Proportion of requests blocked by access control policies in the previous 5 minutes. | Displayed as a decimal. |
cc_blocks_5m | Number of requests blocked by HTTP flood protection in the previous 5 minutes. | — |
cc_rate_5m | Proportion of requests blocked by HTTP flood protection in the previous 5 minutes. | Displayed as a decimal. |
waf_blocks_5m | Number of requests blocked by web application attack prevention in the previous 5 minutes. | — |
waf_rate_5m | Proportion of requests blocked by web application attack prevention in the previous 5 minutes. | Displayed as a decimal. |
QPS | Number of queries per second. | — |
qps_ratio | Minute-granularity growth rate of QPS. | Displayed as a percentage. |
qps_ratio_down | Minute-granularity decrease rate of QPS. | Displayed as a percentage. |