[comment]: # ({14379c17-14379c17})
# 7 获取

[comment]: # ({/14379c17-14379c17})

[comment]: # ({4b759b49-f50cbd4e})
#### 概述

Zabbix get 是一个命令行工具，可用于与 Zabbix agent 通信并从 agent 获取所需信息。

该工具通常用于 Zabbix agents 的故障排除。

另请参阅 [zabbix_utils](https://github.com/zabbix/python-zabbix-utils/blob/main/README.md) - 一个具有内置功能的Python库，可模拟Zabbix get的行为。

[comment]: # ({/4b759b49-f50cbd4e})

[comment]: # ({593cade0-c625ea25})
#### 运行Zabbix get

一个在UNIX下运行Zabbix get以get处理器负载的示例
来自agent的值:

    cd bin
    ./zabbix_get -s 127.0.0.1 -p 10050 -k system.cpu.load[all,avg1]

另一个运行Zabbix get来从捕获string的示例
网站

    cd bin
    ./zabbix_get -s 192.168.1.1 -p 10050 -k "web.page.regexp[www.example.com,,,\"USA: ([a-zA-Z0-9.-]+)\",,\1]"

请注意这里的监控项键包含空格，因此使用引号进行标记
将监控项密钥传递给shell。引号不属于监控项密钥的一部分；它们
将被shell截断且不会传递给Zabbix agent

Zabbix get 接受以下命令行参数:

```ini
-s --host <host name or IP>      Specify host name or IP address of a host
-p --port <port number>          Specify port number of agent running on the host (default: 10050)
-I --source-address <IP address> Specify source IP address
-t --timeout <seconds>           Specify timeout. Valid range: 1-30 seconds (default: 30 seconds)
-k --key <item key>              Specify key of item to retrieve value for
-h --help                        Display this help message
-V --version                     Display version number
```
另请参阅[Zabbix get manpage](/manpages/zabbix_get)获取更多信息
信息

Windows上的Zabbix get可以run类似地：

    
zabbix_get.exe [选项]

[comment]: # ({/593cade0-c625ea25})
