Zabbix网络自动发现规则和自动添加hosts及link模板

时间:2022-12-23 13:04:09

Version: zabbix 3.0

一、配置网络发现规则(Configuration Discovery)

Zabbix网络自动发现规则和自动添加hosts及link模板

Device uniqueness criteria:选择主机名作为唯一标识(Configuation Hosts中显示的NAME)

二、查看发现的主机(Monitoring->Discovery)

Zabbix网络自动发现规则和自动添加hosts及link模板

ps: 显示主机名(m-proxy1)需要在服务器端/etc/hosts定义

192.168.0.2  m-proxy1

三、自动添加Hosts(加入到对应组,links对应模板)(Configuration -> Actions Event -> Discovery)

Zabbix网络自动发现规则和自动添加hosts及link模板

Zabbix网络自动发现规则和自动添加hosts及link模板

Zabbix网络自动发现规则和自动添加hosts及link模板

Zabbix网络自动发现规则和自动添加hosts及link模板

现在可以看到添加的主机(Configuation->Hosts)

Q&S

步骤一后 并未发现hosts

Solve:

1 tcpdump -vnn host 172.16.0.116 and port 10050  #发现服务器并没有发送discovery包到客户端

2 日志开启 debugging (DebugLevel=5)

tail -f /tmp/zabbix_server.log | grep discover

  ::174909.385 __zbx_zbx_setproctitle() title:'discoverer #1 [processed 1 rules in 0.020067 sec, performing discovery]'
::174909.393 In discover_service()
::174909.394 discovery: item [system.uname] error: A TLS connection is configured to be used with agent but support for TLS was not compiled into server.
::174909.394 End of discover_service():FAIL
::174909.394 In discovery_update_service() ip:'172.16.0.115' dns:'' port: status: value:''
::174909.395 In discovery_register_host() ip:'172.16.0.115' status: value:''
::174909.395 End of discovery_register_host()
::174909.395 End of discovery_update_service()
::174909.396 In discovery_update_host()
::174909.397 End of discovery_update_host()
::174909.397 In discovery_clean_services()
::174909.397 End of discovery_clean_services()
::174909.400 __zbx_zbx_setproctitle() title:'discoverer #1 [processed 1 rules in 0.014707 sec, idle 30 sec]'
::174923.275 query [txnlev:] [select refresh_unsupported,discovery_groupid,snmptrap_logging,severity_name_0,severity_name_1,severity_name_2,severity_name_3,severity_name_4,severity_name_5,hk_events_mode,hk_events_trigger,hk_events_internal,hk_events_discovery,hk_events_autoreg,hk_services_mode,hk_services,hk_audit_mode,hk_audit,hk_sessions_mode,hk_sessions,hk_history_mode,hk_history_global,hk_history,hk_trends_mode,hk_trends_global,hk_trends,default_inventory_mode from config]
::174935.465 In substitute_key_macros() data:'zabbix[process,discoverer,avg,busy]'
::174935.465 End of substitute_key_macros():SUCCEED data:'zabbix[process,discoverer,avg,busy]'
::174935.465 In get_value() key:'zabbix[process,discoverer,avg,busy]'
::174935.671 In evaluate_function() function:'Zabbix server:zabbix[process,discoverer,avg,busy].avg(10m)'
::174939.404 __zbx_zbx_setproctitle() title:'discoverer #1 [processed 1 rules in 0.014707 sec, performing discovery]'
::174939.413 In discover_service()
::174939.413 discovery: item [system.uname] error: A TLS connection is configured to be used with agent but support for TLS was not compiled into server.
::174939.413 End of discover_service():FAIL

需要TLS支持(yum install -y openssl openssl-devel)  configure --with-openssl

(2.0网络发现没有这个要求)