Ad Widget

Collapse

get hostname dynamically from computer name

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • westwind
    Junior Member
    • Mar 2013
    • 21

    #1

    get hostname dynamically from computer name

    Hi,
    Have someone ever tried to let the conf file of the active agent learning the hostname dynamically from the windows computer name ?
    I've already set it manually in the server.
    This would be very helpful because we don't have to edit the conf file everytime we install the agent. So I want to make a standard conf file for all my windows machines.

    any idea ?

    thanks
  • neogan
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2011
    • 118

    #2
    Hi,
    Do you look at puppet? or script throw AD group policy?

    Comment

    • tchjts1
      Senior Member
      • May 2008
      • 1605

      #3
      We use auto-registration for this purpose. It is a feature of the 2.x release.
      We deploy a standard zabbix_agentd.conf file to all Windows servers, leaving the Hostname= field blank, and it self-registers into the Zabbix frontend.

      Comment

      • westwind
        Junior Member
        • Mar 2013
        • 21

        #4
        @tchjts1
        what you mentioned is interesting to be aware of. I'm going to try it soon. thank you.
        but right now I'm looking for a hint helping me to read the computer name off from windows and assign it to the hostname of the agent.

        @neogan
        It's totally not necessary to make a vbscript for that.

        I tried this:
        hostname=computer.name
        It didn't work.

        Comment

        • tchjts1
          Senior Member
          • May 2008
          • 1605

          #5
          Originally posted by westwind
          @tchjts1
          what you mentioned is interesting to be aware of. I'm going to try it soon. thank you.
          but right now I'm looking for a hint helping me to read the computer name off from windows and assign it to the hostname of the agent.
          I guess I am confused on what you are trying to do. The purpose of populating Hostname= is so the agent identifies itself to Zabbix server. Using auto-registration, that is exactly what happens, without it actually putting any value in Hostname=

          It reads the Server name of the Windows box and places that in the Zabbix frontend. If you are looking to deploy a standard zabbix_agentd.conf file without having to manage Hostname= on every server... auto-registration is the way to do it. You don't need to manually make any entries in Zabbix frontend. Auto-registration does that for you.

          If you actually need to see a value in zabbix_agentd.conf Hostname= field, it does not do that.

          Comment

          • westwind
            Junior Member
            • Mar 2013
            • 21

            #6
            Are there any disadvantages with using auto-reg ? are there any restrictions ?
            because we've got 3000 windows boxes in zabbix and enough zabbix experts watching them, no one has ever suggested auto-reg.
            there are probably some drawbacks qua access control or something else,
            I think.

            Comment

            • tchjts1
              Senior Member
              • May 2008
              • 1605

              #7
              Auto-reg is new, beginning with the 2.x releases.

              For it to work, you obviously need Zabbix server and agents to be at that level, and you need to have at least 1 item set as an active agent item.

              It actually works quite beautifully. There is one scenario that can be a bit annoying if you use Zabbix proxies and you move large groups of hosts from proxy to proxy. But that only plays out if you are set up like I am, to where you receive an e-mail for any hosts that auto-register.

              Other than that minor annoyance, I can't think of any drawbacks.

              I can tell you it is much easier to deploy one standard zabbix_agentd.conf file out to your clients, than to try and manage them individually.

              Comment

              • westwind
                Junior Member
                • Mar 2013
                • 21

                #8
                Originally posted by tchjts1
                Auto-reg is new, beginning with the 2.x releases.

                For it to work, you obviously need Zabbix server and agents to be at that level, and you need to have at least 1 item set as an active agent item.

                It actually works quite beautifully. There is one scenario that can be a bit annoying if you use Zabbix proxies and you move large groups of hosts from proxy to proxy. But that only plays out if you are set up like I am, to where you receive an e-mail for any hosts that auto-register.

                Other than that minor annoyance, I can't think of any drawbacks.
                This is something enthusiastic. I'm gonna discuss that with our zabbix expert. then I'll feedback any interesting things.

                Originally posted by tchjts1
                I can tell you it is much easier to deploy one standard zabbix_agentd.conf file out to your clients, than to try and manage them individually.
                this is my point too. but I want it through other way... reading off windows box's name.

                any way, thank you for concern.

                Comment

                • rlangle
                  Junior Member
                  • May 2013
                  • 10

                  #9
                  I understand that autoreg comes in v2.0. But we're currently at v1.8, we will probably upgrade soon, but in the interim is there another way?

                  I have tried
                  hostname = %computername%
                  Did not work

                  Comment

                  • Alexei
                    Founder, CEO
                    Zabbix Certified Trainer
                    Zabbix Certified SpecialistZabbix Certified Professional
                    • Sep 2004
                    • 5654

                    #10
                    I believe a combination of HostnameItem with user parameter returning windows computer name is what you need.
                    Alexei Vladishev
                    Creator of Zabbix, Product manager
                    New York | Tokyo | Riga
                    My Twitter

                    Comment

                    • rlangle
                      Junior Member
                      • May 2013
                      • 10

                      #11
                      Originally posted by Alexei
                      I believe a combination of HostnameItem with user parameter returning windows computer name is what you need.
                      I have tried hostname=%computername%
                      without success
                      Is this the right syntax?

                      Tx

                      Rob

                      Comment

                      Working...