Ad Widget

Collapse

Auto Registration using DNS Name

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lpn90
    Junior Member
    • Jul 2015
    • 8

    #1

    Auto Registration using DNS Name

    Good morning people,

    I would like to implement a patch on Zabbix here on business, but I never realized the implementation of a so I do not know what to do. Below is a link where I found the patch, it is for the action Auto Registration him fill the DNS Name field instead of using the IP, as this will greatly facilitate my life here in the company.



    Or if anyone knows another way to automate this (from the self registration go straight through the DNS name instead of the IP) would help a lot.

    Configuration:
    Zabbix: 2.4.5
    S.O .: CentOS 6.5
  • LenR
    Senior Member
    • Sep 2009
    • 1005

    #2
    We use auto registration and our Linux build process ensures that the zabbix_agentd.conf file has the DNS name.

    We use puppet/Foreman, but there are other ways.

    There is a powershell hack for Windows that puts the FQDN in hostnameitem, you might be able to do similar for Linux.

    See https://www.zabbix.org/wiki/Docs/howto/fqdn-windows

    Comment

    • safpsr
      Member
      • Aug 2007
      • 70

      #3
      Hi,

      Did you try some thing like that in zabbix_agentd.conf file:

      HostnameItem=system.run[hostname |awk -F. '{print $1}' |tr 'A-Z' 'a-z']
      or
      HostnameItem=system.run[grep "domain_name" /etc/hosts | head -1 | sed -re 's/ /\n/g' | uniq | awk -F. '/domain_name/ {print $1}' | tr 'A-Z' 'a-z']
      or something like that (not tested)
      HostnameItem=system.run[nslookup ip_address | awk -F= '/name/ {print $2}']

      Regards
      Last edited by safpsr; 05-10-2015, 15:30.

      Comment

      • lpn90
        Junior Member
        • Jul 2015
        • 8

        #4
        Hi safpsr,

        I tried to put the hostname manually and it does not populate the DNS Name field. I would also like to be able to automate put Zabbix monitoring by DNS name instead of the IP. Do I not fill the field might have something to do with my reverse DNS?

        Comment

        • safpsr
          Member
          • Aug 2007
          • 70

          #5
          Hi,

          When the auto registration is done, does the field DNS name filled up ? And the IP address too ?
          Does the hostname identical to the DNS name ?
          If both fileds are filled up, the problem is that the Connect to field is set to IP insted of DNS.

          In this case, for me the solution is:

          1) add an operation in auto-registration process to run a script on Zabbix server. For ex.:


          2) Write a script using API to change the Connect to value from IP to DNS with the hostinterface.update command ( https://www.zabbix.com/documentation...terface/update and useip parameter ( https://www.zabbix.com/documentation...terface/object )


          Writing API script is not so easy but you can find some samples on the forum, or this one: https://github.com/baniuyao/ZabbixPythonApi

          Comment

          • lpn90
            Junior Member
            • Jul 2015
            • 8

            #6
            Hi,

            I'll try to see if I can do something related to Zabbix API, but thank you for safpsr tips.

            Comment

            • rb1980
              Junior Member
              • May 2013
              • 7

              #7
              easy solution

              Take a look at:

              Comment

              Working...