Zabbix is a commonly used open source monitoring system. Zabbix provides a variety of alert rules for system monitoring. Log Service allows you to collect monitoring data from Zabbix to a Logstore. This topic describes how to collect Zabbix data to Log Service.

Prerequisites

Step 1: Specify a data storage path

Zabbix stores monitoring data on the machine on which Zabbix is installed. To specify the storage path for monitoring data, perform the following steps:

  1. Log on to the ECS instance on which Zabbix is installed.
  2. Open the zabbix_server.conf file.
    vim /etc/zabbix/zabbix_server.conf
  3. Specify the data storage path in the zabbix_server.conf file.
    ExportDir=/tmp/
  4. Restart the Zabbix service for the setting to take effect.
    systemctl restart zabbix-server
    After the setting takes effect, Zabbix generates a file whose file name extension is .ndjson in the /tmp directory to store monitoring data.

Step 2: Create a Logtail configuration

  1. Log on to the Log Service console.
  2. In the Import Data section, click JSON - Text Log.
  3. Select the project and Logstore. Then, click Next.
  4. Create a machine group.
    1. On the ECS Instances tab, select the ECS instance on which Zabbix is installed. Then, click Execute Now.

      For more information, see Install Logtail on ECS instances.

      If Zabbix is installed on a server in a self-managed cluster or a server on a third-party cloud, you must manually install Logtail. For more information, see Install Logtail on a Linux server or Install Logtail on a Windows server.

    2. After Logtail is installed, click Complete Installation.
    3. In the Create Machine Group step, configure Name and click Next.

      Log Service allows you to create IP address-based machine groups and custom identifier-based machine groups. For more information, see Create an IP address-based machine group and Create a custom ID-based machine group.

  5. Select and move the new machine group from Source Server Groups to Applied Server Groups. Then, click Next.
    Notice If you immediately apply a machine group after it is created, the heartbeat status of the machine group may be FAIL. This issue occurs because the machine group is not connected to Log Service. In this case, you can click Automatic Retry. If the issue persists, see What do I do if no heartbeat connections are detected on Logtail?
  6. Create a Logtail configuration and click Next.

    Zabbix monitoring data is of the JSON type. We recommend that you select JSON Mode for Mode in the Logtail configuration. In addition, you must set Log Path to the data storage path that you specify in Step Step 1: Specify a data storage path. For more information about other parameters, see Collect logs in JSON mode.

    Logtail configuration
  7. Preview data, configure indexes, and then click Next.
    By default, full-text indexing is enabled for Log Service. You can also configure field indexes based on collected logs in manual or automatic mode. For more information, see Configure indexes.
    Note If you want to query and analyze logs, you must enable full-text indexing or field indexing. If you enable both full-text indexing and field indexing, the system uses only field indexes.