这是原厂英文文档的翻译页面. 欢迎帮助我们 完善文档.
2022 Zabbix中国峰会
2022 Zabbix中国峰会

zabbix_sender

部分:用户命令User Commands (1)
最近更新: 2021-06-01
Index Return to Main Contents


名字

zabbix_sender - Zabbix sender 实用程序

概要

zabbix_sender [-v] -z server [-p port] [-I IP-address] [-t timeout] -s host -k key -o value
zabbix_sender [-v] -z server [-p port] [-I IP-address] [-t timeout] [-s host] [-T] [-N] [-r] -i input-file
zabbix_sender [-v] -c config-file [-z server] [-p port] [-I IP-address] [-t timeout] [-s host] -k key -o value
zabbix_sender [-v] -c config-file [-z server] [-p port] [-I IP-address] [-t timeout] [-s host] [-T] [-N] [-r] -i input-file
zabbix_sender [-v] -z server [-p port] [-I IP-address] [-t timeout] -s host --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 server [-p port] [-I IP-address] [-t timeout] [-s host] --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] -i input-file
zabbix_sender [-v] -c config-file [-z server] [-p port] [-I IP-address] [-t timeout] [-s host] --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 server] [-p port] [-I IP-address] [-t timeout] [-s host] --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] -i input-file
zabbix_sender [-v] -z server [-p port] [-I IP-address] [-t timeout] -s host --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 server [-p port] [-I IP-address] [-t timeout] [-s host] --tls-connect psk --tls-psk-identity PSK-identity --tls-psk-file PSK-file [--tls-cipher13 cipher-string] [--tls-cipher cipher-string] [-T] [-N] [-r] -i input-file
zabbix_sender [-v] -c config-file [-z server] [-p port] [-I IP-address] [-t timeout] [-s host] --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 server] [-p port] [-I IP-address] [-t timeout] [-s host] --tls-connect psk --tls-psk-identity PSK-identity --tls-psk-file PSK-file [--tls-cipher13 cipher-string] [--tls-cipher cipher-string] [-T] [-N] [-r] -i input-file
zabbix_sender -h
zabbix_sender -V

描述

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

选项

-c, --config config-file
使用config-file选项。Zabbix sender从agentd配置文件读取server详细信息。默认情况下Zabbix sender不读取任何配置文件。仅支持参数 HostnameServerActiveSourceIPTLSConnectTlsCfileTLSServerCertIssuerTLSServerCertSubjectTLSCertFileTLSKeyFileTLSKeyFileTlspKidEntityTlspSpkFile。Agent ServerActive配置参数中定义的所有地址都用于发送数据。如果批次数据发送到某一个地址失败,则后续批次不会在发送到该地址。

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

-p, --port port
指定server上运行的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通信协议Size limit 中对大小的定义。输入文件的内容必须采用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
收到值后立即逐个发送。当从标准输入读取数据时,可以使用此选项。

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

unencrypted
无加密连接(默认)

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

cert
使用TLS和证书进行连接

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

--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-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
输出版本信息并退出。

退出状态

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

示例

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

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

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

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


zabbix_sender -z 192.168.1.113 -i data_values.txt


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


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

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


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

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

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** 的 IP 主机的服务器。

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 为 IP 为 192.168.1.113 的服务器。

## 另请参见

文档 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)  

作者

Alexei Vladishev <[[email protected]]{.__cf_email__ cfemail="0d6c6168754d776c6f6f6475236e6260"}>


索引

NAME

SYNOPSIS

DESCRIPTION

OPTIONS

EXIT STATUS

EXAMPLES

SEE ALSO

AUTHOR


该文档是由man2html,使用手册页创建的。 时间: 08:42:39 GMT, 六月 11, 2021