Ad Widget

Collapse

update map through API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • focar
    Junior Member
    • Dec 2023
    • 17

    #1

    update map through API

    Hello,

    I have a script that my colleagues and I use for adding hosts to Zabbix. The script prompts for specific host details and then uses the API to create or update hosts and groups based on user input.

    Now, I want to extend its functionality to handle maps. Currently, the script can create a map for a specific group. My next goal is to add hosts (selements) to an existing map.

    The challenge I'm facing is that when I use the selements block, it overwrites all existing selements in the map instead of adding new ones. which is indeed logical when looking at the existing API-methods

    Is there a way to update a map via the API to add new selements without overwriting the existing ones? I thought about retrieving the current map with map.get first, but I believe that approach might only allow updating existing selements rather than adding new ones.

    Any suggestions or alternative methods to achieve this would be greatly appreciated.

    Thank you!
  • Brambo
    Senior Member
    • Jul 2023
    • 245

    #2
    First get the current map, process it and add your element(s) and than push the entire map. I think that is the only way to do it. How to do this code wise you have to figure out yourself but with help of ChatGPT / copilot it can be done.
    I used these 'agents' to get a dashboard download/ upload / copy script which saves tons of time when you only have to change a host group value instead of building it completely from scratch

    Comment

    • focar
      Junior Member
      • Dec 2023
      • 17

      #3
      Hi Brambo
      Thanks for your reply. yeah... i also thought this might be the only way. Would be a nice feature though, something like map.add
      thx

      Comment

      Working...