Ad Widget

Collapse

Using IP to get DNS FQDN Hostname

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tmroberts
    Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Jan 2017
    • 73

    #1

    Using IP to get DNS FQDN Hostname

    I'm fairly new to zabbix so this is probably a lot easier than I am thinking. We currently have our Zabbix environment set up to send the IP and not use DNS. In the in environment that I work in we are using VLAN's that take the internal IP and NAT them to an external IP. Is there any way in the templates to write a macro or something to take the IP it receives and lookup the FQDN of the hostname?

    Example: the following are clones of each other and use different VLAN's. The internal static IP (i.e. 172.16.10.xxx) is the same but the external IP has a different subnet for each (i.e 10.220.yy.xxx).
    test.domain1.com
    test.domain2.com

    Is there a way, maybe with HOST.DNS, to take the IP and do a DNS lookup for the hostname FQDN? If so, how? I've found the macro documentation, but i'm not understanding how to work that into the template.
  • nobodysu
    Member
    • Sep 2016
    • 84

    #2
    You can create an external check:


    This script will print a dns name of an ip:
    Code:
    /usr/bin/host "$1"
    And then you can trigger if host's PTR is not 'example.org':
    Code:
    {Template:dnscheck.sh[{HOST.IP}].regexp(pointer example.org.$)}=0

    Comment

    Working...