zabbix_sender

章节:用户命令 (1)
最近更新: 2021-06-01
索引 返回主目录


[ ]{#lbAB}

名称

zabbix_sender - Zabbix sender 实用程序 [ ]{#lbAC}

概要

zabbix_sender [-v] -z 服务器 [-p port] [-I IP-address] [-t timeout] -s 主机 -k key -o value
zabbix_sender [-v] -z 服务器 [-p port] [-I IP-address] [-t timeout] [-s 主机] [-T] [-N] [-r] [-g] -i input-file
zabbix_sender [-v] -c config-file [-z 服务器] [-p port] [-I IP-address] [-t timeout] [-s 主机] -k key -o value
zabbix_sender [-v] -c config-file [-z 服务器] [-p port] [-I IP-address] [-t timeout] [-s 主机] [-T] [-N] [-r] [-g] -i input-file
zabbix_sender [-v] -z 服务器 [-p port] [-I IP-address] [-t timeout] -s 主机 --tls-connect cert --tls-ca-file CA-file [--tls-crl-file CRL-file] [--tls-server-cert-issuer cert-issuer] [--tls-server-cert-subject cert-subject] --tls-cert-file cert-file --tls-key-file key-file [--tls-cipher13 cipher-string] [--tls-cipher cipher-string] -k key -o value
zabbix_sender [-v] -z 服务器 [-p port] [-I IP-address] [-t timeout] [-s 主机] --tls-connect cert --tls-ca-file CA-file [--tls-crl-file CRL-file] [--tls-server-cert-issuer cert-issuer] [--tls-server-cert-subject cert-subject] --tls-cert-file cert-file --tls-key-file key-file [--tls-cipher13 cipher-string] [--tls-cipher cipher-string] [-T] [-N] [-r] [-g] -i input-file
zabbix_sender [-v] -c config-file [-z 服务器] [-p port] [-I IP-address] [-t timeout] [-s 主机] --tls-connect cert --tls-ca-file CA-file [--tls-crl-file CRL-file] [--tls-server-cert-issuer cert-issuer] [--tls-server-cert-subject cert-subject] --tls-cert-file cert-file --tls-key-file key-file [--tls-cipher13 cipher-string] [--tls-cipher cipher-string] -k key -o value
zabbix_sender [-v] -c config-file [-z 服务器] [-p port] [-I IP-address] [-t timeout] [-s 主机] --tls-connect cert --tls-ca-file CA-file [--tls-crl-file CRL-file] [--tls-server-cert-issuer cert-issuer] [--tls-server-cert-subject cert-subject] --tls-cert-file cert-file --tls-key-file key-file [--tls-cipher13 cipher-string] [--tls-cipher cipher-string] [-T] [-N] [-r] [-g] -i input-file
zabbix_sender [-v] -z 服务器 [-p port] [-I IP-address] [-t timeout] -s 主机 --tls-connect psk --tls-psk-identity PSK-identity --tls-psk-file PSK-file [--tls-cipher13 cipher-string] [--tls-cipher cipher-string] -k key -o value
zabbix_sender [-v] -z 服务器 [-p port] [-I IP-address] [-t timeout] [-s 主机] --tls-connect psk --tls-psk-identity PSK-identity --tls-psk-file PSK-file [--tls-cipher13 cipher-string] [--tls-cipher cipher-string] [-T] [-N] [-r] [-g] -i input-file
zabbix_sender [-v] -c config-file [-z 服务器] [-p port] [-I IP-address] [-t timeout] [-s 主机] --tls-connect psk --tls-psk-identity PSK-identity --tls-psk-file PSK-file [--tls-cipher13 cipher-string] [--tls-cipher cipher-string] -k key -o value
zabbix_sender [-v] -c config-file [-z 服务器] [-p port] [-I IP-address] [-t timeout] [-s 主机] --tls-connect psk --tls-psk-identity PSK-identity --tls-psk-file PSK-file [--tls-cipher13 cipher-string] [--tls-cipher cipher-string] [-T] [-N] [-r] [-g] -i input-file
zabbix_sender -h
zabbix_sender -V [ ]{#lbAD}

描述

zabbix_sender 是一个命令行实用程序,用于向Zabbix server或者proxy发送监控数据。在Zabbix server上,应使用相应的密钥创建Zabbix trapper类型的监控项。请注意,传入值将仅接受从该监控项的允许的主机字段中指定的主机。[]{#lbAE}

选项

-c, --config config-file
使用 config-fileZabbix sender 从 agentd 配置文件中读取服务器详细信息。默认情况下,Zabbix sender 不会读取任何配置文件。仅支持参数 HostnameServerActiveSourceIPTLSConnectTLSCAFileTLSCRLFileTLSServerCertIssuerTLSServerCertSubjectTLSCertFileTLSKeyFileTLSPSKIdentityTLSPSKFile
通过 HostnameItem 参数定义的 Hostname 不会被读取,在这种情况下应通过命令行指定主机名(参见 -s 选项)。
agent ServerActive 配置参数中定义的所有地址都会用于发送数据。如果向某个地址发送一批数据失败,则后续批次将不会再发送到该地址。

-z, --zabbix-server server
Zabbix 服务器的主机名或 IP 地址。如果某个主机由 proxy 监控,则应改用 proxy 的主机名或 IP 地址。与 --config 一起使用时,会覆盖 agentd 配置文件中 ServerActive 参数指定的条目。

-p, --port port
指定运行在服务器上的 Zabbix server trapper 的端口号。默认值为 10051。与 --config 一起使用时,会覆盖 agentd 配置文件中 ServerActive 参数指定的端口条目。

-I, --source-address IP-address
指定源 IP 地址。与 --config 一起使用时,会覆盖 agentd 配置文件中指定的 SourceIP 参数。

-t, --timeout seconds
指定超时时间。有效范围:1-300 秒(默认:60)

-s, --host host
指定该监控项所属的主机名称(与在 Zabbix 前端中注册的名称一致)。主机 IP 地址和 DNS 名称无效。与 --config 一起使用时,会覆盖 agentd 配置文件中指定的 Hostname 参数。

-k, --key key
指定要发送值的监控项键值。

-o, --value value
指定监控项值。

-i, --input-file input-file
从输入文件加载值。将 - 指定为 <input-file> 可从标准输入读取值。文件的每一行都包含以空白字符分隔的内容:<hostname> <key> <value>。每个值都必须单独占一行。每一行必须包含 3 个以空白字符分隔的条目:<hostname> <key> <value>,其中 “hostname” 是在 Zabbix 前端中注册的被监控主机名称,“key” 是目标监控项键值,“value” 是要发送的值。
- 指定为 <hostname> 时,将使用 agent 配置文件中的主机名或 --host 参数中的主机名。

输入文件中一行的示例:

"Linux DB3" db.connections 43

值类型必须在 Zabbix 前端的监控项配置中正确设置。
Zabbix sender 在一个连接中最多发送 250 个值。
从输入文件发送值的大小限制取决于 Zabbix 通信协议中描述的大小。
输入文件内容必须采用 UTF-8 编码。
输入文件中的所有值将按从上到下的顺序依次发送。
条目必须按照以下规则格式化:

  • 支持带引号和不带引号的条目。
  • 双引号是引用字符。
  • 包含空白字符的条目必须加引号。
  • 带引号条目中的双引号和反斜杠字符必须使用反斜杠转义。
  • 不支持在不带引号的条目中使用转义。
  • 带引号字符串中支持换行转义序列 (\n)。
  • 条目末尾的换行转义序列会被去除。

-T, --with-timestamps
此选项只能与 --input-file 选项一起使用。

输入文件的每一行必须包含 4 个以空白字符分隔的条目:
<hostname> <key> <timestamp> <value>
时间戳应采用 Unix 时间戳格式指定。如果目标监控项有关联的触发器引用它,则所有时间戳必须按递增顺序排列,否则事件计算将不正确。

输入文件中一行的示例:

"Linux DB3" db.connections 1429533600 43

更多详细信息请参见 --input-file 选项。

如果向处于“无数据”维护类型的主机发送带时间戳的值,则该值将被丢弃;但是,可以向已过期的维护时段发送带时间戳的值,并且该值会被接受。

-N, --with-ns
此选项只能与 --with-timestamps 选项一起使用。

输入文件的每一行必须包含 5 个以空白字符分隔的条目:
<hostname> <key> <timestamp> <ns> <value>

输入文件中一行的示例:

"Linux DB3" db.connections 1429533600 7402561 43

更多详细信息请参见 --input-file 选项。

-r, --real-time
在接收到值后立即逐个发送。可用于从标准输入读取时。

-g, --group
按主机对值进行分组,并将每个主机的值作为单独的一批发送。

--tls-connect value
如何连接到服务器或 proxy。取值:

[ ]{#lbAF}

unencrypted
不加密连接(默认)

<!-- -->

psk
使用TLS和预共享密钥进行连接

<!-- -->

cert
使用TLS和证书进行连接

<!-- -->

--tls-ca-file CA-file
包含用于对等证书验证的顶级CA证书的文件的完整路径名。

--tls-crl-file CRL-file
包含已吊销证书的文件的完整路径名。

--tls-server-cert-issuer cert-issuer
允许的server证书颁发者。

--tls-server-cert-subject cert-subject
允许的server证书主题。

--tls-cert-file cert-file
包含证书或证书链的文件的完整路径名。

--tls-key-file key-file
包含私钥的文件的完整路径名。

--tls-psk-identity PSK-identity
PSK标识字符串。

--tls-psk-file PSK-file
包含预共享密钥的文件的完整路径名。

--tls-cipher13 cipher-string
OpenSSL 1.1.1或更新版本TLS 1.3的密码字符串。覆盖默认的密码套件选择条件。如果OpenSSL版本低于1.1.1,则此选项不可用。

--tls-cipher cipher-string
GnuTLS优先级字符串(适用于TLS 1.2及以上版本)或OpenSSL密码字符串(仅适用于TLS 1.2)。覆盖默认的密码套件选择条件。

-v, --verbose
详细模式,-vv了解更多详细信息。

-h, --help
显示此帮助并退出。

-V, --version
输出版本信息并退出。

[ ]{#lbAG}

退出状态

如果值已发送且server已成功处理所有值,则退出状态为0。如果发送了数据,但至少一个值的处理失败,则退出状态为2。如果数据发送失败,退出状态为1。

[ ]{#lbAH}

示例

zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k mysql.queries -o 342.45\

发送 342.45 作为受监视主机的 mysql.queries 监控项的值。使用代理配置文件中定义的受监视主机和 Zabbix server 。

zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -s "Monitored Host" -k mysql.queries -o 342.45\

使用代理配置文件中定义的 Zabbix server发送 342.45 作为在前端注册的 受监视主机 主机的 mysql.queries 监控项的值。


zabbix_sender -z 192.168.1.113 -i data_values.txt


将值从文件 data_values.txt 发送到 IP 为 192.168.1.113 的 Zabbix server。主机名和密钥在文件中定义。


echo "- hw.serial.number 1287872261 SQ4321ASDF" | zabbix_sender -c /usr/local/etc/zabbix_agentd.conf -T -i -\

将带时间戳的值从命令行发送到agent配置文件中指定的 Zabbix server。输入数据中的短划线表示主机名也应从同一使用的配置文件中读取。


echo '"Zabbix server" trapper.item ""' | zabbix_sender -z 192.168.1.113 -p 10000 -i -\

从命令行将监控项的空值发送到端口 10000 上的 IP 地址为 192.168.1.113 的 Zabbix server。空值必须由空双引号表示。

zabbix_sender -z 192.168.1.113 -s "Monitored Host" -k mysql.queries -o 342.45 --tls-connect cert --tls-ca-file /home/zabbix/zabbix_ca_file --tls-cert-file /home/zabbix/zabbix_agentd.crt --tls-key-file /home/zabbix/zabbix_agentd.key\

使用带有证书的 TLS 将 342.45 作为 mysql.queries 监控项的值发送到 IP 为 192.168.1.113** 的server。

zabbix_sender -z 192.168.1.113 -s "Monitored Host" -k mysql.queries -o 342.45 --tls-connect psk --tls-psk-identity "PSK ID Zabbix agentd" --tls-psk-file /home/zabbix/zabbix_agentd.psk\

使用带有预共享密钥 (PSK) 的 TLS 将 342.45 作为 mysql.queries 监控项的值发送到 IP 为 192.168.1.113 的server。

[ ]{#lbAI}

另见

文档 https://www.zabbix.com/manuals

zabbix_agentd(8), zabbix_get(1), zabbix_proxy(8), zabbix_server(8), zabbix_js(1), zabbix_agent2(8), zabbix_web_service(8) [ ]{#lbAJ}

索引

名称

概要

描述

选项

退出状态

示例

另见

作者


本文档创建于:2021年6月11日 08:42:39 GMT