Ad Widget

Collapse

Discovery of host interfaces in Zabbix for linux host

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mbld
    Junior Member
    • Apr 2024
    • 3

    #1

    Discovery of host interfaces in Zabbix for linux host


    Hello,

    I am new to zabbix and I could need some help on this documentation :


    I am trying to get informations from a linux server (Debian 10) : All of the host's configured interfaces (name +IP).

    As Zabbix retrieves the IP of each host, it is only the IP of which the agent is configured to listen on.
    I am looking for a way to get the same result as "net.if.list" but this is only available for windows hosts.

    I tried to make a new template in which I have only created a discovery rule. In this discovery rule I have set it up like this :

    Type : Zabbix Agent
    Key : zabbix[host,discovery,interfaces]

    I have tried to test this discovery rule on a linux host with it's IP and the default zabbix agent port.
    The result of the test is the following : Unsupported item key

    The zabbix server version is 6.0, the targeted host is already monitored in Zabbix and by its default port.

    Is it possible that something is missing on the server ?

    If I cannot use that builtin zabbix discovery key, should scripting be involved for fetching a JSON ?

    Thanks

  • Answer selected by mbld at 22-05-2024, 13:38.
    mbld
    Junior Member
    • Apr 2024
    • 3

    Hello

    I am happy to say I have found a way to achieve what I was looking for.

    I followed this doc : https://www.zabbix.com/documentation...xtending_agent


    Click image for larger version

Name:	image.png
Views:	336
Size:	42.8 KB
ID:	484272

    And I configured my zabbix agent on the monitored machine to have custom keys for what I am looking for.
    /etc/zabbix/zabbix_agentd.conf
    ####### USER-DEFINED MONITORED PARAMETERS #######

    UserParameter=ip.allinterfaces,ip -br -f inet addr | awk '{print $1, $3}'
    UserParameter=lsof.listeningservice,lsof -i -P -n | grep LISTEN | awk '{print $1, $9}'

    Comment

    • cyber
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2006
      • 4807

      #2
      Whats wrong with manual? https://www.zabbix.com/documentation...t#network-data
      net.if.discovery
      List of network interfaces. Used for low-level discovery.

      Comment

      • mbld
        Junior Member
        • Apr 2024
        • 3

        #3
        Hello Cyber,

        net.if.discovery would output something like this :
        [{"{#IFNAME}":"lo"},{"{#IFNAME}":"enp1s0f0"},{"{ #IF NAME}":"enp1s0f1"}]

        It's almost what I want, there are the interfaces but no IP addr associated to them shown.

        I made a little bit of research and found that ticket, which is the feature I'm exactly looking for :


        It seems like this feature was never added to Zabbix and the author of this ticket is inactive since 2016.

        It would be nice to rely on Zabbix for this purpose in a simple way, how would it be like ?

        Comment

        • mbld
          Junior Member
          • Apr 2024
          • 3

          #4
          Hello

          I am happy to say I have found a way to achieve what I was looking for.

          I followed this doc : https://www.zabbix.com/documentation...xtending_agent


          Click image for larger version

Name:	image.png
Views:	336
Size:	42.8 KB
ID:	484272

          And I configured my zabbix agent on the monitored machine to have custom keys for what I am looking for.
          /etc/zabbix/zabbix_agentd.conf
          ####### USER-DEFINED MONITORED PARAMETERS #######

          UserParameter=ip.allinterfaces,ip -br -f inet addr | awk '{print $1, $3}'
          UserParameter=lsof.listeningservice,lsof -i -P -n | grep LISTEN | awk '{print $1, $9}'

          Comment

          Working...