Ad Widget

Collapse

Using server IP instead of HostMetadataItem=system.uname

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abel5405
    Member
    • Jan 2019
    • 47

    #1

    Using server IP instead of HostMetadataItem=system.uname

    Greetings All,
    I was wondering if there was a way for Zabbix to use the IP of a Windows server in Zabbix instead of the host name, is that possible with out adding it manually? In the agent conf file it uses HostMetadataItem=system.uname but would like for it to be like HostMetadataItem=system.ip or something like that. Any help would be greatly appreciated.

    v/r
    Chris
  • Twikki
    Junior Member
    • Mar 2019
    • 2

    #2
    Hey Abel,

    Do you mean how the Zabbix server / proxy connects to the Windows server?

    Go to Configuration -> Host and pick the Windows server you are looking for. the option "Connect to" chooses wether it should attempt to connect via the IP address or DNS name. Default it looks like it picks the IP.

    My hosts are automatically added in Zabbix after I install the agent on the Windows server. I also fill out the Host name just in case I wish to connect via the DNS.

    This is how I install my agents:

    Zabbix related scripts. Contribute to Twikki/Zabbix development by creating an account on GitHub.

    Comment

    • abel5405
      Member
      • Jan 2019
      • 47

      #3
      Originally posted by Twikki
      Hey Abel,

      Do you mean how the Zabbix server / proxy connects to the Windows server?

      Go to Configuration -> Host and pick the Windows server you are looking for. the option "Connect to" chooses wether it should attempt to connect via the IP address or DNS name. Default it looks like it picks the IP.

      My hosts are automatically added in Zabbix after I install the agent on the Windows server. I also fill out the Host name just in case I wish to connect via the DNS.

      This is how I install my agents:

      https://github.com/Twikki/Zabbix/blo...ed_Install.ps1
      Thanks Twikki for the response! Actually what I am talking about is when an agent is installed, when it contacts the Zabbix server it registers in Zabbix by it's netbios name or FQDN. I was hoping that there was a way to have the host register in Zabbix by it's IP. Hope I am making sense.

      v/r
      Chris

      Comment

      • dbatechnologies
        Junior Member
        • Dec 2014
        • 11

        #4
        I was thinking about this and came to such solution:
        in zabbix_agentd.conf you need to define user parameter:

        Code:
        UserParameter=system.ip,for /f "tokens=14 delims= " %F in ('ipconfig ^| findstr /i "IPv4 Address" ^| findstr /r "[0-9]$"') do @echo[/USER] %~F
        then use this parameter in
        Code:
        HostMetadataItem=system.ip
        I have test this with zabbix_get but didn't with HostMetadataItem.

        You must be aware though, that ipconfig on older windows versions present IP in a line with different header, like IP Address. IPv4 Address is in Windows 10 and in Windows Server 2016. You also need to think about the situation, when there are more network adapters on the server and more IP addresses.

        Hope I could help a bit.
        Last edited by dbatechnologies; 22-03-2019, 14:17.

        Comment

        • abel5405
          Member
          • Jan 2019
          • 47

          #5
          Originally posted by dbatechnologies
          I was thinking about this and came to such solution:
          in zabbix_agentd.conf you need to define user parameter:

          Code:
          UserParameter=system.ip,for /f "tokens=14 delims= " %F in ('ipconfig ^| findstr /i "IPv4 Address" ^| findstr /r "[0-9]$"') do @echo[/USER] %~F
          then use this parameter in
          Code:
          HostMetadataItem=system.ip
          I have test this with zabbix_get but didn't with HostMetadataItem.

          You must be aware though, that ipconfig on older windows versions present IP in a line with different header, like IP Address. IPv4 Address is in Windows 10 and in Windows Server 2016. You also need to think about the situation, when there are more network adapters on the server and more IP addresses.

          Hope I could help a bit.
          I will definitely check this out and play with it. Many many thanks for your help!!!

          Comment

          • dbatechnologies
            Junior Member
            • Dec 2014
            • 11

            #6
            Ohhh - remove that [/USER] from echo. It was added by forum editor and I didn't notice it.

            Comment

            • abel5405
              Member
              • Jan 2019
              • 47

              #7
              Originally posted by dbatechnologies
              Ohhh - remove that [/USER] from echo. It was added by forum editor and I didn't notice it.
              Yup, caught that, no worries. I tried the user parameter in the HostMetadataItem but no joy. The box was not register by IP or System Name unfortunately. We may have to do this manually, i.e. load the agent then add the host manually. Many thanks though for your help!

              Comment

              • dbatechnologies
                Junior Member
                • Dec 2014
                • 11

                #8
                Probably agent itself limitation, not to use UserParameter in its own parameters.
                But, registering servers by their IPs has its own limitations as well - one of it is, that if IP of the box will change, you would have new server registered. For standard method, registering with the name, new IP will be registered as the second IP for the server. You can then decided which one should be used.

                Comment

                • abel5405
                  Member
                  • Jan 2019
                  • 47

                  #9
                  Originally posted by dbatechnologies
                  Probably agent itself limitation, not to use UserParameter in its own parameters.
                  But, registering servers by their IPs has its own limitations as well - one of it is, that if IP of the box will change, you would have new server registered. For standard method, registering with the name, new IP will be registered as the second IP for the server. You can then decided which one should be used.
                  Understood, I have a customer that will be using Zabbix and he lists his servers in our current monitoring tool by IP. They find it easier to cope with then server names. Many thanks for all your help and time in answering my Post. I most appreciate it.

                  Comment

                  Working...