1 Zabbix agent

概述

这些检查通过与Zabbix agent的通信来收集数据。

存在passive and active agent检查。在配置监控项时,您可以选择所需的类型:

  • Zabbix agent - 用于被动检查
  • Zabbix agent (active) - 用于主动检查

支持的 监控项 键

该表格提供了可按监控项系列分组的Zabbix agent 监控项所使用的监控项键详细信息.

另请参阅:

必选与可选参数

不带尖括号的参数是必选的。用尖括号 < > 标记的参数是可选的。

命令行工具的使用

请注意,当在命令行中使用 zabbix_agentd 或 zabbix_get 测试或使用 监控项 键时,还需考虑 shell 语法。

例如,如果某个键参数需要用双引号括起来,则必须显式转义双引号,否则它们会被 shell 作为特殊字符截断,而不会被传递给 Zabbix 工具。

示例:

zabbix_agentd -t 'vfs.dir.count[/var/log,,,"file,dir",,0]'
       
       zabbix_agentd -t vfs.dir.count[/var/log,,,\"file,dir\",,0]
内核数据
监控项 键
Description 返回值 参数 注释
kernel.maxfiles
Maximum number of opened files supported by OS. integer
kernel.maxproc
Maximum number of processes supported by OS. integer
kernel.openfiles
Return the number of currently open file descriptors. integer 该 监控项 自 Zabbix 6.0 起支持。
日志数据

请参阅log monitoring上的更多信息。

监控项 键
Description 返回值 参数 备注
log[file,<regexp>,<encoding>,<maxlines>,<mode>,<output>,<maxdelay>,<options>,<persistent_dir>]
Monitoring of a log file. 日志 file - 日志文件file的完整路径及名称
regexp - 描述所需模式的正则表达式概述
encoding - 代码页编码设置
maxlines - agent每秒发送给Zabbix server或proxy的最大新行数。该参数会覆盖zabbix_agentd.conf中的'MaxLinesPerSecond'值
mode (自version 2.0起)- 可选值:
all (默认), skip - 跳过旧数据处理(仅影响新建的监控项)
output (自version 2.2起) - 可选的输出格式化模板。转义序列\0会被替换为匹配的文本部分(从匹配开始的首字符到匹配结束的末字符),而\N(N=1...9)会被替换为第N个匹配组(若N超过捕获组数量则返回空string)
maxdelay (自version 3.2起) - 最大延迟秒数。类型: float。取值: 0 - (默认)永不忽略日志file行; > 0.0 - 为get在"maxdelay"秒内分析的最新行而忽略旧行。使用前请阅读使用-maxdelay-参数说明!
options (自version 4.4.7起) - 附加选项:
mtime-noreread - 非唯一记录,仅当file大小变化时重读(忽略修改时间变化)。(该参数自5.0.2起废弃,因现已忽略mtime)
persistent_dir (自5.0.18/5.4.9版本起,仅限Unix系统的zabbix_agentd;Agent2不支持) - 持久化文件存储目录的绝对路径。另见日志持久化文件注意事项-监控项的补充说明
该监控项必须配置为主动检查
若file缺失或权限不足,监控项将转为不支持状态

output留空 - 则返回包含匹配文本的整行。注意除'Result is TRUE'外的所有全局正则表达式类型始终返回整行,此时output参数被忽略

使用output参数的内容提取操作在agent端执行

示例:
=> log[/var/log/syslog]
=> log[/var/log/syslog,error]
=> log[/home/zabbix/logs/logfile,,,100]

使用output参数从日志记录提取数字:
=> log[/app1/app.log,"task run [0-9.]+ sec, processed ([0-9]+) records, [0-9]+ errors",,,,\1] → 将匹配日志记录"2015-11-13 10:08:26 task run 6.08 sec, processed 6080 records, 0 errors"并仅发送'6080'到服务器。由于发送的是数值,可将该监控项的"信息类型"设为"数值(无符号)"并用于图表、触发器等功能

使用output参数在发送前重写日志记录:
=> log[/app1/app.log,"([0-9 :-]+) task run ([0-9.]+) sec, processed ([0-9]+) records, ([0-9]+) errors",,,,"\1 RECORDS: \3, ERRORS: \4, DURATION: \2"] → 将匹配日志记录"2015-11-13 10:08:26 task run 6.08 sec, processed 6080 records, 0 errors"并发送修改后的记录"2015-11-13 10:08:26 RECORDS: 6080, ERRORS: 0, DURATION: 6.08"到服务器
log.count[file,<regexp>,<encoding>,<maxproclines>,<mode>,<maxdelay>,<options>,<persistent_dir>]
Count of matched lines in a monitored log file. integer file - 日志file的完整路径及名称
regexp - 描述所需模式的正则表达式概述
encoding - 代码页编码设置
maxproclines - agent每秒分析的最大新行数(不得超过10000)。默认值为zabbix_agentd.conf中'MaxLinesPerSecond'的10倍。
mode - 可选值:
all(默认),skip - 跳过旧数据处理(仅影响新创建的监控项)。
maxdelay - 最大延迟秒数。类型:float。取值:0 -(默认)永不忽略日志file行;> 0.0 - 为get在"maxdelay"秒内分析的最新行而忽略旧行。使用前请阅读使用-maxdelay-参数说明!
options(自version 4.4.7起) - 附加选项:
mtime-noreread - 非唯一记录,仅当file大小变化时重读(忽略修改时间变化)。(该参数自5.0.2起弃用,因现已忽略mtime。)
persistent_dir(自5.0.18/5.4.9版本起,仅限Unix系统的zabbix_agentd;Agent2不支持) - 持久化文件存储目录的绝对路径。另见日志持久化文件注意事项-监控项的附加说明。
监控项必须配置为主动检查


匹配行数统计自agent上次日志检查后的新增行,因此取决于监控项的update间隔。
若file缺失或权限不足,监控项将转为不支持状态。

该监控项不支持Windows事件日志。

自Zabbix 3.2.0起支持。
logrt[file_regexp,<regexp>,<encoding>,<maxlines>,<mode>,<output>,<maxdelay>,<options>,<persistent_dir>]
Monitoring of a log file that is rotated. 日志 file_regexp - file的绝对路径,其中file名称使用正则expression指定。注意正则表达式仅适用于file名称,不需要匹配整个名称(例如,/path/to/agent将匹配zabbix_agentd.log)
regexp - 描述所需内容模式的正则概述
encoding - 代码页编码设置
maxlines - agent每秒发送到Zabbix server或proxy的最大新行数。此参数会覆盖zabbix_agentd.conf中的'MaxLinesPerSecond'值
mode (自version 2.0起) - 可能的值:
all (默认), skip - 跳过旧数据处理(仅影响新创建的监控项)
output (自version 2.2起) - 可选的输出格式化模板。\0转义序列被替换为匹配的文本部分(从匹配开始的第一个字符到匹配结束的字符),而\N(其中N=1...9)转义序列被替换为第N个匹配组(如果N超过捕获组数量则为空string)
maxdelay (自version 3.2起) - 最大延迟秒数。类型:float。值:0 - (默认)永不忽略日志file行;> 0.0 - 忽略旧行以便get在"maxdelay"秒内分析的最新行。使用前请阅读使用-maxdelay-参数说明!
options (自version 4.0起;mtime-rereadmtime-noreread选项自4.4.7起) - 日志file轮转类型及其他选项。可能的值:
rotate (默认),
copytruncate - 注意copytruncate不能与maxdelay一起使用。此时maxdelay必须为0或未指定;参见关于处理copytruncate日志文件轮转的注意事项说明,
mtime-reread - 非唯一记录,修改时间或大小变化时重新读取(默认),
mtime-noreread - 非唯一记录,仅大小变化时重新读取(忽略修改时间变化)
persistent_dir (自5.0.18、5.4.9版本起,仅限Unix系统的zabbix_agentd;Agent2不支持) - 存储持久化文件的目录绝对路径名。另见日志持久化文件注意事项-监控项的附加说明
监控项必须配置为主动检查
日志轮转基于文件的最后修改时间

注意logrt设计用于处理一个当前活动的日志file,同时轮转其他几个匹配的非活动文件。例如,如果一个目录有许多活动日志文件,应为每个文件创建单独的logrt监控项。否则如果一个logrt监控项拾取过多文件,可能导致memory耗尽和监控崩溃

如果output留空 - 返回包含匹配文本的整行。注意除'Result is TRUE'外的所有全局正则表达式类型总是返回整个匹配行,output参数被忽略

使用output参数的内容提取发生在agent上

file regexp参数中,日志目录路径和日志file正则表达式必须用正确的目录分隔符分隔:
- Windows上分隔符必须是反斜杠(\)
- 其他系统上必须是正斜杠(/)
Windows上其他位置可能容忍正斜杠,除了分隔日志目录路径和日志file正则表达式的位置(见下例)

Windows示例:
=> logrt["c:/dir1/dir2/dir3\filename.*\.log","pattern_to_match"] → 将从"c:/dir1/dir2/dir3"中file名称以"filename"开头且以匹配".log"的任何扩展名结尾的日志文件收集数据
=> logrt["//example.com/share/dir1/dir2/dir3\filename.*\.log","pattern_to_match"] → 将从网络共享"//example.com/share/dir1/dir2/dir3"中file名称以"filename"开头且以匹配".log"的任何扩展名结尾的日志文件收集数据

其他系统示例:
=> logrt["/home/zabbix/logs/^logfile[0-9]{1,3}$",,,100] → 将匹配"logfile1"之类的file(不匹配".logfile1")
=> logrt["/home/user/^logfile_.*_[0-9]{1,3}$","pattern_to_match","UTF-8",100] → 将从"logfile_abc_1"或"logfile__001"等文件收集数据

使用output参数从日志记录中提取数字:
=> logrt[/app1/^test.*log$,"task run [0-9.]+ sec, processed ([0-9]+) records, [0-9]+ errors",,,,\1] → 将匹配日志记录"2015-11-13 10:08:26 task run 6.08 sec, processed 6080 records, 0 errors"并仅发送'6080'到服务器。由于发送的是数值,此监控项的"信息类型"可设为"数值(无符号)",该值可用于图表、触发器等等

使用output参数在发送到服务器前重写日志记录:
=> logrt[/app1/^test.*log$,"([0-9 :-]+) task run ([0-9.]+) sec, processed ([0-9]+) records, ([0-9]+) errors",,,,"\1 RECORDS: \3, ERRORS: \4, DURATION: \2"] → 将匹配日志记录"2015-11-13 10:08:26 task run 6.08 sec, processed 6080 records, 0 errors"并发送修改后的记录"2015-11-13 10:08:26 RECORDS: 6080, ERRORS: 0, DURATION: 6.08"到服务器
logrt.count[file_regexp,<regexp>,<encoding>,<maxproclines>,<mode>,<maxdelay>,<options>,<persistent_dir>]
Count of matched lines in a monitored log file that is rotated. integer file_regexp - file的绝对路径,其中file名称使用正则expression指定。注意正则表达式仅适用于file名称,且无需匹配完整名称(例如/path/to/agent将匹配zabbix_agentd.log)
regexp - 描述所需内容模式的正则概述
encoding - 代码页编码设置
maxproclines - agent每秒分析的最大新行数(不得超过10000)。默认值为zabbix_agentd.conf中'MaxLinesPerSecond'的10倍
mode - 可选值:
all(默认),skip - 跳过旧数据处理(仅影响新建的监控项)
maxdelay - 最大延迟秒数。类型:float。取值:0 -(默认)永不忽略日志file行;> 0.0 - 为get在"maxdelay"秒内分析的最新行而忽略旧行。使用前请阅读使用-maxdelay-参数说明!
options(自version 4.0起;mtime-rereadmtime-noreread选项自4.4.7起)- 日志file轮转类型及其他选项。可选值:
rotate(默认)
copytruncate - 注意copytruncate不能与maxdelay同时使用。此时maxdelay必须为0或不指定;参见关于处理copytruncate日志文件轮转的注意事项说明
mtime-reread - 非唯一记录,若修改时间或大小变化则重读(默认)
mtime-noreread - 非唯一记录,仅当大小变化时重读(忽略修改时间变化)
persistent_dir(自5.0.18/5.4.9版本起,仅限Unix系统的zabbix_agentd;Agent2不支持)- 存储持久化文件的目录绝对路径。另见日志持久化文件注意事项-监控项的附加说明
该监控项必须配置为主动检查

匹配行数统计自agent上次检查后的新行,因此取决于监控项的update间隔

日志轮转基于文件的最后修改时间

此监控项不支持Windows事件日志

自Zabbix 3.2.0起支持
file regexp参数中,日志目录路径与日志file正则表达式必须用正确的目录分隔符分隔:
- Windows系统必须使用反斜杠()
- 其他系统必须使用正斜杠(/)
Windows系统中其他位置可能允许使用正斜杠,但分隔日志目录路径与日志file正则表达式的分隔符除外(参见下方示例):

Windows示例:
=> logrt.count["c:/dir1/dir2/dir3\filename.*\.log","pattern_to_match"] → 将统计"c:/dir1/dir2/dir3"目录中日志文件内"pattern_to_match"模式的匹配次数
=> logrt.count["//example.com/share/dir1/dir2/dir3\filename.*\.log","pattern_to_match"] → 将统计网络共享"//example.com/share/dir1/dir2/dir3"上日志文件内"pattern_to_match"模式的匹配次数

其他系统示例:
=> logrt.count["/home/zabbix/logs/^logfile[0-9]{1,3}$",,,100] → 将统计"/home/zabbix/logs"目录中日志文件内"^logfile[0-9]{1,3}$"模式的匹配次数
=> logrt.count["/home/user/^logfile_.*_[0-9]{1,3}$","pattern_to_match","UTF-8",100] → 将统计"/home/user"目录中日志文件内"pattern_to_match"模式的出现次数
Modbus 数据
监控项 键
Description 返回值 参数 注释
modbus.get[endpoint,<slave id>,<function>,<address>,<count>,<type>,<endianness>,<offset>]
Reads Modbus data. JSON object endpoint - 定义为 protocol://connection_string 的端点
slave id - 从站ID
function - Modbus功能码
address - 首个寄存器/线圈/输入的地址
count - 要读取的记录数
type - 数据类型
endianness - 字节序配置
offset - 从 '地址' 开始将被丢弃结果的寄存器数量

查看参数的 detailed description
自Zabbix 5.2.0起支持
网络数据
监控项 键值
Description 返回值 参数 注释
net.dns[<ip>,name,<type>,<timeout>,<count>,<protocol>]
Checks if DNS service is up. 0 - DNS不可用(服务器未响应或DNS解析失败)

1 - DNS可用
ip - DNS服务器IP地址(留空则使用默认DNS服务器,Windows上仅支持Zabbix agent 2,Zabbix agent忽略此参数)
name - 需query的DNS名称
type - 查询的记录类型(默认为SOA
timeout(Windows上忽略,除非使用Zabbix agent 2 version 6.0.1或更新版本)- 请求超时时间(秒,默认1秒)
count(Windows上忽略,除非使用Zabbix agent 2 version 6.0.1或更新版本)- 请求重试次数(默认2次)
protocol(自version 3.0起)- 执行DNS queries的协议:udp(默认)或tcp
示例:
=> net.dns[8.8.8.8,example.com,MX,2,1]

type可能的取值:
ANY, A, NS, CNAME, MB, MG, MR, PTR, MD, MF, MX, SOA, NULL, WKS(Windows上的Zabbix agent及所有OS的Zabbix agent 2不支持), HINFO, MINFO, TXT, AAAA, SRV

不支持国际化域名,请使用IDNA编码名称替代。

SRV记录类型自Zabbix 1.8.6(Unix)和2.0.0(Windows)起支持。

Zabbix 2.0之前的命名方式(仍支持):net.tcp.dns
net.dns.record[<ip>,name,<type>,<timeout>,<count>,<protocol>]
Performs a DNS query. 包含所需信息类型的字符string ip - DNS服务器IP地址(留空则使用默认DNS服务器,Windows上忽略,除非使用Zabbix agent 2 version 6.0.1或更新版本)
name - 需query的DNS名称
type - 查询的记录类型(默认为SOA
timeout(Windows上忽略,除非使用Zabbix agent 2 version 6.0.1或更新版本)- 请求超时时间(秒,默认1秒)
count(Windows上忽略,除非使用Zabbix agent 2 version 6.0.1或更新版本)- 请求重试次数(默认2次)
protocol(自version 3.0起)- 执行DNS queries的协议:udp(默认)或tcp
示例:
=> net.dns.record[8.8.8.8,example.com,MX,2,1]

type可能的取值:
ANY, A, NS, CNAME, MB, MG, MR, PTR, MD, MF, MX, SOA, NULL, WKS(Windows上的Zabbix agent及所有OS的Zabbix agent 2不支持), HINFO, MINFO, TXT, AAAA, SRV

不支持国际化域名,请使用IDNA编码名称替代。

SRV记录类型自Zabbix 1.8.6(Unix)和2.0.0(Windows)起支持。

Zabbix 2.0之前的命名方式(仍支持):net.tcp.dns.query
net.if.collisions[if]
Number of out-of-window collisions. integer if - 网络接口名称
net.if.discovery
List of network interfaces. Used for low-level discovery. JSON object 自Zabbix 2.0起支持。

FreeBSD、OpenBSD和NetBSD自Zabbix 2.2起支持。

某些Windows版本(如Server 2008)可能需要安装最新更新以支持接口名称中的非ASCII字符。
net.if.in[if,<mode>]
Incoming traffic statistics on network interface. integer if - 网络接口名称(Unix);网络接口完整描述或IPv4地址;或大括号内的网络接口GUID(Windows)
mode - 可选值:
bytes - 字节数(默认)
packets - 数据包数
errors - 错误数
dropped - 丢弃包数
overruns (fifo) - FIFO缓冲区错误数
frame - 数据包帧错误数
compressed - 设备驱动接收的压缩包数
multicast - 设备驱动接收的多播帧数
Windows上,监控项优先从64位计数器获取值(如果可用)。64位接口统计计数器自Windows Vista和Windows Server 2008引入。若64位计数器不可用,agent将使用32位计数器。

Windows上的多字节接口名称自Zabbix 1.8.6起支持。

示例:
=> net.if.in[eth0,errors]
=> net.if.in[eth0]

可通过net.if.discovery或net.if.list 监控项获取Windows网络接口描述。

可结合每秒变化预处理步骤使用此键值以get每秒字节数统计。
net.if.out[if,<mode>]
Outgoing traffic statistics on network interface. integer if - 网络接口名称(Unix);网络接口完整描述或IPv4地址;或大括号内的网络接口GUID(Windows)
mode - 可选值:
bytes - 字节数(默认)
packets - 数据包数
errors - 错误数
dropped - 丢弃包数
overruns (fifo) - FIFO缓冲区错误数
collisions (colls) - 接口检测到的冲突数
carrier - 设备驱动检测到的载波丢失数
compressed - 设备驱动发送的压缩包数
Windows上,监控项优先从64位计数器获取值(如果可用)。64位接口统计计数器自Windows Vista和Windows Server 2008引入。若64位计数器不可用,agent将使用32位计数器。

Windows上的多字节接口名称自Zabbix agent 1.8.6 version起支持。

示例:
=> net.if.out[eth0,errors]
=> net.if.out[eth0]

可通过net.if.discovery或net.if.list 监控项获取Windows网络接口描述。

可结合每秒变化预处理步骤使用此键值以get每秒字节数统计。
net.if.total[if,<mode>]
Sum of incoming and outgoing traffic statistics on network interface. integer if - 网络接口名称(Unix);网络接口完整描述或IPv4地址;或大括号内的网络接口GUID(Windows)
mode - 可选值:
bytes - 字节数(默认)
packets - 数据包数
errors - 错误数
dropped - 丢弃包数
overruns (fifo) - FIFO缓冲区错误数
compressed - 设备驱动发送或接收的压缩包数
Windows上,监控项优先从64位计数器获取值(如果可用)。64位接口统计计数器自Windows Vista和Windows Server 2008引入。若64位计数器不可用,agent将使用32位计数器。

示例:
=> net.if.total[eth0,errors]
=> net.if.total[eth0]

可通过net.if.discovery或net.if.list 监控项获取Windows网络接口描述。

可结合每秒变化预处理步骤使用此键值以get每秒字节数统计。

注意:仅当net.if.in和net.if.out在您的平台上均支持丢弃包统计时,此功能才可用。
net.tcp.listen[port]
Checks if this TCP port is in LISTEN state. 0 - 非LISTEN状态

1 - 处于LISTEN状态
port - TCP端口号 示例:
=> net.tcp.listen[80]

Linux自Zabbix 1.8.4起支持

自Zabbix 3.0.0起,在Linux内核2.6.14及以上版本中,优先从内核NETLINK接口获取监听TCP套接字信息(如果可能)。否则从/proc/net/tcp和/proc/net/tcp6文件获取。
net.tcp.port[<ip>,port]
Checks if it is possible to make TCP connection to specified port. 0 - 无法连接

1 - 可连接
ip - IP或DNS名称(默认127.0.0.1)
port - 端口号
示例:
=> net.tcp.port[,80] → 可用于测试80端口Web服务器可用性。

简单TCP性能测试请使用net.tcp.service.perf[tcp,<ip>,<port>]

注意:这些检查可能导致系统守护进程日志中出现额外消息(SMTP和SSH会话通常会被记录)。
net.tcp.service[service,<ip>,<port>]
Checks if service is running and accepting TCP connections. 0 - 服务不可用

1 - 服务运行中
service - 可选值:
ssh, ldap, smtp, ftp, http, pop, nntp, imap, tcp, https, telnet(参见details
ip - IP或DNS名称(默认127.0.0.1)
port - 端口号(默认使用标准服务端口)
示例:
=> net.tcp.service[ftp,,45] → 可用于测试45端口FTP服务器可用性。

注意:这些检查可能导致系统守护进程日志中出现额外消息(SMTP和SSH会话通常会被记录)。

目前不支持加密协议检查(如993端口IMAP或995端口POP)。临时解决方案:对此类检查请使用net.tcp.port。

Windows上的LDAP和HTTPS检查仅Zabbix agent 2支持。

注意:telnet检查会寻找login提示符(末尾的':')。

httpstelnet服务自Zabbix 2.0起支持。
net.tcp.service.perf[service,<ip>,<port>]
Checks performance of TCP service. float

0 - 服务不可用

秒数 - 连接服务所耗时间
service - 可选值:
ssh, ldap, smtp, ftp, http, pop, nntp, imap, tcp, https, telnet(参见details
ip - IP或DNS名称(默认127.0.0.1)
port - 端口号(默认使用标准服务端口)
示例:
=> net.tcp.service.perf[ssh] → 可用于测试SSH服务器初始响应速度。

目前不支持加密协议检查(如993端口IMAP或995端口POP)。临时解决方案:对此类检查请使用net.tcp.service.perf[tcp,<ip>,<port>]。

Windows上的LDAP和HTTPS检查仅Zabbix agent 2支持。

注意:telnet检查会寻找login提示符(末尾的':')。

httpstelnet服务自Zabbix 2.0起支持。
net.tcp.socket.count[<laddr>,<lport>,<raddr>,<rport>,<state>]
Return the number of TCP sockets that match parameters. integer laddr - 本地IPv4/6地址或CIDR子网
lport - 本地端口号或服务名称
raddr - 远程IPv4/6地址或CIDR子网
rport - 远程端口号或服务名称
state - 连接状态(established, syn_sent, syn_recv, fin_wait1, fin_wait2, time_wait, close, close_wait, last_ack, listen, closing
该监控项仅在Linux上的Zabbix agent/agent 2支持。Zabbix agent 2上64位Windows也支持。

示例:
=> net.tcp.socket.count[,80,,,established] → 返回本地TCP端口80处于established状态的连接数

该监控项自Zabbix 6.0起支持。
net.udp.listen[port]
Checks if this UDP port is in LISTEN state. 0 - 非LISTEN状态

1 - 处于LISTEN状态
port - UDP端口号 示例:
=> net.udp.listen[68]

Linux自Zabbix 1.8.4起支持
net.udp.service[service,<ip>,<port>]
Checks if service is running and responding to UDP requests. 0 - 服务不可用

1 - 服务运行中
service - ntp(参见details
ip - IP或DNS名称(默认127.0.0.1)
port - 端口号(默认使用标准服务端口)
示例:
=> net.udp.service[ntp,,45] → 可用于测试45端口NTP服务可用性。

该监控项自Zabbix 3.0.0起支持,但早期版本中ntp服务可通过net.tcp.service[] 监控项使用。
net.udp.service.perf[service,<ip>,<port>]
Checks performance of UDP service. float

0 - 服务不可用

秒数 - 等待服务响应的耗时
service - ntp(参见details
ip - IP或DNS名称(默认127.0.0.1)
port - 端口号(默认使用标准服务端口)
示例:
=> net.udp.service.perf[ntp] → 可用于测试NTP服务响应时间。

该监控项自Zabbix 3.0.0起支持,但早期版本中ntp服务可通过net.tcp.service[] 监控项使用。
net.udp.socket.count[<laddr>,<lport>,<raddr>,<rport>,<state>]
Return the number of UDP sockets that match parameters. integer laddr - 本地IPv4/6地址或CIDR子网
lport - 本地端口号或服务名称
raddr - 远程IPv4/6地址或CIDR子网
rport - 远程端口号或服务名称
state - 连接状态(established, unconn
该监控项仅在Linux上的Zabbix agent/agent 2支持。Zabbix agent 2上64位Windows也支持。

示例:
=> net.udp.socket.count[,,,,established] → 返回处于连接状态的UDP套接字数

该监控项自Zabbix 6.0起支持。
处理数据
监控项 键
Description 返回值 参数 备注
proc.cpu.util[<name>,<user>,<type>,<cmdline>,<mode>,<zone>]
Process CPU utilization percentage. float name - 进程名称(默认为所有进程
user - 用户名(默认为所有用户
type - CPU利用率类型:
total(默认)、usersystem
cmdline - 按命令行过滤(支持正则概述
mode - 数据采集模式:avg1(默认)、avg5avg15
zone - 目标区域:current(默认)、all。该参数仅在Solaris系统上支持
示例:
=> proc.cpu.util[,root] → "root"用户下运行的所有进程的CPU利用率
=> proc.cpu.util[zabbix_server,zabbix] → zabbix用户下运行的zabbix_server进程的CPU利用率

返回值基于单核CPU利用率百分比。例如完全占用两个核心的进程CPU利用率为200%。

进程CPU利用率数据由采集器收集,最多支持1024个唯一(按名称、用户和命令行区分)queries。超过24小时未访问的queries将从采集器中移除。

注意:当zone参数设置为current(或默认值)时,若agent在不支持区域的Solaris系统上编译,但运行在支持区域的新版Solaris系统上,则agent将返回NOTSUPPORTED(agent无法将结果限制在当前区域)。但此情况下仍支持all参数。

该监控项从Zabbix 3.0.0版本开始支持,可在多个平台上使用(参见Items supported by platform)。
proc.mem[<name>,<user>,<mode>,<cmdline>,<memtype>]
Memory used by process in bytes. integer - with mode as max, min, sum

float - with mode as avg
name - process name (default is all processes)
user - user name (default is all users)
mode - possible values:
avg, max, min, sum (default)
cmdline - filter by command line (it is a regular 概述)
memtype - type of memory used by process
Examples:
=> proc.mem[,root] → memory used by all processes running under the "root" user
=> proc.mem[zabbix_server,zabbix] → memory used by all zabbix_server processes running under the zabbix user
=> proc.mem[,oracle,max,oracleZABBIX] → memory used by the most memory-hungry process running under oracle having oracleZABBIX in its command line

Note: When several processes use shared memory, the sum of memory used by processes may result in large, unrealistic values.

See notes on selecting processes with name and cmdline parameters (Linux-specific).

When this 监控项 is invoked from the command line and contains a command line parameter (e.g. using the agent test mode: zabbix_agentd -t proc.mem[,,,apache2]), one extra process will be counted, as the agent will count itself.

The memtype parameter is supported on several platforms since Zabbix 3.0.0.
proc.num[<name>,<user>,<state>,<cmdline>,<zone>]
The number of processes. integer name - 进程名称(默认为所有进程
user - 用户名(默认为所有用户
statedisktrace选项自version 3.4.0起支持) - 可选值:
all(默认),
disk - 不可中断睡眠,
run - 运行中,
sleep - 可中断睡眠,
trace - 已停止,
zomb - 僵尸进程
cmdline - 按命令行过滤(支持正则表达式概述
zone - 目标区域:current(默认),all。该参数仅支持Solaris系统
示例:
=> proc.num[,mysql] → 运行mysql用户下的进程数量
=> proc.num[apache2,www-data] → 运行www-data用户下的apache2进程数量
=> proc.num[,oracle,sleep,oracleZABBIX] → 命令行包含oracleZABBIX且运行oracle用户下的睡眠状态进程数量

关于使用namecmdline参数(Linux专有)选择进程,参见notes

在Windows系统上,仅支持nameuser参数。

当该监控项从命令行调用且包含命令行参数时(例如使用agent测试模式:zabbix_agentd -t proc.num[,,,apache2]),由于agent会统计自身,因此实际计数会多出一个进程。

注意:如果在Solaris系统上,当agent编译时不支持zone功能但运行在支持zone的新版Solaris时,将zone参数设为current(或默认值)会导致agent返回NOTSUPPORTED(因为agent无法将结果限制在当前zone)。但此情况下仍支持all参数。
传感器数据
监控项 键值
Description 返回值 参数 说明
sensor[device,sensor,<mode>]
Hardware sensor reading. float device - 设备名称;当mode参数省略时可使用正则概述
sensor - 传感器名称;当mode参数省略时可使用正则概述
mode - 可选值:
avg, max, min(若省略此参数,则device和sensor按字面值处理)
读取Linux 2.4系统的/proc/sys/dev/sensors文件

示例:
=> sensor[w83781d-i2c-0-2d,temp1]

Zabbix 1.8.4版本前使用sensor[temp1]格式
读取Linux 2.6+系统的/sys/class/hwmon目录

详见Linux系统下sensor 监控项的详细说明
读取OpenBSD系统的hw.sensors MIB

示例:
=> sensor[cpu0,temp0] → 单个CPU温度
=> sensor["cpu[0-2]$",temp,avg] → 前三个CPU的平均温度

自Zabbix 1.8.4起支持OpenBSD系统
系统数据
监控项 键
Description 返回值 参数 备注
system.boottime
System boot time. integer (Unix时间戳)
system.cpu.discovery
List of detected CPUs/CPU cores. Used for low-level discovery. JSON object 自2.4.0版本起支持所有平台。
system.cpu.intr
Device interrupts. integer
system.cpu.load[<cpu>,<mode>]
CPU load. float cpu - 可选值:
all (默认), percpu (自 version 2.0起; 总负载除以在线CPU数量)
mode - 可选值:
avg1 (一分钟平均值, 默认), avg5, avg15
当在Windows的Zabbix agent上启动采集器进程时,会初始化以下性能计数器并用于此监控项: \System\Processor Queue Length

示例:
=> system.cpu.load[,avg5].
system.cpu.num[<type>]
Number of CPUs. integer 类型 - 可选值:
online (默认), max
示例:
=> system.cpu.num
system.cpu.switches
Count of context switches. integer
system.cpu.util[<cpu>,<type>,<mode>,<logical_or_physical>]
CPU utilization percentage. float cpu - <CPU编号>all (默认值)
type - 可选值:
user (默认值), idle, nice, system (Windows默认值), iowait, interrupt, softirq, steal, guest (Linux内核2.6.24及以上版本), guest_nice (Linux内核2.6.33及以上版本).
详见该参数的platform-specific说明.
mode - 可选值:
avg1 (一分钟平均值, 默认值), avg5, avg15
logical_or_physical (自version 5.0.3起; 仅AIX系统) - 可选值: logical (默认值), physical. 该参数仅AIX系统支持.
Windows系统中该值通过Processor Time性能计数器获取. 注意从Windows 8开始, 其任务管理器基于Processor Utility性能计数器显示CPU利用率, 而早期版本使用Processor Time计数器(参见more details).

示例:
=> system.cpu.util[0,user,avg5]

旧命名方式: system.cpu.idleX, system.cpu.niceX, system.cpu.systemX, system.cpu.userX
system.hostname[<type>, <transform>]
System host name. string type (在version 5.4.7之前仅Windows支持) - 可选值: netbios (Windows默认), 主机 (Linux默认), shorthost (自version 5.4.7起; 返回主机名第一个点之前的部分,对于不含点的名称返回完整string)。
transform (自version 5.4.7起) - 可选值:
none (默认), lower (转换为小写)
该值在Windows上通过GetComputerName() (用于netbios)或gethostname() (用于主机)函数获取,在其他系统上通过从uname()系统API输出中获取nodename

返回值示例:
Linux系统:
=> system.hostname → linux-w7x1
=> system.hostname → example.com
=> system.hostname[shorthost] → example
Windows系统:
=> system.hostname → WIN-SERV2008-I6
=> system.hostname[主机] → Win-Serv2008-I6LonG
=> system.hostname[主机,lower] → win-serv2008-i6long

另见配置
system.hw.chassis[<info>]
Chassis information. string info - 可选值为 full(默认)、modelserialtypevendor 示例:
=> system.hw.chassis[full] → 惠普 HP Pro 3010 小型立式电脑 CZXXXXXXXX 台式机

该键值依赖于 SMBIOS 表的可用性。
若sysfs访问失败,将尝试从sysfs读取DMI表,否则直接读取 memory。

由于需要从sysfs或 memory 读取数据,因此要求root权限

自Zabbix 2.0起支持该功能。
system.hw.cpu[<cpu>,<info>]
CPU information. string 或 integer cpu - <CPU编号>all (默认值)
info - 可选值:
full (默认值), curfreq, maxfreq, modelvendor
示例:
=> system.hw.cpu[0,vendor] → AuthenticAMD

从 /proc/cpuinfo 和 /sys/devices/system/cpu/[cpunum]/cpufreq/cpuinfo_max_freq 收集信息。

若指定CPU编号及curfreqmaxfreq参数,则返回数值型频率值(Hz)。

自Zabbix 2.0起支持。
system.hw.devices[<type>]
Listing of PCI or USB devices. 文本 类型 (自 version 2.0 起) - pci (默认) 或 usb 示例:
=> system.hw.devices[pci] → 00:00.0 主机 桥接器: Advanced Micro Devices [AMD] RS780 主机 桥接
[..]

返回 lspci 或 lsusb 工具的输出(执行时不带任何参数)。
system.hw.macaddr[<interface>,<format>]
Listing of MAC addresses. string interface - all(默认)或正则概述
format - full(默认)或short
列出名称匹配给定interface正则概述的接口MAC地址(all表示列出所有接口)。

示例:
=> system.hw.macaddr["eth0$",full] → [eth0] 00:11:22:33:44:55

format指定为short,则不会列出接口名称及重复的MAC地址。

自Zabbix 2.0起支持。
system.localtime[<type>]
System time. integer - 使用 type 作为 utc

string - 使用 type 作为 local
type (自 version 2.0 起) - 可选值:
utc - (默认) 自纪元时间(1970年1月1日 00:00:00 UTC)起的秒数
local - 以 'yyyy-mm-dd,hh:mm:ss.nnn,+hh:mm' 格式表示的时间
必须仅作为 被动检查 使用。

示例:
=> system.localtime[local] → create 一个 监控项 并使用此键值在 Clock dashboard widget 中显示 主机 时间。
system.run[command,<mode>]
Run specified command on the host. 命令的文本结果

1 - 当modenowait时(无论命令结果如何)
command - 待执行的命令
mode - 可选值:
wait - 等待执行结束(默认值),
nowait - 不等待
监控项的返回值包含命令产生的标准输出和标准错误。退出码检查不会被执行。
另见: Command execution

为正确处理返回值,命令结果必须是text数据类型。空结果同样允许。

返回值限制为16MB(包括会被截断的尾部空格);文本数据限制同样适用。

注意 system.run 监控项 默认被禁用。了解如何enable them

示例:
=> system.run[ls -l /] → 根目录的详细file列表。
system.stat[resource,<type>]
System statistics. integer 或 float ent - 该分区有权获得的处理器单元数量 (float)
kthr,<类型> - 内核线程状态信息:
r - 可运行内核线程的平均数量 (float)
b - 被置于虚拟内存管理器等待队列中的内核线程平均数量 (float)
memory,<类型> - 虚拟和实际memory的使用情况:
avm - 活跃虚拟页数 (integer)
fre - 空闲列表大小 (integer)
page,<类型> - 页面错误和分页活动信息:
fi - 每秒file页面调入数 (float)
fo - 每秒file页面调出数 (float)
pi - 从分页空间调入的页数 (float)
po - 调出到分页空间的页数 (float)
fr - 释放的页数(页面替换) (float)
sr - 页面替换算法扫描的页数 (float)
faults,<类型> - 陷阱和中断率:
in - 设备中断数 (float)
sy - 系统调用数 (float)
cs - 内核线程上下文切换数 (float)
cpu,<类型> - 处理器时间使用百分比细分:
us - 用户态时间 (float)
sy - 系统态时间 (float)
id - 空闲时间 (float)
wa - 系统存在未完成磁盘/NFS I/O请求时的空闲时间 (float)
pc - 消耗的物理处理器数量 (float)
ec - 消耗的授权容量百分比 (float)
lbusy - 表示在用户和系统级别执行时逻辑处理器的利用率百分比 (float)
app - 表示共享池中可用的物理处理器数量 (float)
disk,<类型> - 磁盘统计信息:
bps - 表示每秒传输到驱动器的数据量(读取或写入),单位为字节 (integer)
tps - 表示每秒向物理磁盘/磁带发出的传输次数 (float)
该监控项仅supported于AIX系统。
请注意这些监控项中的以下限制:
=> system.stat[cpu,app] - 仅支持类型为"Shared"的AIX LPAR
=> system.stat[cpu,ec] - 支持类型为"Shared"和"Dedicated"的AIX LPAR("Dedicated"始终返回100(百分比))
=> system.stat[cpu,lbusy] - 仅支持类型为"Shared"的AIX LPAR
=> system.stat[cpu,pc] - 支持类型为"Shared"和"Dedicated"的AIX LPAR
=> system.stat[ent] - 支持类型为"Shared"和"Dedicated"的AIX LPAR
system.sw.arch
Software architecture information. string 示例:
=> system.sw.arch → i686

该信息来自uname()函数。

自Zabbix 2.0起支持。
system.sw.os[<info>]
Operating system information. string info - 可能取值:
full (默认值), shortname
示例:
=> system.sw.os[short] → Ubuntu 2.6.35-28.50-generic 2.6.35.11

信息获取来源(注意并非所有文件和选项在所有发行版中都存在):
/proc/version (full)
/proc/version_signature (short)
PRETTY_NAME 参数来自支持该功能的系统的 /etc/os-release 文件,或 /etc/问题.net (name)

自 Zabbix 2.0 版本起支持。
system.sw.packages[<regexp>,<manager>,<format>]
Listing of installed packages. 文本 regexp - all(默认)或正则表达式概述
manager - all(默认)或包管理器
format - full(默认)或short
列出(按字母顺序)名称匹配给定package正则表达式概述的已安装软件包(all表示列出全部)。

示例:
=> system.sw.packages[mini,dpkg,short] → python-minimal, python2.6-minimal, ubuntu-minimal

支持的包管理器(执行命令):
dpkg (dpkg --get-selections)
pkgtool (ls /var/log/packages)
rpm (rpm -qa)
pacman (pacman -Q)

format指定为full,软件包按包管理器分组(每个管理器单独一行,以方括号中的名称开头)。
format指定为short,软件包不分组且单行列出。

Zabbix 2.0起支持。
system.swap.in[<device>,<type>]
Swap in (from device into memory) statistics. integer device - 用于交换的设备(默认为all
type - 可选值:
count(交换入次数)、sectors(交换入的扇区数)、pages(交换入的页数)。
详见该参数的platform-specific说明。
示例:
=> system.swap.in[,pages]

数据来源:
/proc/swaps, /proc/partitions, /proc/stat (Linux 2.4)
/proc/swaps, /proc/diskstats, /proc/vmstat (Linux 2.6)
system.swap.out[<device>,<type>]
Swap out (from memory onto device) statistics. integer device - 用于交换的设备(默认为all
type - 可选值:
count(交换出次数)、sectors(交换出的扇区数)、pages(交换出的页数)。
详见该参数的platform-specific详细信息。
示例:
=> system.swap.out[,pages]

该信息的来源为:
/proc/swaps, /proc/partitions, /proc/stat (Linux 2.4)
/proc/swaps, /proc/diskstats, /proc/vmstat (Linux 2.6)
system.swap.size[<device>,<type>]
Swap space size in bytes or in percentage from total. integer - 用于字节

float - 用于百分比
device - 交换空间使用的设备(默认为all
type - 可选值:
free(空闲交换空间,默认值)、pfree(空闲交换空间百分比)、pused(已用交换空间百分比)、total(总交换空间)、used(已用交换空间)
注意:在Windows系统中,若交换空间大小为0,则不支持pfreepused参数。
详见platform-specific获取该参数的详细信息。
示例:
=> system.swap.size[,pfree] → 空闲交换空间百分比

若未指定device参数,Zabbix agent将仅统计交换设备(文件),物理memory将被忽略。例如,在Solaris系统中,swap -s命令包含部分物理memory和交换设备(与swap -l不同)。

注意:在虚拟化(VMware ESXi、VirtualBox)Windows平台上,此键可能报告错误的交换空间大小/百分比。此时可使用perf_counter[\700(_Total)\702]键获取正确的交换空间百分比。
system.uname
Identification of the system. string 返回值示例(Unix):
FreeBSD localhost 4.2-RELEASE FreeBSD 4.2-RELEASE #0: Mon Nov i386

返回值示例(Windows):
Windows ZABBIX-WIN 6.0.6001 Microsoft® Windows Server® 2008 Standard Service Pack 1 x86

在Unix系统中,自Zabbix 2.2.0版本起,该监控项的值通过uname()系统调用获取。在此之前是通过执行"uname -a"命令获取。该监控项的值可能与"uname -a"的输出有所不同,且不包含"uname -a"基于其他来源打印的附加信息。

在Windows系统中,自Zabbix 3.0版本起,该监控项的值从Win32_OperatingSystem和Win32_Processor WMI类中获取。在此之前是通过易变的Windows API和未公开的注册表键获取。操作系统名称(包括版本)可能会被翻译为用户显示语言。在某些Windows版本中,它包含商标符号和额外的空格。

请注意,在Windows系统中监控项返回的是操作系统架构,而在Unix系统中返回的是CPU架构。
system.uptime
System uptime in seconds. integer 配置中,使用suptime单位来get可读值。
system.users.num
Number of users logged in. integer who 命令在 agent 端用于获取该值。
虚拟文件系统数据
监控项 键
Description 返回值 参数 备注
vfs.dev.discovery
List of block devices and their type. Used for low-level discovery. JSON object 该 监控项 仅支持Linux平台。

自Zabbix 4.4.0版本起支持。
vfs.dev.read[<device>,<type>,<mode>]
Disk read statistics. integer - 在sectorsoperationsbytes中使用type

float - 在spsopsbps中使用type

注意: 如果使用update间隔为三小时或更长2,将始终返回'0'
device - 磁盘设备(默认为all 3
type - 可选值: sectorsoperationsbytesspsopsbps
注意'类型'参数的支持和默认值取决于平台。详见platform-specific
spsopsbps分别代表: 每秒扇区数、每秒操作数、每秒字节数。
mode - 可选值: avg1(一分钟平均值,默认)、avg5avg15
该参数仅在spsopsbps中使用type时支持。
您可以使用相对设备名称(例如sda)以及可选的/dev/前缀(例如/dev/sda)。

支持LVM逻辑卷。

不同操作系统'类型'参数的默认值:
AIX - operations
FreeBSD - bps
Linux - sps
OpenBSD - operations
Solaris - bytes

示例:
=> vfs.dev.read[,operations]

在支持的平台上,spsopsbps过去限制为8个设备(7个独立设备和1个all)。自Zabbix 2.0.1起,此限制已提升至1024个设备(1023个独立设备和1个all)。
vfs.dev.write[<device>,<type>,<mode>]
Disk write statistics. integer - 使用type计量单位:sectors(扇区)、operations(操作数)、bytes(字节)

float - 使用type计量单位:sps(每秒扇区数)、ops(每秒操作数)、bps(每秒字节数)

注意:若采用update时间间隔≥3小时2,将始终返回'0'
device - 磁盘设备(默认为all全部设备3
type - 可选值:sectorsoperationsbytesspsopsbps
注意'类型'参数的支持情况及默认值因平台而异,详见platform-specific说明。
spsopsbps分别表示:每秒扇区数、每秒操作数、每秒字节数。
mode - 可选值:avg1(一分钟平均值,默认)、avg5avg15
该参数仅在使用type计量单位sps/ops/bps时生效。
支持使用相对设备名(如sda)及可选的/dev/前缀(如/dev/sda)。

支持LVM逻辑卷。

不同操作系统'类型'参数的默认值:
AIX - operations
FreeBSD - bps
Linux - sps
OpenBSD - operations
Solaris - bytes

示例:
=> vfs.dev.write[,operations]

在支持的平台上,sps/ops/bps曾限制为8个设备(7个独立设备+1个all)。自Zabbix 2.0.1起限制提升至1024个(1023个独立设备+1个all)。
vfs.dir.count[dir,<regex_incl>,<regex_excl>,<types_incl>,<types_excl>,<max_depth>,<min_size>,<max_size>,<min_age>,<max_age>,<regex_excl_dir>]
Directory entry count. integer dir - 目录的绝对路径
regex_incl - 用于描述要包含的实体(file、目录、符号链接)名称模式的正则概述;若为空则包含所有(默认值)
regex_excl - 用于描述要排除的实体(file、目录、符号链接)名称模式的正则概述;若为空则不排除任何内容(默认值)
types_incl - 要统计的目录条目类型,可选值:
file - 常规file,dir - 子目录,sym - 符号链接,sock - 套接字,bdev - 块设备,cdev - 字符设备,fifo - FIFO,dev - 等同于"bdev,cdev",all - 所有类型(默认),即"file,dir,sym,sock,bdev,cdev,fifo"。多个类型需用逗号分隔并加引号。
types_excl - 不统计的目录条目类型(参见<types_incl>)。若某条目类型同时出现在<types_incl>和<types_excl>中,则该类型条目不会被统计。
max_depth - 遍历子目录的最大深度。-1(默认)表示无限制,0表示不进入子目录。
min_size - 要统计的file最小大小(字节)。更小的文件不会被统计。可使用内存后缀
max_size - 要统计的file最大大小(字节)。更大的文件不会被统计。可使用内存后缀
min_age - 要统计的目录条目的最小存在时间(秒)。更近期的条目不会被统计。可使用时间后缀
max_age - 要统计的目录条目的最大存在时间(秒)。存在时间超过此值的条目不会被统计(基于修改时间)。可使用时间后缀
regex_excl_dir - 用于描述要排除的目录名称模式的正则概述。该目录下的所有内容将被排除(与regex_excl不同)
不支持环境变量,例如%APP_HOME%$HOME%TEMP%

伪目录"."和".."从不被统计。

遍历目录时不会跟随符号链接。

在Windows上,目录符号链接会被跳过。

计算条目数量时,regex_inclregex_excl会同时应用于文件和目录,但在选择要遍历的子目录时会被忽略(如果regex_incl为“(?i)^.+\.zip$”且未设置max_depth,则会遍历所有子目录,但仅统计zip类型的文件)。

执行时间受configuration中agent的超时值限制。由于大型目录遍历可能耗时更长,此时不会返回数据且监控项将变为不支持状态。不会返回部分统计结果。

按大小过滤时,仅常规文件具有有意义的大小。在Linux和BSD系统下,目录也有非零大小(通常为几KB)。设备大小为零,例如/dev/sda1的大小不反映相应分区大小。因此,使用<min_size><max_size>时,建议将<types_incl>指定为"file",以避免意外情况。

示例:
⇒ vfs.dir.count[/dev] - 监控/dev下的设备数量(Linux)
⇒ vfs.dir.count["C:\Users\ADMINI~1\AppData\Local\Temp"] - 监控临时目录中的文件数量(Windows)

自Zabbix 4.0.0起支持。
vfs.dir.get[dir,<regex_incl>,<regex_excl>,<types_incl>,<types_excl>,<max_depth>,<min_size>,<max_size>,<min_age>,<max_age>,<regex_excl_dir>]
Directory entry list. JSON dir - absolute path to directory
regex_incl - regular 概述 describing the name pattern of the entity (file, directory, symbolic link) to include; include all if empty (default value)
regex_excl - regular 概述 describing the name pattern of the entity (file, directory, symbolic link) to exclude; don't exclude any if empty (default value)
types_incl - directory entry types to list, possible values:
file - regular file, dir - subdirectory, sym - symbolic link, sock - socket, bdev - block device, cdev - character device, fifo - FIFO, dev - synonymous with "bdev,cdev", all - all types (default), i.e. "file,dir,sym,sock,bdev,cdev,fifo". Multiple types must be separated with comma and quoted.
types_excl - directory entry types (see <types_incl>) to NOT list. If some entry type is in both <types_incl> and <types_excl>, directory entries of this type are NOT listed.
max_depth - maximum depth of subdirectories to traverse. -1 (default) - unlimited, 0 - no descending into subdirectories.
min_size - minimum size (in bytes) for file to be listed. Smaller files will not be listed. 内存后缀 can be used.
max_size - maximum size (in bytes) for file to be listed. Larger files will not be counted. 内存后缀 can be used.
min_age - minimum age (in seconds) of directory entry to be listed. More recent entries will not be listed. 时间后缀 can be used.
max_age - maximum age (in seconds) of directory entry to be listed. Entries so old and older will not be listed (modification time). 时间后缀 can be used.
regex_excl_dir - regular 概述 describing the name pattern of the directory to exclude. All content of the directory will be excluded (in contrast to regex_excl)
Environment variables, e.g. %APP_HOME%, $HOME and %TEMP% are not supported.

Pseudo-directories "." and ".." are never listed.

Symbolic links are never followed for directory traversal.

On Windows, directory symlinks are skipped.

Both regex_incl and regex_excl are being applied to files and directories when generating entry list, but are ignored when picking subdirectories to traverse (if regex_incl is “(?i)^.+\.zip$” and max_depth is not set, then all subdirectories will be traversed, but only files of type zip will be listed).

Execution time is limited by timeout value in agent configuration. Since large directory traversal may take longer than that, no data will be returned and the 监控项 will turn unsupported. Partial list will not be returned.

When filtering by size, only regular files have meaningful sizes. Under Linux and BSD, directories also have non-zero sizes (a few Kb typically). Devices have zero sizes, e.g. the size of /dev/sda1 does not reflect the respective partition size. Therefore, when using <min_size> and <max_size>, it is advisable to specify <types_incl> as "file", to avoid surprises.

Examples:
⇒ vfs.dir.get[/dev] - retrieves device list in /dev (Linux)
⇒ vfs.dir.get["C:\Users\ADMINI~1\AppData\Local\Temp"] - retrieves file list in temporary directory (Windows)

Supported since Zabbix 6.0.0.
vfs.dir.size[dir,<regex_incl>,<regex_excl>,<mode>,<max_depth>,<regex_excl_dir>]
Directory size (in bytes). integer dir - 目录的绝对路径
regex_incl - 用于描述要包含的实体(file、目录、符号链接)名称模式的正则概述;若为空则包含所有(默认值)
regex_excl - 用于描述要排除的实体(file、目录、符号链接)名称模式的正则概述;若为空则不排除任何内容(默认值)
mode - 可选值:
apparent(默认)- 获取file的表观大小而非磁盘使用量(相当于du -sb dir),disk - 获取磁盘使用量(相当于du -s -B1 dir)。与du命令不同,vfs.dir.size 监控项在计算目录大小时会考虑隐藏文件(在目录内相当于du -sb .[^.]* *)。
max_depth - 遍历子目录的最大深度。-1(默认)- 无限制,0 - 不进入子目录。
regex_excl_dir - 用于描述要排除的目录名称模式的正则概述。该目录的所有内容将被排除(与regex_excl不同)
仅计算zabbix用户至少具有读取权限的目录。

在Windows上会跳过所有符号链接,且硬链接仅计算一次。

对于大型目录或低速驱动器,此监控项可能因agentserver/proxy配置文件中的超时设置而超时。请根据需要增加超时值。

示例:
⇒ vfs.dir.size[/tmp,log] - 计算/tmp中包含'日志'的所有文件大小
⇒ vfs.dir.size[/tmp,log,^.+\.old$] - 计算/tmp中名称包含'日志'的所有文件大小,排除名称以'.old'结尾的文件

file的大小限制取决于large file support

自Zabbix 3.4.0起支持。
vfs.file.cksum[file,<mode>]
File checksum, calculated by the UNIX cksum algorithm. integer - 使用 mode 作为 crc32

string - 使用 mode 作为 md5, sha256
file - file的完整路径
mode - crc32 (默认), md5, sha256
示例:
=> vfs.file.cksum[/etc/passwd]

返回值示例 (分别对应crc32/md5/sha256):
675436101
9845acf68b73991eb7fd7ee0ded23c44
ae67546e4aac995e5c921042d0cf0f1f7147703aa42bfbfb65404b30f238f2dc

file的大小限制取决于large file support.

Zabbix 6.0起支持mode参数.
vfs.file.contents[file,<encoding>]
Retrieving contents of a file. 文本 file - file的完整路径
encoding - 代码页 编码设置
如果file为空或仅包含LF/CR字符,则返回空的string。

返回值限制为16MB(包括被截断的尾部空白字符);文本数据限制同样适用。

字节顺序标记(BOM)不会出现在输出中。

示例:
=> vfs.file.contents[/etc/passwd]
vfs.file.exists[file,<types_incl>,<types_excl>]
Checks if file exists. 0 - not found

1 - file of the specified type exists
file - full path to file
types_incl - list of file types to include, possible values: file (regular file, default (if types_excl is not set)), dir (directory), sym (symbolic link), sock (socket), bdev (block device), cdev (character device), fifo (FIFO), dev (synonymous with "bdev,cdev"), all (all mentioned types, default if types_excl is set).
types_excl - list of file types to exclude, see types_incl for possible values (by default no types are excluded)
Multiple types must be separated with a comma and the entire set enclosed in quotes "".
On Windows the double quotes have to be backslash '\' escaped and the whole 监控项 key enclosed in double quotes when using the command line utility for calling zabbix_get.exe or agent2.

If the same type is in both <types_incl> and <types_excl>, files of this type are excluded.

Examples:
=> vfs.file.exists[/tmp/application.pid]
=> vfs.file.exists[/tmp/application.pid,"file,dir,sym"]
=> vfs.file.exists[/tmp/application_dir,dir]

The file size limit depends on large file support.

Note that the 监控项 may turn unsupported on Windows if a directory is searched within a non-existing directory, e.g. vfs.file.exists[C:\no\dir,dir] (where 'no' does not exist).
vfs.file.get[file]
Return information about a file. JSON object file - file的完整路径 UNIX-like系统支持的file类型: 常规file, 目录, 符号链接, 套接字, 块设备, 字符设备, FIFO

Windows支持的file类型: 常规file, 目录, 符号链接

示例:
=> vfs.file.get[/etc/passwd] → 返回包含/etc/passwd file信息的JSON(类型, 用户, 权限, SID, uid等)

file大小限制取决于large file support.

自Zabbix 6.0起支持
vfs.file.md5sum[file]
MD5 checksum of file. 字符 string (MD5哈希值来自 file) file - file的完整路径 示例:
=> vfs.file.md5sum[/usr/local/etc/zabbix_agentd.conf]

返回值示例:
b5052decb577e0fffd622d6ddc017e82

file的大小限制取决于 large file support.
vfs.file.owner[file,<ownertype>,<resulttype>]
Retrieve owner of a file. 字符 string file - file的完整路径
ownertype - user (默认) 或 group (仅Unix)
resulttype - name (默认) 或 id; 对于id - 在Unix上返回uid/gid,在Windows上返回SID
示例:
=> vfs.file.owner[/tmp/zabbix_server.log] → 返回/tmp/zabbix_server.log的file所有者
=> vfs.file.owner[/tmp/zabbix_server.log,,id] → 返回/tmp/zabbix_server.log的file所有者ID

file的大小限制取决于large file support.

自Zabbix 6.0起支持。
vfs.file.permissions[file]
Return a 4-digit string containing the octal number with Unix permissions. string file - file的完整路径 Windows系统不支持此功能.

示例:
=> vfs.file.permissions[/etc/passwd] → 返回/etc/passwd的权限, 例如'0644'

file的大小限制取决于large file support.

自Zabbix 6.0版本起支持该功能.
vfs.file.regexp[file,regexp,<encoding>,<start line>,<end line>,<output>]
Find string in a file. 包含匹配的string的行,或由可选的output参数指定 file - file的完整路径
regexp - 描述所需模式的正则概述
encoding - 代码页编码设置
start line - 要搜索的首行编号(默认为file的第一行)
end line - 要搜索的末行编号(默认为file的最后一行)
output - 可选的输出格式化模板。转义序列\0会被替换为匹配的文本部分(从匹配开始的首字符到匹配结束的末字符),而\N(其中N=1...9)会被替换为第N个匹配组(如果N超过捕获组数量则返回空string)
仅返回第一个匹配行。
如果没有行匹配表达式则返回空string。

字节顺序标记(BOM)会被排除在输出之外。

使用output参数的内容提取发生在agent上。

start lineend lineoutput参数从version 2.2版本开始支持。

示例:
=> vfs.file.regexp[/etc/passwd,zabbix]
=> vfs.file.regexp[/path/to/some/file,"([0-9]+)$",,3,5,\1]
=> vfs.file.regexp[/etc/passwd,"^zabbix:.:([0-9]+)",,,,\1] → 获取用户zabbix的ID

file的大小限制取决于large file support
vfs.file.regmatch[file,regexp,<encoding>,<start line>,<end line>]
Find string in a file. 0 - 未找到匹配项

1 - 找到匹配项
file - file的完整路径
regexp - 描述所需模式的正则概述
encoding - 代码页编码设置
start line - 搜索起始行号(默认为file的首行)
end line - 搜索结束行号(默认为file的末行)
字节顺序标记(BOM)将被忽略

从version 2.2版本开始支持start lineend line参数

示例:
=> vfs.file.regmatch[/var/log/app.log,error]

file的大小限制取决于large file support
vfs.file.size[file,<mode>]
File size (in bytes). integer file - file的完整路径
mode - 可选值:
bytes (默认) 或 lines (空行也会被计数)
file必须对用户zabbix具有读取权限.

示例:
=> vfs.file.size[/var/log/syslog]

file的大小限制取决于large file support.

参数mode从Zabbix 6.0开始支持.
vfs.file.time[file,<mode>]
File time information. integer (Unix时间戳) file - file的完整路径
mode - 可选值:
modify (默认) - 最后修改file内容的时间,
access - 最后读取file的时间,
change - 最后更改file属性的时间
示例:
=> vfs.file.time[/etc/passwd,modify]

file的大小限制取决于large file support.
vfs.fs.discovery
List of mounted filesystems and their types. Used for low-level discovery. JSON object 自Zabbix 2.0起支持。

{#FSDRIVETYPE}宏自Zabbix 3.0起在Windows系统中支持。

{#FSLABEL}宏自Zabbix 6.0起在Windows系统中支持。
vfs.fs.get
List of mounted filesystems, their types, disk space and inode statistics. Can be used for low-level discovery. JSON object {#FSLABEL}宏自Zabbix 6.0起在Windows系统中得到支持。

自Zabbix 6.0.11版本起,该监控项能够报告file系统中inode计数为零的情况,这种情况可能出现在采用动态inode的file系统(例如btrfs)中。
vfs.fs.inode[fs,<mode>]
Number or percentage of inodes. integer - 用于数值

float - 用于百分比
fs - 文件系统
mode - 可选值:
total (默认), free, used, pfree (空闲百分比), pused (已用百分比)
自Zabbix 6.0.11起,当inode计数为零时(如采用动态inode的file系统btrfs),该监控项在pfree/pused模式下将不再显示为不支持状态。对于此类file系统,pfree/pused值将分别报告为"100"和"0"。

示例:
=> vfs.fs.inode[/,pfree]
vfs.fs.size[fs,<mode>]
Disk space in bytes or in percentage from total. integer - 用于字节

float - 用于百分比
fs - 文件系统
mode - 可能取值:
total (默认), free, used, pfree (空闲百分比), pused (已用百分比)
若文件系统未挂载,则返回挂载点所在本地文件系统的大小。

示例:
=> vfs.fs.size[/tmp,free]

file 系统的保留空间会被计入,但在使用 free 模式时不包括在内。
虚拟内存数据
监控项 键
Description 返回值 参数 备注
vm.memory.size[<mode>]
Memory size in bytes or in percentage from total. integer - 用于字节

float - 用于百分比
mode - 可选值:
total (默认值), active, anon, buffers, cached, exec, file, free, inactive, pinned, shared, slab, wired, used, pused (已使用, 百分比), available, pavailable (可用, 百分比)
另请参阅 platform-specific 支持和 additional details 关于此参数。
该 监控项 接受三类参数:

1) total - memory 总量;
2) 平台特定的 memory 类型: active, anon, buffers, cached, exec, file, free, inactive, pinned, shared, slab, wired;
3) 用户级估算的 memory 使用和可用量: used, pused, available, pavailable.
Web 监控数据
监控项 键
Description 返回值 参数 注释
web.page.get[host,<path>,<port>]
Get content of web page. 网页源代码文本(包含头部信息) 主机 - 主机名或URL(格式为scheme://host:port/path,其中仅主机为必填项)。
允许的URL方案:httphttps4。未指定协议时默认为http。若指定URL,则pathport必须为空。在连接需要认证的服务器时指定用户名/密码(例如:http://user:[email protected])仅在使用cURL支持时可用4
主机名支持Punycode
path - HTML文档路径(默认为/)
port - 端口号(HTTP默认为80)
host中指定的资源不存在或不可用时,此监控项将转为不支持状态。

host可以是主机名、域名、IPv4或IPv6地址。但对于IPv6地址,Zabbix agent必须启用IPv6支持编译。

示例:
=> web.page.get[www.example.com,index.php,80]
=> web.page.get[https://www.example.com]
=> web.page.get[https://blog.example.com/?s=zabbix]
=> web.page.get[localhost:80]
=> web.page.get["[::1]/server-status"]
web.page.perf[host,<path>,<port>]
Loading time of full web page (in seconds). float 主机 - 主机名或URL(格式为scheme://host:port/path,其中仅主机为必填项)。
允许的URL方案:httphttps4。未指定协议时默认为http。若指定URL,则pathport必须为空。在连接需要认证的服务器时指定用户名/密码(例如:http://user:[email protected])仅在使用cURL支持时可用4
主机名支持Punycode
path - HTML文档路径(默认为/)
port - 端口号(HTTP默认为80)
host中指定的资源不存在或不可用时,此监控项将转为不支持状态。

host可以是主机名、域名、IPv4或IPv6地址。但对于IPv6地址,Zabbix agent必须启用IPv6支持编译。

示例:
=> web.page.perf[www.example.com,index.php,80]
=> web.page.perf[https://www.example.com]
web.page.regexp[host,<path>,<port>,regexp,<length>,<output>]
Find string on a web page. 匹配的string,或按可选参数output指定返回 主机 - 主机名或URL(格式为scheme://host:port/path,其中仅主机为必填项)。
允许的URL方案:httphttps4。未指定协议时默认为http。若指定URL,则pathport必须为空。在连接需要认证的服务器时指定用户名/密码(例如:http://user:[email protected])仅在使用cURL支持时可用4
主机名支持Punycode
path - HTML文档路径(默认为/)
port - 端口号(HTTP默认为80)
regexp - 描述匹配模式的正则概述
length - 返回的最大字符数
output - 可选的输出格式化模板。转义序列\0会被替换为匹配的文本部分(从匹配开始的首字符到匹配结束的末字符),而\N(N=1...9)会被替换为第N个捕获组(若N超过捕获组数量则返回空string)。
host中指定的资源不存在或不可用时,此监控项将转为不支持状态。

host可以是主机名、域名、IPv4或IPv6地址。但对于IPv6地址,Zabbix agent必须启用IPv6支持编译。

使用output参数的内容提取操作在agent端执行。

output参数自version 2.2版本起支持。

示例:
=> web.page.regexp[www.example.com,index.php,80,OK,2]
=> web.page.regexp[https://www.example.com,,,OK,2]
Zabbix 指标
监控项 键
Description 返回值 参数 注释
agent.hostmetadata
Agent host metadata. string 返回HostMetadata或HostMetadataItem参数的值,若未定义则返回空string

自Zabbix 6.0起支持
agent.hostname
Agent host name. string 返回:
被动检查时 - agent配置file中Hostname参数列出的首个主机名称;
主动检查时 - 当前主机名
agent.ping
Agent availability check. 无 - 不可用

1 - 可用
使用nodata()触发器函数检查主机不可用状态
agent.variant
Variant of Zabbix agent (Zabbix agent or Zabbix agent 2). integer 返回值示例:
1 - Zabbix agent
2 - Zabbix agent 2
agent.version
Version of Zabbix agent. string 返回值示例:
6.0.3
zabbix.stats[<ip>,<port>]
Return a set of Zabbix server or proxy internal metrics remotely. JSON object ip - 要远程查询的服务器/proxies的IP/DNS/网络掩码列表(默认为127.0.0.1)
port - 要远程查询的server/proxy端口(默认为10051)
注意:统计请求仅会接受目标实例上'StatsAllowedIP'server/proxy参数中列出的地址

此监控项返回一组选定的内部指标。详情参见暴露的指标
zabbix.stats[<ip>,<port>,queue,<from>,<to>]
Return number of monitored items in the queue which are delayed on Zabbix server or proxy remotely. JSON object ip - 要远程查询的服务器/proxies的IP/DNS/网络掩码列表(默认为127.0.0.1)
port - 要远程查询的server/proxy端口(默认为10051)
queue - 常量(按原样使用)
from - 至少延迟(默认为6秒)
to - 最多延迟(默认为无限)
注意:统计请求仅会接受目标实例上'StatsAllowedIP'server/proxy参数中列出的地址
脚注

1 Linux系统特定说明。Zabbix agent必须对/proc文件系统具有只读访问权限。来自www.grsecurity.org的内核补丁会限制非特权用户的访问权限。

2 vfs.dev.read[]vfs.dev.write[]:如果监控项值超过3小时未被访问,Zabbix agent将终止"陈旧"的设备连接。这种情况可能发生在系统具有动态变化路径的设备,或设备被手动移除时。还需注意,如果这些监控项使用update间隔为3小时或更长,将始终返回'0'。

3 vfs.dev.read[]vfs.dev.write[]:如果第一个参数使用默认值all,则该键将返回汇总统计信息,包括所有块设备如sda、sdb及其分区(sda1、sda2、sdb3...)以及基于这些块设备/分区的多设备(MD raid)和逻辑卷(LVM)。在这种情况下,返回值应仅被视为相对值(随时间动态变化)而非绝对值。

4 仅当agent编译时支持cURL时,才支持SSL(HTTPS)。否则监控项将变为不支持状态。

编码设置

为确保获取的数据未被损坏,您可以指定 处理检查的正确编码(例如'vfs.file.contents') 在encoding参数中。支持的编码列表(代码页 标识符)可在文档中找到 libiconv (GNU项目) 或位于 Microsoft Windows SDK文档中的"代码页标识符"部分

如果未在encoding参数中指定编码,则以下 应用的解决策略包括:

  • 如果未指定编码(或为空string),则默认采用UTF-8编码,数据将按"原样"处理;
  • BOM分析 - 适用于监控项 'vfs.file.contents' 'vfs.file.regexp', 'vfs.file.regmatch'. 系统会尝试 通过使用字节顺序标记(BOM)确定正确的编码 file的开头。如果BOM不存在 - 标准 分辨率(见上文)将被替代应用。

故障排查 agent 监控项

  • 如果与被动agent一起使用,服务器配置中的Timeout值可能需要大于agent配置file中的Timeout。否则监控项可能无法get任何值,因为服务器对agent的请求首先超时。