7 在Zabbix中发现主机接口

概述

可以发现主机的Zabbix前端中配置的所有接口。

键值

发现规则 中使用的监控项是

  1. zabbix[host,discovery,interfaces]

内部监控项。此监控项从Zabbix server 3.4开始支持。

此监控项反馈一个带有接口描述的JSON,包括:

  • IP地址/DNS主机名称 (depending on the “Connect to” host setting)

  • 端口号

  • 接口类型 (Zabbix agent, SNMP, JMX, IPMI)

  • 此接口是否为默认接口

  • 是否启用了批量请求功能 - 仅适用于SNMP接口

例如:

  1. {"data":[{"{#IF.CONN}":"192.168.3.1","{#IF.IP}":"192.168.3.1","{#IF.DNS}":"","{#IF.PORT}":"10050","{#IF.TYPE}":"AGENT","{#IF.DEFAULT}":1}]}

使用多个接口,它们在JSON中的记录按以下顺序排序:

  • 接口类型,

  • 默认 - 默认接口放在默认接口之前,

  • 接口ID (升序排列).

支持宏

支持在发现规则过滤器,以及监控项,触发器和图表原型中使用以下宏:

描述
{#IF.CONN}接口IP地址或DNS主机名称
{#IF.IP}接口IP地址
{#IF.DNS}接口DNS主机名称
{#IF.PORT}接口端口号
{#IF.TYPE}接口类型 (“AGENT”, “SNMP”, “JMX”, or “IPMI”).
{#IF.DEFAULT}接口默认状态:
0 - 非默认接口
1 - 默认接口
{#IF.SNMP.BULK}接口的SNMP批量处理状态:
0 - 禁用
1 - 启用
仅当接口类型为“SNMP”时才反馈此宏。

7 Discovery of host interfaces in Zabbix

Overview

It is possible to discover all interfaces configured in Zabbix frontend for a host.

Item key

The item to use in the discovery rule is the

  1. zabbix[host,discovery,interfaces]

internal item. This item is supported since Zabbix server 3.4.

This item returns a JSON with the description of interfaces, including:

  • IP address/DNS hostname (depending on the “Connect to” host setting)

  • Port number

  • Interface type (Zabbix agent, SNMP, JMX, IPMI)

  • If it is the default interface or not

  • If the bulk request feature is enabled - for SNMP interfaces only.

For example:

  1. {"data":[{"{#IF.CONN}":"192.168.3.1","{#IF.IP}":"192.168.3.1","{#IF.DNS}":"","{#IF.PORT}":"10050","{#IF.TYPE}":"AGENT","{#IF.DEFAULT}":1}]}

With multiple interfaces their records in JSON are ordered by:

  • Interface type,

  • Default - the default interface is put before non-default interfaces,

  • Interface ID (in ascending order).

Supported macros

The following macros are supported for use in the discovery rule filter and prototypes of items, triggers and graphs:

MacroDescription
{#IF.CONN}Interface IP address or DNS host name.
{#IF.IP}Interface IP address.
{#IF.DNS}Interface DNS host name.
{#IF.PORT}Interface port number.
{#IF.TYPE}Interface type (“AGENT”, “SNMP”, “JMX”, or “IPMI”).
{#IF.DEFAULT}Default status for the interface:
0 - not default interface
1 - default interface
{#IF.SNMP.BULK}SNMP bulk processing status for the interface:
0 - disabled
1 - enabled
This macro is returned only if interface type is “SNMP”.