2022 Zabbix中国峰会
2022 Zabbix中国峰会

4 实时导出事件,监控项采集值,趋势数据

概述

Overview

可以配置使用换行符分隔的JSON格式实时导出触发器事件,监控项采集值,趋势数据。

It is possible to configure real-time exporting of trigger events, item values and trends in a newline-delimited JSON format.

导出完成后的文件中,每一行都是JSON对象。值映射不被应用。 Exporting is done into files, where each line of the export file is a JSON object. Value mappings are not applied.

如果无法将数据写入导出文件或无法重命名导出文件或重命名后无法创建新文件,则Zabbix将以10秒的间隔进行重试,直到成功为止。 In case data cannot be written to the export file or the export file cannot be renamed or new one cannot be created after renaming it, Zabbix will retry with 10 second interval until success.

有关导出数据的详细信息,请参见导出协议页面。 For precise details on what information is exported, see the export protocol page.

请注意,如果在收到数据后,在服务器导出数据之前删除了主机/监控项,主机/监控项可能没有元数据(例如:主机组,主机名,监控项名称)。 Note that host/item can have no metadata (host groups, host name, item name) if the host/item was removed after the data was received, but before server exported data.

配置

Configuration

实时导出触发器事件,监控项采集值,趋势数据可以通过Zabbix server配置文件中的ExportDir参数来指定数据导出目录。 Real-time export of trigger events, item values and trends is configured by specifying a directory for the export files - see the ExportDir parameter in server configuration.

另外一个参数ExportFileSize可用于设置单个导出文件的最大允许大小。 Another parameter - ExportFileSize may be used to set the maximum allowed size of an individual export file.

当进程需要写入文件时,它首先检查文件的大小。 如果超出配置的大小限制,则重命名该文件(在原文件名后加入.old后缀),并创建具有原文件名的新文件。

When a process needs to write to a file it checks the size of the file first. If it exceeds the configured size limit, the file is renamed by appending .old to its name and a new file with the original name is created.