配置自定義監控K值時,出現下面錯誤提示
[root@manage ~]# zabbix_get -s 101.221.155.218 -p 10050 -k "login_user" zabbix_get [16922]: Check access restrictions in Zabbix agent configuration
可能性一、zabbix_get命令使用場景
zabbix的服務器端與客戶端連接的主要工具就是zabbix里bin文件夾下的zabbix_get文件,這個命令只能在zabbix的server端使用,如果在agent端使用就會提示如下的錯誤: zabbix_get [7189]: Check access restrictions in Zabbix agent configuration
可能性二、未連接zabbix客戶端
zabbix_get命令使用方法: zabbix_get -s 127.0.0.1 -p 10050 -k "system.cpu.load[all,avg1]"
注意: -s后面接的是目標地址,-p后面要加端口號,這個一般都是10050, -I 后面加原地址,不過這個一般用不上,-k 后面接的就是item項目里的key。
如果zabbix客戶端配置的是內網地址,那么這里使用公網地址,也會出現“Check access restrictions in Zabbix agent configuration”的問題;這里的-k注意必須是zabbix_agent.conf中Server配置指向的地址。
[root@manage ~]# zabbix_get -s 191.201.185.218 -p 10050 -k "login_user" zabbix_get [16922]: Check access restrictions in Zabbix agent configuration #排除客戶端連接不通的可能性 [root@manage ~]# ping 191.201.185.218 PING 191.201.185.218 (101.201.185.218) 56(84) bytes of data. 64 bytes from 191.201.185.218: icmp_seq=1 ttl=57 time=1.27 ms 64 bytes from 191.201.185.218: icmp_seq=2 ttl=57 time=1.24 ms ##使用zabbix客戶端的內網地址,因為我的zabbix_agent.conf配置的是內網地址 [root@manage ~]# zabbix_get -s 10.45.199.182 -p 10050 -k "login_user" 1 ##成功獲取到K值
zabbix_get使用方法:

[root@manage ~]# zabbix_get -help usage: zabbix_get -s host-name-or-IP [-p port-number] [-I IP-address] -k item-key zabbix_get -s host-name-or-IP [-p port-number] [-I IP-address] --tls-connect cert --tls-ca-file CA-file [--tls-crl-file CRL-file] [--tls-agent-cert-issuer cert-issuer] [--tls-agent-cert-subject cert-subject] --tls-cert-file cert-file --tls-key-file key-file -k item-key zabbix_get -s host-name-or-IP [-p port-number] [-I IP-address] --tls-connect psk --tls-psk-identity PSK-identity --tls-psk-file PSK-file -k item-key zabbix_get -h zabbix_get -V Get data from Zabbix agent. General options: -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 -k --key item-key Specify key of the item to retrieve value for -h --help Display this help message -V --version Display version number TLS connection options: --tls-connect value How to connect to agent. Values: unencrypted - connect without encryption (default) psk - connect using TLS and a pre-shared key cert - connect using TLS and a certificate --tls-ca-file CA-file Full pathname of a file containing the top-level CA(s) certificates for peer certificate verification --tls-crl-file CRL-file Full pathname of a file containing revoked certificates --tls-agent-cert-issuer cert-issuer Allowed agent certificate issuer --tls-agent-cert-subject cert-subject Allowed agent certificate subject --tls-cert-file cert-file Full pathname of a file containing the certificate or certificate chain --tls-key-file key-file Full pathname of a file containing the private key --tls-psk-identity PSK-identity Unique, case sensitive string used to identify the pre-shared key --tls-psk-file PSK-file Full pathname of a file containing the pre-shared key Example(s): zabbix_get -s 127.0.0.1 -p 10050 -k "system.cpu.load[all,avg1]" zabbix_get -s 127.0.0.1 -p 10050 -k "system.cpu.load[all,avg1]" \ --tls-connect cert --tls-ca-file /home/zabbix/zabbix_ca_file \ --tls-agent-cert-issuer \ "CN=Signing CA,OU=IT operations,O=Example Corp,DC=example,DC=com" \ --tls-agent-cert-subject \ "CN=server1,OU=IT operations,O=Example Corp,DC=example,DC=com" \ --tls-cert-file /home/zabbix/zabbix_get.crt \ --tls-key-file /home/zabbix/zabbix_get.key zabbix_get -s 127.0.0.1 -p 10050 -k "system.cpu.load[all,avg1]" \ --tls-connect psk --tls-psk-identity "PSK ID Zabbix agentd" \ --tls-psk-file /home/zabbix/zabbix_agentd.psk Report bugs to: <https://support.zabbix.com> Zabbix home page: <http://www.zabbix.com> Documentation: <https://www.zabbix.com/documentation>
當然出現這種錯誤還有可能是其他的原因,不斷補充中。。