Ad Widget

Collapse

How to properly rename Windows Zabbix agents

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • S771
    Junior Member
    • Jul 2024
    • 6

    #1

    How to properly rename Windows Zabbix agents

    Is there some proper way to update Windows Zabbix agents? I have installed agents with pretty much default settings across entire domain, but in our environment we have multiple domains, and came across problem that when I have same server name in different domains, only the first agent will show up. So I started looking around how to register agents with hostname being FQDN.
    So for example before server was named "CRL", and now it's named "CRL.domain.com" and "CRL.otherdomain.com".

    I simply copied new config file to server with installed Zabbix agent, and only added one line to it:
    HostnameItem=system.run["powershell -NonInteractive "[System.Net.Dns]::GetHostByName(($env:computerName)).Hostname.ToLo wer()""]

    After restarting the Zabbix agent, it's now registered with FQDN, but there is old hostname showing in my host list.
    So now I have both CRL and CRL.domain.com in list of hosts.

    Is there any better way to change hostnames of all already installed Windows agents from default hostname to FQDN, without having to worry about duplicates?
  • Daniel4711
    Senior Member
    • Jul 2014
    • 126

    #2
    haven't worked with the Zabbix API yet... but you could do the following:
    Create a powershell script with a foreach loop for all servers which:
    1. stops the service on the server
    2. replaces the config file.
    3. reconfigures the server name in Zabbix via API
    4. restarts the service on the server.

    Alternatively, you can pause manual after point 2, change the name in Zabbix and then restart the service.

    Otherwise I have no idea either.
    I had something similar in my area once... it was just 30 minutes of manual work.​

    Comment

    Working...