Ad Widget

Collapse

Zabbix - Updating 1000+ host names en mass

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • EdwardA
    Junior Member
    • Mar 2019
    • 1

    #1

    Zabbix - Updating 1000+ host names en mass

    So I have Zabbix monitoring something close to 8.5k hosts right now, I need to take a certain host group and go through and update each individual host name. e.g. I have hosts that are numbered "0001" "0002" etc, I want to update the host names with "New York City - 0001", "Atlanta - 0002" so on and so forth.

    I have all of my data compiled in an excel file right now but I am just wondering what the best approach for this would be, obviously an xml import is what im going to do but what is the best way to take my csv of data I have already and combine it with the host data for xml import

    Any help is appreciated even if it just gets me looking in the right direction

    Thank you
  • max.ch.88
    Senior Member
    • Oct 2018
    • 206

    #2
    I would do it using DBMS capabilities. I think 8.5K hosts are too much for Zabbix API.

    Comment

    • kloczek
      Senior Member
      • Jun 2006
      • 1771

      #3
      Prepare two lists. One with old names and second one with new names. Than using zabbix API change all names in the loop one by one.
      Make the decision are you going to change only visible hostname or that name which is use by agent (in second variant you need to change all names on agents as well).
      I would not recommend to do this as one transaction because each such operation by some data and metadata stored in zabbix db stops incommoded monitoring data ingestion, so doing this host by host will allow process all incoming data without long interruption.

      You need to use API described here https://www.zabbix.com/documentation...ce/host/update
      You can use my zapish (or any other zabbix api binding which you like) to write short script wit that API call.
      Just try to have look on example which dumps in the loop all used in zabbix templates into separated xml files https://github.com/kloczek/zapish/bl..._all_templates


      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

      • kloczek
        Senior Member
        • Jun 2006
        • 1771

        #4
        Originally posted by max.ch.88
        I would do it using DBMS capabilities. I think 8.5K hosts are too much for Zabbix API.
        Fiddling into zabbix db content always is risky as none of the other zabbix processes knows that some changes in the database are done.
        Zabbix API call will take only a bit longer than straight DB update query.
        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

        Working...