Ad Widget

Collapse

Zabbix API macro expansion in map selement label

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • marchezz
    Junior Member
    • Apr 2014
    • 2

    #1

    Zabbix API macro expansion in map selement label

    Hi everyone,

    When retrieving data relative to a map using Zabbix JSON API with selectSelements: "extend", is there a way to tell Zabbix to perform macro expansion on the "label" field before sending back the resulting JSON?

    Example request:
    Code:
    {
        "jsonrpc": "2.0",
        "method": "map.get",
        "params": {
            "output": "extend",
            "selectSelements": "extend",
            "sysmapids": "3"
        },
        "auth": my_auth_code,
        "id": 1
    }
    Possible response:
    Code:
    {
        "jsonrpc": "2.0",
        "result": [
            {
                "selements": [
                    {
                        "selementid": "10",
                        "sysmapid": "3",
                        "elementid": "0",
                        "elementtype": "4",
                        "iconid_off": "1",
                        "iconid_on": "0",
                        "label": [B][U]"{HOST.NAME}\n[{HOST.CONN}]"[/U][/B],
                        "label_location": "3",
                        "x": "11",
                        "y": "141",
                        "iconid_disabled": "0",
                        "iconid_maintenance": "0",
                        "elementsubtype": "0",
                        "areatype": "0",
                        "width": "200",
                        "height": "200",
                        "viewtype": "0",
                        "use_iconmap": "1",
                        "urls": []
                    }
                ],
                "urls": [],
                "sysmapid": "3",
                "name": "Local nerwork",
                "width": "400",
                "height": "400",
                "backgroundid": "0",
                "label_type": "2",
                "label_location": "3",
                "highlight": "1",
                "expandproblem": "1",
                "markelements": "0",
                "show_unack": "0",
                "grid_size": "50",
                "grid_show": "1",
                "grid_align": "1",
                "label_format": "0",
                "label_type_host": "2",
                "label_type_hostgroup": "2",
                "label_type_trigger": "2",
                "label_type_map": "2",
                "label_type_image": "2",
                "label_string_host": "",
                "label_string_hostgroup": "",
                "label_string_trigger": "",
                "label_string_map": "",
                "label_string_image": "",
                "iconmapid": "0",
                "expand_macros": "0"
            }
        ],
        "id": 1
    }
    I'd like to be able to tell Zabbix to return the actual host name / label shown on the map instead of the string "{HOST.NAME}\n[{HOST.CONN}]" (which is useless, since I didn't found a way to perform macro expansion on the "client" side of the Zabbix API).

    Is there a way to obtain this effect? Am I missing something?

    Thank you!
  • marchezz
    Junior Member
    • Apr 2014
    • 2

    #2
    Bump - any news on this issue? Thanks!

    Comment

    • zendx
      Junior Member
      • May 2020
      • 12

      #3
      Any news..?

      Comment

      Working...