Ad Widget

Collapse

Use of Hostname instead of IP to identify hosts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • myRCzabbix
    Member
    • Jun 2018
    • 39

    #1

    Use of Hostname instead of IP to identify hosts

    So continuing on my SNMP journey, is there a way to populate the HOSTNAME field in the host tab with the hostname (taken from SNMP) rather than the IP that was discovered? As can be seen from the series of screenshots attached, the IP is used in the Problem widget which makes it hard to identify the host immediately. The only way to make it display the HOSTNAME is to populate the Host Name field in the host tab. But when using discovery with SNMP (we can't install agents on these devices), it uses the IP instead. I've already tried putting the SNMP sysName.0 OID as part of the checks during discovery and even selected it as the uniqueness criteria but no go.

    The manual also does not mention anything in the configuring hosts section.


    Click image for larger version

Name:	Untitled.png
Views:	8022
Size:	161.2 KB
ID:	361979
  • kloczek
    Senior Member
    • Jun 2006
    • 1771

    #2
    Originally posted by myRCzabbix
    So continuing on my SNMP journey, is there a way to populate the HOSTNAME field in the host tab with the hostname (taken from SNMP) rather than the IP that was discovered?
    Don't get me wrong but usually it is possible to handle such things by proper DNS registration and switching to use DNS name instead use IP in host interface.
    http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
    https://kloczek.wordpress.com/
    zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
    My zabbix templates https://github.com/kloczek/zabbix-templates

    Comment

    • myRCzabbix
      Member
      • Jun 2018
      • 39

      #3
      Originally posted by kloczek
      Don't get me wrong but usually it is possible to handle such things by proper DNS registration and switching to use DNS name instead use IP in host interface.
      No offense taken. :-)

      For purposes of taking the screenshot, I changed the hostname to a non DNS registered name. However, the original hostname *WAS* registered in our DNS which is why I was curious why it was still showing up as an IP in the Problem widget.

      So, I take it then that under normal circumstances, the IPs would be resolved by the system? If so, then I need to check why it's not being resolved in my case. Thanks kloczek!

      Comment

      • myRCzabbix
        Member
        • Jun 2018
        • 39

        #4
        OK, I've checked and the Zabbix server can resolve the IP to a hostname. As an experiment, a server that was showing with the hostname in the Problems widget was edited to only contain the IP address and as soon as I did that, the IP address showed up instead of the hostname in the Problems widget. This leads me to believe that when creating the host record, we MUST put the real hostname in the Host Name field. So I am back to my original question ... if we are using SNMP to discover these hosts, how do we auto-populate the Host Name field from the SNMP OID?

        Click image for larger version

Name:	Untitled.png
Views:	7108
Size:	134.0 KB
ID:	362050

        Comment

        • Linwood
          Senior Member
          • Dec 2013
          • 398

          #5
          Note when they say DNS set up, be sure that the REVERSE zones (PTR zones) are also set up before you discover a host.

          Comment

          • kloczek
            Senior Member
            • Jun 2006
            • 1771

            #6
            Originally posted by Linwood
            Note when they say DNS set up, be sure that the REVERSE zones (PTR zones) are also set up before you discover a host.
            Exactly.
            I'm not using now discovery but IIRC still is the issue that the host is discovered always is added with active IP not DNS however if rev DNS is correctly added visual name at least is added based on PTR record.
            Similar issue is with autoregistrationa but in this case it i possible to alter name of the added host using Hostname or HostnameItem agent settings however in added host interface active is IP (not DNS).

            PS. Registering discovered or autoregistered host with active DNS part of the host interface is long time well known issue (+9y). It is still not solved because long queue of more important things to do. However if someone will pay/sponsor implement of such functionality I'm almost sure that Alexei will find someone contractor developer to implement this.
            http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
            https://kloczek.wordpress.com/
            zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
            My zabbix templates https://github.com/kloczek/zabbix-templates

            Comment

            • myRCzabbix
              Member
              • Jun 2018
              • 39

              #7
              Originally posted by Linwood
              Note when they say DNS set up, be sure that the REVERSE zones (PTR zones) are also set up before you discover a host.
              My apologies if the screenshots above were too small but yes, I have checked both forward and reverse are working ... anyway, thanks for confirming that it should be working without me having to manually assign it (that's good news to me given that we've over 100+ nodes to monitor and only me to add them :-) having to go edit each host record was not very appealing). I just need to find what's wrong in my config that's preventing it. At least now with your help it's been narrowed down to just the DNS.

              Click image for larger version

Name:	Untitled1.png
Views:	7123
Size:	19.2 KB
ID:	362061

              Comment

              • kloczek
                Senior Member
                • Jun 2006
                • 1771

                #8
                Originally posted by myRCzabbix
                anyway, thanks for confirming that it should be working without me having to manually assign it (that's good news to me given that we've over 100+ nodes to monitor and only me to add them :-) having to go edit each host record was not very appealing). I just need to find what's wrong in my config that's preventing it. At least now with your help it's been narrowed down to just the DNS.
                If it doesn't work I think that you should open ticket on support.zabbix.com.
                As I wrote use as primary in host interface DNS instead IP it is another story. but IMO at least putting in visible name in case of discovered host with only SNMP items should be working.
                If in case host with only SNMP interface it does not work it will be probably the same issue in case of host with JMX and ODBC, telnet and ssh items.
                Just to be sure .. can you c&p discovery action definition? (as test not the picture this time)
                http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
                https://kloczek.wordpress.com/
                zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
                My zabbix templates https://github.com/kloczek/zabbix-templates

                Comment

                • myRCzabbix
                  Member
                  • Jun 2018
                  • 39

                  #9
                  OK, just to close the loop on this one ... it's confirmed that the discovery process in 3.4 *WILL* populate the Host Name field with the DNS hostname taken from a PTR lookup.

                  I never got to the root cause of why it didn't work on mine. As I couldn't find any issues with our DNS config and suspecting a misconfig on the Zabbix server, I decided to restore a snapshot of the VM taken right after I installed Zabbix but before I did any initial configuration changes to it. It worked perfectly this time.

                  Click image for larger version

Name:	Untitled.png
Views:	7001
Size:	71.0 KB
ID:	362153

                  Thanks to kloczek and Linwood for the help.

                  Comment

                  Working...