Ad Widget

Collapse

Two entries in agent Server plus autoregistration equals duplicate hosts?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • keitht
    Junior Member
    • Feb 2021
    • 12

    #1

    Two entries in agent Server plus autoregistration equals duplicate hosts?

    My shared agent config file has two entries listed for Server. The two entries point to the same zabbix server, one as the ip address and one as the hostname. I also have autoregistration configured. If I start a new host with this config, autoregistration will create two hosts in zabbix. If I manually remove one of them, it does not come back. Is there a way to prevent this from happening?
    Thanks
    Keith
  • keitht
    Junior Member
    • Feb 2021
    • 12

    #2
    There are multiple routes to some of the hosts. For those hosts, the server hostname resolves to the public ip address, but I'd like the traffic to go over the private network. The easiest way to do this was to put the private ip address in the Server field. In addition, I want to use one agent config file that can be deployed to all the hosts. This is why there's two entries in the Server field, with both entries being the same server. For some of the hosts, the hostname resolves to the private ip address. While I don't have anything right now, it is likely there will be some external hosts communicating to the zabbix server via the public ip address. As I'm replying, I'm wondering if all the monitoring data is being sent twice or just the initial communication / registration.

    Zabbix definitely creates two hosts, with the same hostname and ip address, but a different hostid.

    Comment

    • keitht
      Junior Member
      • Feb 2021
      • 12

      #3
      Thanks, and you're correct. Being a new zabbix user, I mixed up the terms and meant to say ServerActive. I was hoping to avoid multiple configs, but I can live with that.

      I'm still a bit surprised that it created two hosts with the same name. Something else I noticed that seemed similar, if I edit the hostname field for a host that was autoregistered, the host will be autoregistered again, as another host, with the original hostname.

      Comment

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

        #4
        Why you need one server described twice? Leave one (IP) and your problem is solved.
        Reading docs shows "Multiple comma-delimited addresses can be provided to use several independent Zabbix servers in parallel" ... so agent takes both entries separately and makes 2 calls. one by IP, one by name... ending up in same server.

        Next question is, how it manages to create 2 identical hosts... As hostname is unique thing, it should get error when creating second one... But I am not able to answer that...

        Comment

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

          #5
          Whatever you have on Server field only defines from where queries against agent can come, basically means, which hosts can do passive checks. But... this is not affecting autoregistration and host creation, that needs active agent conf. If your server turns to those hosts using its private IP (SourceIP parameter in Server config), no need to keep that hostname there.

          If you use autoregistration, that means you also have ServerActive parameter there. Which tells agent, where to turn to get its config for active checks. If you leave just private IP there, all comms should go over that. It will not do any IP to name lookup there, just turns to that private IP.
          If you have internal and external agents, I would keep configs separated.

          Comment

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

            #6
            Hostname is unique. If you change it, autoregistration will create new one, as it is unable to find that host.
            As I said before, I cannot explain, why you get 2 identical ones... hostname should be unique (considering case sensitivity also), it should not happen.

            Comment

            Working...