Zabbix is a commonly used open source monitoring system that provides various alert rules for system monitoring. Zabbix also supports multiple notification methods. You can configure the alert ingestion system of Log Service as a notification method in Zabbix. This way, Zabbix alerts can be ingested into Log Service. Then, the alerting system of Log Service denoises the alerts and sends alert notifications. This topic applies to Zabbix 3.2 to 4.2.
Prerequisites
- An alert ingestion application is created. The Protocol parameter of the alert ingestion application is set to Zabbix. For more information, see Configure webhook URLs for alert ingestion.
- Download the alibaba_cloud_sls.py file.
Configure an alert notification method in the Zabbix console
- Install the notification script on the server where Zabbix is installed.
- Log on to the Zabbix console.
- Add a notification method named Alibaba Cloud SLS.
- Create an action.
- Configure a notification method for a specific user.
Alert parsing
A Zabbix alert contains more than 100 macros. For more information, see Zabbix documentation. Log Service selects only dozens of the macros to construct an alert. The following table provides examples of the macros in Zabbix alerts.
Zabbix macro name | Example |
---|---|
{TRIGGER.ID} | 19006 |
{TRIGGER.NAME} | test used |
{EVENT.VALUE} | 1 |
{DATE} | 2021.06.10 |
{TIME} | 12:44:23 |
{EVENT.DATE} | 2021.06.10 |
{EVENT.TIME} | 19:23:01 |
{EVENT.RECOVERY.DATE} | "" |
{EVENT.RECOVERY.TIME} | "" |
{HOST.NAME} | zabbix-agent |
{HOST.IP} | 192.0.2.0 |
{TRIGGER.HOSTGROUP.NAME} | Linux servers |
{TRIGGER.DESCRIPTION} | The system is running out of free memory. |
{EVENT.TAGS} | Application:Memory |
{TRIGGER.NSEVERITY} | 2 |
{EVENT.ID} | 1036 |
Field mappings
After a Zabbix alert is ingested into Log Service, the alert is converted to an alert that is supported by Log Service by using field mapping. The following table describes the mappings between the alert attributes of Log Service and the alert fields of Zabbix.
Log Service | Zabbix | Description |
---|---|---|
aliuid | None | The ID of the Alibaba Cloud account to which the alert ingestion application belongs. |
alert_id | {TRIGGER.ID} | The ID of the alert monitoring rule. |
alert_type | None | The type of the alert. Valid value: sls_pub. |
alert_name | {TRIGGER.NAME} | The name of the alert monitoring rule. |
status | {ALERT.SUBJECT} | The status of the alert. Valid values: firing and resolved. |
next_eval_interval | None | The interval at which the alert is evaluated. Valid value: 0. |
alert_time | None | The time when the alert was last evaluated.
The value of the alert_time field is calculated based on the values of the {DATE} and {TIME} fields. |
fire_time | None | The time when the alert is triggered for the first time.
The value of the fire_time field is calculated based on the values of the {EVENT.DATE} and {EVENT.TIME} fields. |
resolve_time | None | The time when the alert is cleared.
|
labels | {HOST.NAME} | The labels of the alert.
If you add a label on the Enrichment tab when you create the alert ingestion application, the label is added to the labels field.
Note If the key of the specified label on the Enrichment tab is the same as a subfield in the tags field of the Zabbix alert, the label on the Enrichment tab prevails.
|
annotations | {EVENT.TAGS} | After the Zabbix alert is ingested into Log Service, the value of the {EVENT.TAGS} field is expanded into multiple key-value pairs and the key-value pairs are added
to the annotations field of the corresponding Log Service alert.
The following fields are also added to the annotations field of the corresponding
Log Service alert:
If you add an annotation on the Enrichment tab when you create the alert ingestion application, the annotation is added to the annotations field. |
severity | {TRIGGER.NSEVERITY} | The severity of the alert. For more information, see Table 2. |
policy | None | The alert policy that is specified for the alert ingestion application. For more information, see Description of the policy variable. |
project | None | The project to which Alert Center belongs. For more information, see Project. |
drill_down_query | {$ZABBIX.SERVER.URL}, {TRIGGER.ID}, and {EVENT.ID} | The value is a link. You can click the link to go to the alert management page of the Zabbix console. |
Severity in Zabbix | Severity in Log Service |
---|---|
Not Classified | report |
Information | low |
Warning | medium |
Average | medium |
High | high |
Disaster | critical |
FAQ
How do I view operation logs?
- Log on to the Zabbix console.
- In the top navigation bar, choose .