打赏

Check access restrictions in Zabbix agent configuration

配置自定义监控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>
View Code

 

当然出现这种错误还有可能是其他的原因,不断补充中。。

posted @ 2018-03-16 09:02  芹溪  阅读(15844)  评论(0编辑  收藏  举报