Configure monitoring and alerting
Configuring alerts keeps you informed of job execution status, helping you detect and resolve issues promptly.
Configure job-level alerts
Procedure
Log on to the XXL-JOB console and select a region in the top navigation bar. Click the ID of your XXL-JOB instance. In the left-side navigation pane, select Task Management. Find the job that you want to configure and click Edit in the Actions column. On the Notification Configuration page, configure the job-level alert settings.
The following table describes the notification configuration parameters.
|
Parameter |
Description |
Default |
|
Timeout alarm |
Sends an alert when a job times out. |
On |
|
Timeout time |
The maximum job execution time, in seconds. An alert is triggered if the job's runtime exceeds this value. |
7200 seconds |
|
Timeout termination |
Automatically stops a job that has timed out. This prevents a long-running job from blocking the next scheduled run. |
Off |
|
Success notification |
Notifies contacts when a job completes successfully. We recommend enabling this for critical jobs that require confirmation of success. |
Off |
|
Failure alarm |
Sends an alert when a job fails. |
On |
|
Consecutive Failures |
The number of consecutive failures required to trigger an alert. |
1 |
|
No machine alarm available |
Sends an alert if no executor is available when the job is scheduled. |
On |
|
Notification Method |
The method for delivering alerts. Supported methods include SMS, webhook, email, and phone call. Important
If you select webhook as a notification method, you must complete the following additional configuration.
|
None |
|
Notification Contacts |
Selects alert recipients from your CloudMonitor alert contacts. You must configure contacts in the CloudMonitor console and activate their contact methods to receive alerts. |
None |
Configure instance-level and application-level alerts
You can configure alerts in CloudMonitor for an instance's job scheduling metrics. Common scenarios include:
-
Instance level: Alert when the scheduling volume for all jobs in an instance drops by 30%.
-
Application level: Alert when jobs in an application fail more than 5 times in 3 consecutive minutes within an instance.
Procedure
-
Log on to the XXL-JOB console and select a region in the top navigation bar. Click the ID of your XXL-JOB instance. In the left-side navigation pane, select Basic Information.
-
In the scheduling statistics dashboard, click the
icon in the upper-right corner and select Set alert rule, or click the
icon to go directly to the alert rule settings in CloudMonitor. -
Click Create Alert Rule. Select SchedulerX as the product, click Add Instance to select your instance, and then configure the alert rule.
ImportantThe Mute period is the interval during which an alert is suppressed after its initial notification.
In the Resource range section, select the Instance tab. In the Rule description area, click Add rule to configure alert conditions, and set parameters such as the Effective period and Alert contact group.
-
Click Add rule to select a metric. Metrics are available at two levels:
Instance LevelandApplication Level.-
Instance-level metrics: These metrics aggregate trigger and execution statistics for all jobs in the instance.
In the Set rule description dialog box, enter a Rule name (for example,
xx-instance-failure-monitoring), set Metric type to Simple metric, and choose Instance-level failure count from the Metric drop-down list. You can then set thresholds for three alert levels: phone + SMS + email + webhook, SMS + email + webhook, and email + webhook. For each level, you can define a threshold and unit, such ascount/m. -
Application-level metrics: These metrics aggregate trigger and execution statistics for jobs in a specified application within the instance.
-
If the application has not reported any metrics yet, it will not appear in the appName drop-down list. In this case, you can enter the name manually.
-
If appName is left blank, the alert rule applies to all applications by default.
In the Metric drop-down list, select Application-level failure count. In the Threshold and alert level section, you can set thresholds for three levels: Critical (notified by phone + SMS + email + webhook), Warn (notified by SMS + email + webhook), and Info (notified by email + webhook). The default condition triggers an alert if the metric value is greater than or equal to the threshold for three consecutive periods (one period is one minute). The unit is count/m.
-
-
-
Add an alert contact group and click OK to complete the alert configuration.
On the Create Alert Rule page, configure the Rule description by setting alert thresholds and consecutive failure counts for the Critical, Warn, and Info levels. Set the Mute period (for example, 24 hours) and Effective period (including time range, time zone, and effective days). You can also add tags as needed. Expand the Advanced settings to configure a Webhook for alert callback URL, a Push channel (options include Auto Scaling, Log Service, Message Service (MNS) topic, and Function Compute), a toggle for Recovery notification, and the method for No data handling.