本节详细说明使用Zabbix agent进行数据采集的监控项键值。
存在passive and active agent检查项。 配置监控项时,可选择以下类型:
请注意,Windows版Zabbix agent支持的所有监控项键值同样适用于新一代Zabbix agent 2。 参阅仅适用于additional item keys agent 2的兼容性列表。
以下列出了可与Zabbix agent一起使用的监控项键值.
监控项键值列表不包含参数和附加信息. 点击监控项键值可查看完整详情.
| 监控项键值 | 描述 | 监控项分组 |
|---|---|---|
| kernel.maxfiles | 操作系统支持的最大打开文件数. | 内核 |
| kernel.maxproc | 操作系统支持的最大进程数. | |
| kernel.openfiles | 当前打开的file描述符数量. | |
| log | 日志file的监控. | Log monitoring |
| log.count | 监控日志file中匹配行的计数. | |
| logrt | 轮转日志file的监控. | |
| logrt.count | 轮转日志file中匹配行的计数. | |
| modbus.get | 读取Modbus数据. | Modbus |
| net.dns | 检查DNS服务状态. | 网络 |
| net.dns.perf | 检查DNS服务性能. | |
| net.dns.record | 执行DNSquery. | |
| net.if.collisions | 窗口外冲突次数. | |
| net.if.discovery | 网络接口列表. | |
| net.if.in | 网络接口的入站流量统计. | |
| net.if.out | 网络接口的出站流量统计. | |
| net.if.total | 网络接口的出入站流量统计总和. | |
| net.tcp.listen | 检查TCP端口是否处于LISTEN状态. | |
| net.tcp.port | 检查是否可建立到指定端口的TCP连接. | |
| net.tcp.service | 检查服务是否运行并接受TCP连接. | |
| net.tcp.service.perf | 检查TCP服务性能. | |
| net.tcp.socket.count | 返回匹配参数的TCP套接字数量. | |
| net.udp.listen | 检查UDP端口是否处于LISTEN状态. | |
| net.udp.service | 检查服务是否运行并响应UDP请求. | |
| net.udp.service.perf | 检查UDP服务性能. | |
| net.udp.socket.count | 返回匹配参数的UDP套接字数量. | |
| proc.cpu.util | 进程CPU使用率百分比. | 进程 |
| proc.get | 操作系统进程及其参数列表. | |
| proc.mem | 进程使用的memory字节数. | |
| proc.num | 进程数量. | |
| sensor | 硬件传感器读数. | 传感器 |
| system.boottime | 系统启动时间. | 系统 |
| system.cpu.discovery | 检测到的CPU/CPU核心列表. | |
| system.cpu.intr | 设备中断. | |
| system.cpu.load | CPU负载. | |
| system.cpu.num | CPU数量. | |
| system.cpu.switches | 上下文切换计数. | |
| system.cpu.util | CPU利用率百分比. | |
| system.hostname | 系统主机名. | |
| system.hw.chassis | 机箱信息. | |
| system.hw.cpu | CPU信息. | |
| system.hw.devices | PCI或USB设备列表. | |
| system.hw.macaddr | MAC地址列表. | |
| system.localtime | 系统时间. | |
| system.run | 在主机上执行指定命令. | |
| system.stat | 系统统计信息. | |
| system.sw.arch | 软件架构信息. | |
| system.sw.os | 操作系统信息. | |
| system.sw.os.get | 操作系统详细信息(version,类型,发行版名称,主次version等). | |
| system.sw.packages | 已安装软件包列表. | |
| system.sw.packages.get | 已安装软件包详细列表. | |
| system.swap.in | 换入(从设备到memory)统计. | |
| system.swap.out | 换出(从memory到设备)统计. | |
| system.swap.size | 交换空间大小(字节或占总量的百分比). | |
| system.uname | 系统标识. | |
| system.uptime | 系统运行时间(秒). | |
| system.users.num | 登录用户数. | |
| vfs.dev.discovery | 块设备及其类型列表. | 虚拟file系统 |
| vfs.dev.read | 磁盘读取统计. | |
| vfs.dev.write | 磁盘写入统计. | |
| vfs.dir.count | 目录条目计数. | |
| vfs.dir.get | 目录条目列表. | |
| vfs.dir.size | 目录大小. | |
| vfs.file.cksum | file校验和(通过UNIX cksum算法计算). | |
| vfs.file.contents | 获取file内容. | |
| vfs.file.exists | 检查file是否存在. | |
| vfs.file.get | 返回file信息. | |
| vfs.file.md5sum | file的MD5校验和. | |
| vfs.file.owner | 获取file所有者. | |
| vfs.file.permissions | 返回包含UNIX权限的4位string八进制数. | |
| vfs.file.regexp | 检索file中的string. | |
| vfs.file.regmatch | 在file中查找string. | |
| vfs.file.size | file大小. | |
| vfs.file.time | file时间信息. | |
| vfs.fs.discovery | 已挂载文件系统列表(包含类型和挂载选项). | |
| vfs.fs.get | 已挂载文件系统详细列表(包含类型,可用空间,inode统计和挂载选项). | |
| vfs.fs.inode | inode数量或百分比. | |
| vfs.fs.size | 磁盘空间(字节或占总量的百分比). | |
| vm.memory.size | memory大小(字节或占总量的百分比). | 虚拟memory |
| web.page.get | 获取网页内容. | 网页监控 |
| web.page.perf | 完整网页加载时间. | |
| web.page.regexp | 在网页上查找string. | |
| agent.hostmetadata | agent主机元数据. | Zabbix |
| agent.hostname | agent主机名. | |
| agent.ping | agent可用性检查. | |
| agent.variant | Zabbix agent变体(Zabbix agent或Zabbix agent 2). | |
| agent.version | Zabbix agent的version. | |
| zabbix.stats | 远程返回一组Zabbix server或proxy内部指标. | |
| zabbix.stats | 远程返回Zabbix server或proxy上延迟的监控监控项队列数量. |
除在监控项详情中另有说明外,agent 监控项(及所有参数)支持以下平台:
许多agent 监控项同样支持Windows平台。 详情请参阅共享监控项页面。
不带尖括号的参数为必填项。 标记有尖括号 < > 的参数为可选项。
操作系统支持的最大打开文件数。
返回值:integer。
支持的平台:Linux、FreeBSD、MacOS X、OpenBSD、NetBSD。
操作系统支持的最大进程数。
返回值:integer。
支持的平台:Linux 2.6 及以上版本,FreeBSD、Solaris、MacOS X、OpenBSD、NetBSD。
当前打开的 file 描述符数量。
返回值:integer。
支持的平台:Linux(监控项 在其他类 UNIX 平台可能有效)。
监控日志file.
返回值: Log.
参见支持的平台.
参数:
注释:
output留空 - 则返回包含匹配文本的整行. 注意除'Result is TRUE'外的所有全局正则表达式类型总是返回整行,此时会忽略output参数.output参数的内容提取操作在agent端执行.示例:
使用output参数从日志记录中提取数字的示例:
log[/app1/app.log,"task run [0-9.]+ sec, processed ([0-9]+) records, [0-9]+ errors",,,,\1] #this item will match a log record "2015-11-13 10:08:26 task run 6.08 sec, processed 6080 records, 0 errors" and send only '6080' to server. Because a numeric value is being sent, the "Type of information" for this item can be set to "Numeric (unsigned)" and the value can be used in graphs, triggers etc.使用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"] #this item will match a log record "2015-11-13 10:08:26 task run 6.08 sec, processed 6080 records, 0 errors" and send a modified record "2015-11-13 10:08:26 RECORDS: 6080, ERRORS: 0, DURATION: 6.08" to the server.
被监控日志file中匹配行的计数.
返回值: integer.
参见支持平台.
参数:
注释:
轮转日志file的监控.
返回值: Log.
参见支持的平台.
参数:
注释:
output留空 - 则返回包含匹配文本的整行内容 请注意,除'结果为真'之外的所有全局正则表达式类型始终返回整行匹配内容,且output参数将被忽略。output参数的内容提取发生在agent上。file regexp参数中,日志目录路径和日志file正则表达式必须使用正确的目录分隔符进行分隔:
Windows示例:
logrt["c:/dir1/dir2/dir3\filename.*\.log","pattern_to_match"] #this item will collect data from log files in "c:/dir1/dir2/dir3" where the file name starts with "filename" and ends with any extension matching ".log".
logrt["//example.com/share/dir1/dir2/dir3\filename.*\.log","pattern_to_match"] #this item will collect data from log files in the network share "//example.com/share/dir1/dir2/dir3" where the file name starts with "filename" and ends with any extension matching ".log".其他系统示例:
logrt["/home/zabbix/logs/^logfile[0-9]{1,3}$",,,100] #this item will match a file like "logfile1" (will not match ".logfile1").
logrt["/home/user/^logfile_.*_[0-9]{1,3}$","pattern_to_match","UTF-8",100] #this item will collect data from files such as "logfile_abc_1" or "logfile__001".使用output参数从日志记录中提取数字的示例:
logrt[/app1/^test.*log$,"task run [0-9.]+ sec, processed ([0-9]+) records, [0-9]+ errors",,,,\1] #this item will match a log record "2015-11-13 10:08:26 task run 6.08 sec, processed 6080 records, 0 errors" and send only '6080' to server. Because a numeric value is being sent, the "Type of information" for this item can be set to "Numeric (unsigned)" and the value can be used in graphs, triggers etc.使用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"] #this item will match a log record "2015-11-13 10:08:26 task run 6.08 sec, processed 6080 records, 0 errors" and send a modified record "2015-11-13 10:08:26 RECORDS: 6080, ERRORS: 0, DURATION: 6.08" to server.
被轮转的监控日志file中匹配行的计数。
返回值:integer。
参见支持的平台。
参数:
注释:
监控项必须配置为主动检查;
匹配行数统计自上次agent检查日志以来的新行,因此取决于监控项的update间隔;
日志轮转基于文件的最后修改时间;
在file regexp参数中,日志目录路径和日志file正则表达式必须用正确的目录分隔符分隔:
Windows示例:
logrt.count["c:/dir1/dir2/dir3\filename.*\.log","pattern_to_match"] #this item will count the number of matches for the pattern "pattern_to_match" in log files located in "c:/dir1/dir2/dir3".
logrt.count["//example.com/share/dir1/dir2/dir3\filename.*\.log","pattern_to_match"] #this item will count the number of matches for the pattern "pattern_to_match" in log files on the network share "//example.com/share/dir1/dir2/dir3".其他系统示例:
logrt.count["/home/zabbix/logs/^logfile[0-9]{1,3}$",,,100] #this item will count the number of matches for the pattern "^logfile[0-9]{1,3}$" in log files in the "/home/zabbix/logs" directory.
logrt.count["/home/user/^logfile_.*_[0-9]{1,3}$","pattern_to_match","UTF-8",100] #this item will count the number of occurrences of the pattern "pattern_to_match" in log files located in "/home/user".
读取Modbus数据.
返回值: JSON object.
支持的平台: Linux.
参数:
protocol://connection_string的端点;查看参数的detailed description.
检查DNS服务状态.
返回值: 0 - DNS解析失败(DNS服务器未响应或返回错误); 1 - DNS解析成功.
查看支持平台.
参数:
注释:
type可能的值为: ANY, A, NS, CNAME, MB, MG, MR, PTR, MD, MF, MX, SOA, NULL, WKS (Windows系统下不支持Zabbix agent, 所有操作系统下不支持Zabbix agent 2), HINFO, MINFO, TXT, SRVtype设为PTR时), 可提供反转或非反转格式的DNS名称(参见下方示例). 注意当请求PTR记录时, DNS名称实际上是IP地址.示例:
net.dns[198.51.100.1,example.com,MX,2,1]
net.dns[,198.51.100.1,PTR]
net.dns[,1.100.51.198.in-addr.arpa,PTR]
net.dns[,2a00:1450:400f:800::200e,PTR]
net.dns[,e.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.0.f.0.0.4.0.5.4.1.0.0.a.2.ip6.arpa,PTR]
检查DNS服务的性能。
返回值:float(0 - 服务不可用;秒数 - 等待服务响应的秒数)。
参见支持的平台。
参数:
注释:
type的可能值为:type设置为PTR时),可以以反转或非反转格式提供DNS名称(参见下面的示例)。注意,当请求PTR记录时,DNS名称实际上是IP地址。NXDOMAIN或SERVFAIL)时,监控项返回响应时间而非0。示例:
net.dns.perf[198.51.100.1,example.com,MX,2,1]
net.dns.perf[,198.51.100.1,PTR]
net.dns.perf[,1.100.51.198.in-addr.arpa,PTR]
net.dns.perf[,2a00:1450:400f:800::200e,PTR]
net.dns.perf[,e.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.0.f.0.0.4.0.5.4.1.0.0.a.2.ip6.arpa,PTR]
执行DNSquery.
Zabbix agent 2还提供net.dns.get,该功能支持更多记录类型并提供更灵活的DNS监控选项. 返回值: 包含所需信息类型的字符string.
参见支持的平台.
参数:
注释:
type可能的取值包括:type设为PTR时),DNS名称可采用反向或非反向格式(参见下方示例). 注意当请求PTR记录时,DNS名称实际上是IP地址.示例:
net.dns.record[198.51.100.1,example.com,MX,2,1]
net.dns.record[,198.51.100.1,PTR]
net.dns.record[,1.100.51.198.in-addr.arpa,PTR]
net.dns.record[,2a00:1450:400f:800::200e,PTR]
net.dns.record[,e.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.0.f.0.0.4.0.5.4.1.0.0.a.2.ip6.arpa,PTR]
窗口外碰撞次数.
返回值: integer.
支持的平台: Linux, FreeBSD, Solaris, AIX, MacOS X, OpenBSD, NetBSD. NetBSD系统需要root权限.
参数:
网络接口列表. 用于低级发现.
返回值: JSON object.
支持的平台: Linux, FreeBSD, Solaris, HP-UX, AIX, OpenBSD, NetBSD.
网络接口的入站流量统计。
返回值:integer。
支持的平台: Linux, FreeBSD, Solaris5, HP-UX, AIX, MacOS X, OpenBSD, NetBSD。 NetBSD上需要root权限。
参数:
注释:
示例:
网络接口的出站流量统计。
返回值:integer。
支持的平台:Linux、FreeBSD、Solaris5、HP-UX、AIX、MacOS X、OpenBSD、NetBSD。 NetBSD上需要root权限。
参数:
注释:
示例:
网络接口的入站和出站流量统计总和。
返回值:integer。
支持的平台: Linux, FreeBSD, Solaris5, HP-UX, AIX, MacOS X, OpenBSD, NetBSD. NetBSD上需要root权限。
参数:
注释:
net.if.in和net.if.out在您的平台上对丢弃的数据包都有效时才受支持。示例:
net.tcp.listen[port]
检查该TCP端口是否处于LISTEN状态.
返回值: 0 - 未处于LISTEN状态; 1 - 处于LISTEN状态.
支持平台: Linux, FreeBSD, Solaris, MacOS X.
参数:
在Linux内核2.6.14及以上版本中,如果可能的话,监听TCP套接字的信息将从内核的NETLINK接口获取. 否则,信息将从/proc/net/tcp和/roc/net/tcp6文件中检索.
示例:
检查是否能够与指定端口建立TCP连接。
返回值:0 - 无法连接;1 - 可以连接。
参见支持的平台。
参数:
注释:
net.tcp.service.perf[tcp,<ip>,<port>];示例:
检查服务是否正在运行并接受TCP连接。
返回值:0 - 服务停止;1 - 服务运行中。
参见支持的平台。
参数:
注释:
net.tcp.port[]进行此类检查。示例:
net.tcp.service[ftp,,45] #this item can be used to test the availability of FTP server on TCP port 45
检查TCP服务的性能。
返回值:float(0 - 服务不可用;秒数 - 等待服务响应所花费的秒数)。
参见支持的平台。
参数:
注释:
net.tcp.service.perf[tcp,<ip>,<port>]进行此类检查。示例:
net.tcp.service.perf[ssh] #this item can be used to test the speed of initial response from the SSH server
返回匹配参数的TCP套接字数量。
返回值:integer。
支持平台: Linux.
参数:
示例:
net.tcp.socket.count[,80,,,established] #the number of connections to local TCP port 80 in the established statenet.udp.listen[port]
检查该UDP端口是否处于LISTEN状态.
返回值: 0 - 未处于LISTEN状态; 1 - 处于LISTEN状态.
支持平台: Linux, FreeBSD, Solaris, MacOS X.
参数:
示例:
检查服务是否正在运行并响应UDP请求.
返回值: 0 - 服务停止; 1 - 服务正在运行.
查看支持的平台.
参数:
示例:
net.udp.service[ntp,,45] #this item can be used to test the availability of NTP service on UDP port 45
检查UDP服务的性能.
返回值: float (0 - 服务不可用; seconds - 等待服务响应的秒数).
查看支持的平台.
参数:
示例:
返回符合参数的UDP套接字数量.
返回值: integer.
支持平台: Linux.
参数:
示例:
进程CPU使用率百分比。
返回值:float。
支持平台:Linux、Solaris6。
参数:
注释:
zone参数为current(或默认值)时,如果agent是在不支持区域的Solaris上编译的,但在支持区域的新版Solaris上运行,则agent将返回NOTSUPPORTED(agent无法将结果限制在当前区域)。 然而,在这种情况下支持all。示例:
proc.cpu.util[,root] #CPU utilization of all processes running under the "root" user
proc.cpu.util[zabbix_server,zabbix] #CPU utilization of all zabbix_server processes running under the zabbix user
操作系统进程及其参数的列表。 可用于低级发现。
返回值:JSON object。
支持的平台: Linux, FreeBSD, Windows, OpenBSD, NetBSD.
参数:
注释:
-1;name和cmdline参数选择进程的notes(特定于Linux)。示例:
proc.get[zabbix_server,zabbix,,process] #list of all zabbix_server processes running under the zabbix user, returns one entry per PID
proc.get[java,,,thread] #list of all Java processes, returns one entry per thread
proc.get[,zabbix,,summary] #combined data for processes of each type running under the zabbix user, returns one entry per process name
进程使用的memory(以字节为单位)
返回值:integer - 使用mode作为max、min、sum;float - 使用mode作为avg
支持平台: Linux、FreeBSD、Solaris、AIX、OpenBSD、NetBSD
参数:
注释:
memtype参数仅在Linux、FreeBSD、Solaris6、AIX上支持name和cmdline参数选择进程(Linux特有)zabbix_agentd -t proc.mem[,,,apache2]),会多统计一个进程,因为agent会统计自身示例:
proc.mem[,root] #the memory used by all processes running under the "root" user
proc.mem[zabbix_server,zabbix] #the memory used by all zabbix_server processes running under the zabbix user
proc.mem[,oracle,max,oracleZABBIX] #the memory used by the most memory-hungry process running under Oracle having oracleZABBIX in its command line
进程数量.
返回值: integer.
支持平台: Linux, FreeBSD, Solaris6, HP-UX, AIX, OpenBSD, NetBSD.
参数:
注释:
zabbix_agentd -t proc.num[,,,apache2]), 会多统计一个进程, 因为agent会统计自身;zone参数设置为current(或默认)会导致agent返回NOTSUPPORTED(agent无法将结果限制在当前zone). 但all在这种情况下是支持的.name和cmdline参数选择进程(Linux特有), 请参阅notes.示例:
proc.num[,mysql] #the number of processes running under the mysql user
proc.num[apache2,www-data] #the number of apache2 processes running under the www-data user
proc.num[,oracle,sleep,oracleZABBIX] #the number of processes in sleep state running under Oracle having oracleZABBIX in its command line
硬件传感器读数。
返回值:float。
支持的平台: Linux, OpenBSD.
参数:
说明:
示例:
sensor[w83781d-i2c-0-2d,temp1]
sensor[cpu0,temp0] #the temperature of one CPU
sensor["cpu[0-2]$",temp,avg] #the average temperature of the first three CPUs
系统启动时间。
返回值:integer(Unix 时间戳)。
支持的平台:Linux、FreeBSD、Solaris、MacOS X、OpenBSD、NetBSD。
检测到的CPU/CPU核心列表。 用于低级发现。
返回值:JSON object。
参见支持的平台。
设备中断。
返回值:integer。
支持的平台:Linux、FreeBSD、Solaris、AIX、OpenBSD、NetBSD。
CPU load.
返回值: float.
参见支持的平台.
参数:
示例:
CPU数量.
返回值: integer.
支持平台: Linux, FreeBSD, Solaris, HP-UX, AIX, MacOS X, OpenBSD, NetBSD.
参数:
max 类型参数仅在 Linux, FreeBSD, Solaris, MacOS X 系统上支持.
示例:
上下文切换次数。
返回值:integer。
支持的平台:Linux、FreeBSD、Solaris、AIX、OpenBSD、NetBSD。
CPU使用率百分比.
返回值: float.
支持平台: Linux, FreeBSD, Solaris, HP-UX, AIX, OpenBSD, NetBSD.
参数:
注释:
示例:
系统主机名.
返回值: string.
参见支持的平台.
参数:
该值通过从uname()系统API输出中获取nodename得到.
返回值示例:
system.hostname → linux-w7x1
system.hostname → example.com
system.hostname[shorthost] → example
system.hostname → WIN-SERV2008-I6
system.hostname[host] → Win-Serv2008-I6LonG
system.hostname[host,lower] → win-serv2008-i6long
system.hostname[fqdn,lower] → blog.zabbix.com
机箱信息.
返回值: string.
支持平台: Linux.
参数:
注释:
示例:
CPU信息.
返回值: string 或 integer.
支持平台: Linux.
参数:
注释:
/proc/cpuinfo和/sys/devices/system/cpu/[cpunum]/cpufreq/cpuinfo_max_freq收集信息;示例:
列出PCI或USB设备.
返回值: 文本.
支持平台: Linux.
参数:
返回lspci或lsusb工具的输出(执行时不带任何参数).
示例:
MAC地址列表.
返回值: string.
支持平台: Linux.
参数:
注释:
interface正则表达式概述的接口MAC地址(all列出所有接口);format指定为short, 则不列出接口名称和重复的MAC地址.示例:
系统时间.
返回值: integer - 当type为utc时; string - 当type为local时.
参见支持的平台.
参数:
仅可作为被动检查使用.
示例:
system.localtime[local] #create an item using this key and then use it to display the host time in the *Clock* dashboard widget.
在主机上运行指定命令。
返回值:命令的文本结果,或当使用mode作为nowait时返回1(无论命令执行结果如何)。
参见支持的平台。
参数:
注释:
text数据类型。 空结果同样允许;示例:
系统统计信息。
返回值:integer 或 float。
支持的平台:AIX。
参数:
备注:
system.stat[cpu,app] - 仅支持类型为“Shared”的AIX LPARsystem.stat[cpu,ec] - 支持类型为“Shared”和“Dedicated”的AIX LPAR(“Dedicated”始终返回100(百分比))system.stat[cpu,lbusy] - 仅支持类型为“Shared”的AIX LPARsystem.stat[cpu,pc] - 支持类型为“Shared”和“Dedicated”的AIX LPARsystem.stat[ent] - 支持类型为“Shared”和“Dedicated”的AIX LPAR
软件架构信息.
返回值: string.
参见支持的平台.
该信息从uname()函数获取.
示例:
操作系统信息.
返回值: string.
支持的平台: Linux, Windows.
参数:
信息获取来源(注意并非所有文件和选项在所有发行版中都存在):
/proc/version (full) 在Linux系统;/proc/version_signature (short) 在Linux系统;/etc/os-release或/etc/issue.net中的PRETTY_NAME参数 (name);HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion注册表键值.示例:
system.sw.os[short] → Ubuntu 2.6.35-28.50-generic 2.6.35.11
system.sw.os[full] → [s|Windows 10 Enterprise 22621.1.asd64fre.ni_release.220506-1250 Build 22621.963]
有关操作系统的详细信息(版本、类型、发行版名称、次版本和主版本等)。
返回值:JSON object。
支持的平台:Linux,Windows。
已安装软件包的列表。
返回值:文本。
支持平台: Linux.
参数:
注释:
format 指定为 full,软件包按软件包管理器分组(每个管理器在单独的行上,以方括号中的名称开头);format 指定为 short,软件包不分组,并在一行中列出。示例:
已安装软件包的详细列表。
返回值:JSON object。
支持的平台:Linux。
参数:
备注:
交换入(从设备到memory)统计。
返回值:integer。
支持平台: Linux, FreeBSD, OpenBSD.
参数:
注释:
示例:
交换出(从memory到设备)的统计信息。
返回值:integer。
支持的平台: Linux, FreeBSD, OpenBSD.
参数:
注释:
/proc/swaps, /proc/partitions, /proc/stat (Linux 2.4)/proc/swaps, /proc/diskstats, /proc/vmstat (Linux 2.6)示例:
交换空间大小(以字节或占总空间的百分比表示)。
返回值:integer - 字节单位;float - 百分比单位。
支持平台: Linux, FreeBSD, Solaris, AIX, OpenBSD.
参数:
注释:
swap -s命令包含部分物理memory和交换设备(与swap -l不同)。示例:
系统标识.
返回值: string.
参见支持的平台.
注释:
示例:
system.uname → FreeBSD localhost 4.2-RELEASE FreeBSD 4.2-RELEASE #0: Mon Nov i386
system.uname → Windows ZABBIX-WIN 6.0.6001 Microsoft® Windows Server® 2008 Standard Service Pack 1 x86
系统运行时间(以秒为单位)。
返回值:integer。
支持平台: Linux, FreeBSD, Solaris, AIX, MacOS X, OpenBSD, NetBSD.
在配置中,使用s或uptime单位将get转换为可读值。
当前登录用户的数量。
返回值:integer。
参见 支持的平台。
who 命令在 agent 端使用以获取该值。
块设备列表及其类型. 用于低级发现.
返回值: JSON object.
支持的平台: Linux.
磁盘读取统计信息.
返回值: integer - 包含type的sectors, operations, bytes; float - 包含type的sps, ops, bps.
支持平台: Linux, FreeBSD, Solaris, AIX, OpenBSD.
参数:
type为: sps, ops, bps时支持.注释:
mode参数仅在Linux, FreeBSD上支持;sda)以及可选的/dev/前缀(例如/dev/sda);示例:
磁盘写入统计。
返回值:integer - 包含type的sectors、operations、bytes;float - 包含type的sps、ops、bps。
支持平台: Linux、FreeBSD、Solaris、AIX、OpenBSD。
参数:
type为sps、ops、bps时支持。注释:
mode参数仅在Linux、FreeBSD上支持;sda)以及可选的/dev/前缀(例如/dev/sda);示例:
目录条目计数。
返回值:integer。
参见支持的平台。
参数:
types incl)。 若某条目类型同时存在于types incl和types excl中,则该类型的目录条目不会被计数。注释:
regex incl和regex excl都应用于文件和目录,但在选择要遍历的子目录时会被忽略(如果regex incl是“(?i)^.+\.zip$”且max depth未设置,则所有子目录都会被遍历,但只有zip类型的文件会被计数)。<min_size>和<max_size>时,建议将<types_incl>指定为"file",以避免意外。示例:
vfs.dir.count[/dev] #monitors the number of devices in /dev (Linux)
vfs.dir.count["C:\Users\ADMINI~1\AppData\Local\Temp"] #monitors the number of files in a temporary directory
目录条目列表.
返回值: JSON object.
参见支持的平台.
参数:
types incl). 如果某个条目类型同时出现在types incl和types excl中, 则该类型的目录条目不会被列出.regex excl不同)注释:
regex incl和regex excl都会应用于文件和目录, 但在选择要遍历的子目录时会被忽略(如果regex incl是"(?i)^.+\.zip$"且max depth未设置, 则所有子目录都会被遍历, 但只有zip类型的文件会被计数).min size和max size时, 建议将types incl指定为"file", 以避免意外.示例:
vfs.dir.get[/dev] #retrieves the device list in /dev (Linux)
vfs.dir.get["C:\Users\ADMINI~1\AppData\Local\Temp"] #retrieves the file list in a temporary directory
目录大小(以字节为单位)。
返回值:integer。
支持平台: Linux, Windows. 该监控项可能在其他类UNIX平台上工作。
参数:
du -sb dir),disk - 获取磁盘使用量(行为类似du -s -B1 dir)。 与du命令不同,vfs.dir.size 监控项在计算目录大小时会考虑隐藏文件(行为类似目录内的du -sb .[^.]* *)。regex excl形成对比)注释:
示例:
vfs.dir.size[/tmp,log] #calculates the size of all files in /tmp containing 'log' in their names
vfs.dir.size[/tmp,log,^.+\.old$] #calculates the size of all files in /tmp containing 'log' in their names, excluding files with names ending with '.old'
file校验和,通过UNIX cksum算法计算。
返回值:integer - 当mode为crc32时,string - 当mode为md5或sha256时。
参见支持的平台。
参数:
file的大小限制取决于large file support。
示例:
返回值的示例(分别为crc32/md5/sha256):
675436101
9845acf68b73991eb7fd7ee0ded23c44
ae67546e4aac995e5c921042d0cf0f1f7147703aa42bfbfb65404b30f238f2dc参数:
注释:
示例:
检查file是否存在.
返回值: 0 - 未找到; 1 - 指定类型的file存在.
参见支持的平台.
参数:
注释:
示例:
vfs.file.exists[/tmp/application.pid]
vfs.file.exists[/tmp/application.pid,"file,dir,sym"]
vfs.file.exists[/tmp/application_dir,dir]vfs.file.get[file]
返回有关file的信息。
返回值:JSON object。
参见支持的平台。
参数:
注释:
示例:
vfs.file.get[/etc/passwd] #return a JSON with information about the /etc/passwd file (type, user, permissions, SID, uid etc)vfs.file.md5sum[file]
file的MD5校验值.
返回值: 字符string (file的MD5哈希值).
参见支持的平台.
参数:
file的大小限制取决于large file support.
示例:
返回值示例:
获取file的所有者.
返回值: string.
参见支持的平台.
参数:
file的大小限制取决于large file support.
示例:
vfs.file.owner[/tmp/zabbix_server.log] #return the file owner of /tmp/zabbix_server.log
vfs.file.owner[/tmp/zabbix_server.log,,id] #return the file owner ID of /tmp/zabbix_server.logvfs.file.permissions[file]
返回一个包含UNIX权限八进制数的4位string.
返回值: string.
支持平台: Linux. 该监控项可能在其他类UNIX平台上工作.
参数:
file的大小限制取决于large file support.
示例:
在file7中检索string.
返回值: 包含匹配string的行, 或由可选参数output指定的内容.
参见支持的平台.
参数:
注释:
output参数的内容提取操作在agent上执行.示例:
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] → getting the ID of user *zabbix*
在file7中查找string.
返回值: 0 - 未找到匹配项; 1 - 找到匹配项.
参见支持的平台.
参数:
注释:
示例:
file的大小(以字节为单位)。
返回值:integer。
参见支持的平台。
参数:
注释:
示例:
file时间信息.
返回值: integer (Unix时间戳).
参见支持的平台.
参数:
file的大小限制取决于large file support.
示例:
列出已挂载文件系统的类型及挂载选项。 用于低级发现。
返回值:JSON object。
支持平台: Linux, FreeBSD, Solaris, HP-UX, AIX, MacOS X, OpenBSD, NetBSD。
vfs.fs.get
列出已挂载文件系统及其类型、可用磁盘空间、inode统计信息和挂载选项。 可用于低级发现。
返回值:JSON object。
支持平台: Linux, FreeBSD, Solaris, HP-UX, AIX, MacOS X, OpenBSD, NetBSD.
注释:
inode的数量或百分比.
返回值: integer - 表示数量; float - 表示百分比.
参见支持的平台.
参数:
如果inode计数为零(对于动态inode的file系统如btrfs可能出现这种情况), pfree/pused值将分别报告为"100"和"0".
示例:
以字节或占总空间的百分比表示的磁盘空间。
返回值:integer - 表示字节;float - 表示百分比。
参见支持的平台。
参数:
注释:
示例:
以字节或占总量的百分比表示的memory大小.
返回值: integer - 表示字节; float - 表示百分比.
参见支持的平台.
参数:
注释:
示例:
获取网页内容。
返回值:网页源代码文本(包含头部信息)。
参见支持平台。
参数:
scheme://host:port/path,其中仅主机为必填项)。 允许的URL方案:http、https4。 未指定协议时默认使用http。 若指定URL,则path和port必须为空。 为需要认证的服务器指定用户名/密码(例如:http://user:[email protected])仅在使用cURL支持时可用4。 主机名支持Punycode。注释:
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"]
完整网页加载时间(以秒为单位)。
返回值:float。
参见支持平台。
参数:
scheme://host:port/path,其中仅主机为必填项)。 允许的URL方案:http、https4。 未指定方案时将默认为http。 若指定URL,则path和port必须为空。 仅当支持cURL时4,可为需要认证的服务器指定用户名/密码,例如:http://user:[email protected]。 主机名支持Punycode编码。注释:
host中指定的资源不存在或不可用时,此监控项将转为不支持状态;host可以是主机名、域名、IPv4或IPv6地址。 但对于IPv6地址,Zabbix agent必须启用IPv6支持编译。示例:
在网页上查找一个string.
返回值: 匹配到的string, 或由可选的output参数指定.
参见支持的平台.
参数:
scheme://host:port/path, 其中只有主机是必填项). 允许的URL方案: http, https4. 缺失的方案将被视为http. 如果指定了URL, 则path和port必须为空. 为需要认证的服务器指定用户名/密码, 例如: http://user:[email protected] 仅在支持cURL时可用4. 主机名支持Punycode编码.注释:
host中指定的资源不存在或不可用, 此监控项将变为不支持状态;host可以是主机名、域名、IPv4或IPv6地址. 但对于IPv6地址, Zabbix agent必须编译时启用IPv6支持.output参数的内容提取发生在agent上.示例:
agent 主机 的元数据。
返回值:string。
参见 支持的平台。
返回 主机元数据 或 主机元数据项 参数的值,如果均未定义,则返回空的 string。
agent 主机名 的说明。
返回值:string。
参见 支持的平台。
返回值说明:
agent 可用性检查。
返回值:无 - 不可用;1 - 可用。
请参阅 支持的平台。
使用 nodata() 触发器函数来检查 主机 不可用情况。
Zabbix agent 的变体(Zabbix agent 或 Zabbix agent 2)。
返回值:1 - Zabbix agent;2 - Zabbix agent 2。
请参阅 支持的平台。
version的Zabbix agent功能.
返回值: string.
参见支持的平台.
返回值示例:
远程返回一组Zabbix server或proxy内部指标.
返回值: JSON object.
参见支持的平台.
参数:
注释:
zabbix.stats[<ip>,<port>,queue,<from>,<to>]
返回队列中受监控的监控项数量,这些主机在本地或远程的Zabbix server或proxy上存在延迟。
返回值:JSON object。
参见 支持的平台。
参数:
请注意,统计请求仅接受来自目标get实例的“StatsAllowedIP” server/proxy参数中列出的地址的请求。
1 Linux系统特别说明 Zabbix agent必须对/proc文件系统具有只读访问权限 来自www.grsecurity.org的内核补丁会限制非特权用户的访问权限
2 vfs.dev.read[]、vfs.dev.write[]:如果监控项值超过3小时未被访问,Zabbix agent将终止"陈旧"的设备连接 这种情况可能发生在系统具有动态变更路径的设备或手动移除设备时 还需注意,如果这些监控项使用3小时或更长的update间隔,将始终返回'0'
3 vfs.dev.read[]、vfs.dev.write[]:如果第一个参数使用默认值all,则该键将返回汇总统计信息,包括所有块设备如sda、sdb及其分区(sda1、sda2、sdb3...)以及基于这些块设备/分区的多设备(MD raid)和逻辑卷(LVM) 在此情况下,返回值应仅被视为相对值(随时间动态变化)而非绝对值
4 仅当agent编译时包含cURL支持时才支持SSL(HTTPS) 否则监控项将变为不支持状态
5 在Solaris 10 6/06及更早版本的Solaris系统上,回环接口不支持bytes和errors值,因为内核不存储和/或报告字节、错误和利用率统计信息 但如果您通过net-snmp监控Solaris系统,可能会返回值,因为net-snmp包含可追溯至1997年的cmu-snmp遗留代码,在无法从接口统计信息读取字节值时,会返回数据包计数器(回环接口上确实存在)乘以任意值308 这是假设数据包平均长度为308个八位字节,这个估算非常粗略,因为Solaris系统上回环接口的MTU限制为8892字节 这些值不应被视为正确或接近准确,它们只是猜测值 Zabbix agent不会进行任何猜测工作,但net-snmp会返回这些字段的值
6 从/proc/pid/psinfo获取的Solaris命令行限制为80字节,并包含进程启动时的命令行
7 vfs.file.contents[]、vfs.file.regexp[]、vfs.file.regmatch[] 监控项可用于检索file内容 如果要限制对包含敏感信息的特定文件的访问,请run一个对这些文件没有查看权限的用户来运行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]为确保获取的数据未被损坏,您可以在encoding参数中指定正确的编码来处理检查(例如'vfs.file.contents')。 支持的编码列表(代码页标识符)可在libiconv(GNU项目)文档或Microsoft Windows SDK的"Code Page Identifiers"文档中找到。 请注意,微软有时会将某些代码页标记为"仅限托管应用程序使用"——即仅通过.NET运行时公开,而不通过原生Win32 API提供。Zabbix agent实现了自己的编码转换逻辑,因此即使原生Windows函数不提供这些代码页,Zabbix agent也支持它们。
如果未在encoding参数中指定编码,则应用以下解析策略:
对于被动检查,为防止监控项因服务器对agent的请求首先超时而无法get任何值,需注意以下事项:
Timeout值。Timeout值可能需要高于agent的configuration file中的Timeout值。