Ad Widget

Collapse

Visible Name value on Auto Registration hosts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • high-t
    Member
    • Dec 2014
    • 68

    #1

    Visible Name value on Auto Registration hosts

    Hi.

    I have an AWS Auto-Scaling-Group configuration, which automatically launch servers from time to time. As the servers launch with Active Agents, it auto-register hosts with no problem.

    The servers are using "HostnameItem=system.hostname" to register with its designated hostname. However, I sometime find myself with a list of servers which I can't relate to their application role, so I'd like to set the Visible Name field to be a mix of the server's role and its IP address. For example: "web-10.0.0.1" , "elasticsearch-192.169.10.10", etc...

    Any idea how can that be arranged?

    Thank you in advance!
  • kloczek
    Senior Member
    • Jun 2006
    • 1771

    #2
    Originally posted by high-t
    The servers are using "HostnameItem=system.hostname" to register with its designated hostname. However, I sometime find myself with a list of servers which I can't relate to their application role, so I'd like to set the Visible Name field to be a mix of the server's role and its IP address. For example: "web-10.0.0.1" , "elasticsearch-192.169.10.10", etc...

    Any idea how can that be arranged?
    First: HostnameItem=system.hostname is part of the default configuration

    Second: if you will setup hostname to for example: "web-10.0.0.1" , "elasticsearch-192.169.10.10" and after you will start agent you will have exactly what you want.
    Additionally after login on the host you will see in shell prompt hostname informing you that you are on web or elasticsearch host.
    Setting up prefix or suffix of the hostname on boot stage using AWS host tags is implemented in aws tools and such way of of setting hostnames is very popular. You can inject web or elasticsearch prefix in cloud formation script.
    Conclusion: you don't need to fiddle around visible hostname in zabbix
    http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
    https://kloczek.wordpress.com/
    zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
    My zabbix templates https://github.com/kloczek/zabbix-templates

    Comment

    • tflu
      Junior Member
      • Apr 2016
      • 1

      #3
      Same issue

      Thanks for the response but I am dealing with the same problem. Updating the hostnames would be perfect option but not currently an option for us. We have the AWS hostnames written into our orchestration and scaling. This would not be easy to change.

      It would be nice to have a option in the zabbix_agentd.conf for visible name. I even tried mapping an inventory item into the visible name but it appears you can't use macros in the visible name field, for example {INVENTORY.ALIAS}.

      I also tried setting an alias in the zabbix_agentd.conf. This alias will work for new items (which can also be mapped back to an inventory item) but not in the visible name field.

      Anyway I can use the zabbix_agentd.conf to populate the visible name would be preferable. We are using Ansible/Jinja2 to template the conf file. I can use any number of server or ec2 facts to template the conf file. The idea would be to use AWS instance tags in our case.

      Any other suggestions besides changing all our hostnames?

      Comment

      • z3t4
        Junior Member
        • Aug 2017
        • 1

        #4
        This may help:

        HostnameItem=system.run[echo $(zh=$(hostname) && echo prefix-$zh)]

        Comment

        Working...