Ad Widget

Collapse

Auto Registration adding a host to a host group dynamically based on meta data value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cdslaughter
    Member
    • Jun 2018
    • 69

    #1

    Auto Registration adding a host to a host group dynamically based on meta data value

    I am trying to get a host to be added to the correct hostgroup based on which hostgroupID it provides in the auto registration process.
    I have several hundred hostgroups (so creating a rule for each does not scale well) and all my servers will belong to only 3 of the groups. Two groups are static for all servers, but the 3rd depends on what hostgroupID it returns in the metadata.
    Is there a way to have it dynamically select the host group to add this server to based on the value contained in the host metadata?

    ​​​​​​​Carl Slaughter
  • cdslaughter
    Member
    • Jun 2018
    • 69

    #2
    I have tried to use the run command option to run a script on the zabbix server. I could pass the script the {HOST.METADATA} and {HOST.ID} macros and let it parse the host group ID. The script could then use the API to add the host to the host Group and all would be solved.

    The problem.. When I try and add the script, it automatically adds it to the top of the operations list, this making it the first thing that happens. With this being the case, it cant be passed the {HOST.ID} macro as it has not yet been created.

    Is there a way to move this further down in the list? Otherwise, the entire process of (automagicaly) adding a new host as to be moved to the script and run externally..


    Or am I missing something?

    Carl Slaughter

    Comment

    • cdslaughter
      Member
      • Jun 2018
      • 69

      #3
      Perhaps I can work this a diferent way.
      If more than 1 auto registration rule matches a host,
      will all of them run, or just one?
      If only one, how would it chose which one?
      if all of them are ran, in what order would they be run?

      Carl

      Comment

      Working...