Ad Widget

Collapse

Zabbix API - Create Map Link

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fbartolini
    Junior Member
    • Jul 2021
    • 5

    #1

    Zabbix API - Create Map Link

    Hi to everyone,


    I'm trying to automate the creation of zabbix maps, and I couldn't figure out how to create links between two hosts already placed on the map through the API. Does anyone know how to do?
  • Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    #2
    The documentation know:


    Comment

    • fbartolini
      Junior Member
      • Jul 2021
      • 5

      #3
      Thanks for your reply, but I can't figure out from the documentation which is the correct json structure.
      I try to explain better, if it is not clear, my need by making an example:​
      I have a map that already has four hosts on it. Between two of them there is already a link, I have to create a new one on the other two. Is the correct command map.update? and if so, what is the json structure to create the link only?

      Comment

      • markosa
        Senior Member
        Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
        • Aug 2022
        • 104

        #4
        You should read existing links and then add link you need, atleast example below would overwrite existing links. JSON could look like this(three hosts, two links between those):
        Code:
        {
            "jsonrpc": "2.0",
            "method": "map.update",
            "params": {
                "output": "extend",
                "links": [{"selementid1":"13","selementid2":"8"},{"selementid1":"9","selementid2":"8"}],
                "sysmapid":"2"
            },
            "auth": "YOUR API KEY",
            "id": 1
        }​
        This would return hosts and links(selementid) from map with id 2
        Code:
        {
            "jsonrpc": "2.0",
            "method": "map.get",
            "params": {
                "output": "extend",
                "selectSelements": "extend",
                "selectLinks": "extend",
                "sysmapids":"2"
            },
            "auth": "YOUR API KEY",
            "id": 1
        }​
        Last edited by markosa; 03-05-2023, 10:13.

        Comment

        Working...