Ad Widget

Collapse

Zabbix Agent 4.4 for Windows

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • coffeejunkie
    Junior Member
    • Aug 2018
    • 11

    #1

    Zabbix Agent 4.4 for Windows

    Hi Guys,

    In version 3.4 I was using
    HostnameItem=system.run[powershell -NonInteractive "[System.Net.Dns]::GetHostByName(($env:computerName)).Hostname.toLo wer()"]

    go get the FQDN of the system for autoregistration.
    In Windows Agent Version 4.4 the same command is not working anymore. It drops an
    zabbix_agentd.exe [10812]: Warning: failed to get system hostname from [system.run[powershell -NonInteractive "[System.Net.Dns]::GetHostByName(($env:computerName)).Hostname.toLo wer()"]])
    zabbix_agentd.exe [10812]: ERROR: "Hostname" configuration parameter is not defined


    It looks like the system.run command is broken, even though it is documented here: https://www.zabbix.com/documentation...bix_agentd_win
    Is there another trick to get the FQDN for autoregistration?
    BTW: manual configuration is not possible. The OS is automatically deployed from a 3rd party software.


    // coffeejunkie
  • Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1782

    #2
    Hi, since I'm not very familiar with powershell scripts, can you clarify, how that command should work?

    Code:
    PS [hostname: T540P] C:\> powershell -NonInteractive "[System.Net.Dns]::GetHostByName(($env:computerName)).Hostname.toLower()"
    T540P : The term 'T540P' is not recognized as the name of a cmdlet, function, script file, or operable program. Check t
    he spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:34
    + [System.Net.Dns]::GetHostByName((T540P)).Hostname.toLower()
    +                                  ~~~~~
        + CategoryInfo          : ObjectNotFound: (T540P:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    
    PS [hostname: T540P] C:\>
    Edit: Ah, I see, I should run it in cmd:

    Code:
    C:\>powershell -NonInteractive "[System.Net.Dns]::GetHostByName(($env:computerName)).Hostname.toLower()"
    t540p
    
    C:\>
    Markku
    Last edited by Markku; 29-01-2020, 19:42.

    Comment

    • Markku
      Senior Member
      Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
      • Sep 2018
      • 1782

      #3
      For me it looks like this (= just like you described, works with 3.4.x, not working in 4.4.4), with the same HostnameItem setting on both files:

      Code:
      C:\zabbix>bin\win64\zabbix_agentd.exe --config conf\zabbix_agentd.win.conf -f
      Starting Zabbix Agent [windows8]. Zabbix 3.4.0 (revision 71462).
      Press Ctrl+C to exit.
      
      
      C:\zabbix>cd "\Program Files\Zabbix Agent"
      
      C:\Program Files\Zabbix Agent>zabbix_agentd.exe --config zabbix_agentd.conf -f
      zabbix_agentd.exe [3116]: Warning: failed to get system hostname from [system.run[powershell -NonInteractive "[System.Net.Dns]::GetHostByName(($env:computerName)).Hostname.toLower()"]])
      zabbix_agentd.exe [3116]: ERROR: "Hostname" configuration parameter is not defined
      
      C:\Program Files\Zabbix Agent>zabbix_agentd.exe --version
      zabbix_agentd Win64 (service) (Zabbix) 4.4.4
      I believe you could open a bug ticket in https://support.zabbix.com/ to get a definitive answer if this is by design for some reason.

      Markku

      Comment

      • coffeejunkie
        Junior Member
        • Aug 2018
        • 11

        #4
        Thanks folks,

        created an issue:

        Comment

        • Markku
          Senior Member
          Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
          • Sep 2018
          • 1782

          #5
          I don't know, but it does not provide the same output as the original command. coffeejunkie can of course comment on the requirements.

          Adding -command did not make any difference here.

          Markku

          Comment

          • Markku
            Senior Member
            Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
            • Sep 2018
            • 1782

            #6
            There is an explicit "." (dot), so that is printed in any case. In the original command it is not printed unless needed (see the outputs in #2 and #3, they are without dots). Maybe that's important, maybe not, but different output anyway.

            Markku

            Comment

            Working...