Ad Widget

Collapse

search maps that contains a hostid

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Alberto Tagliasacchi
    Junior Member
    • Jun 2024
    • 6

    #1

    search maps that contains a hostid

    Hi
    I would like to get list of maps (sysmapid) that contain a hostid.

    I'm trying to solve this issue using map.get method, using "output": "extend" and "selectSelements": "extend" and searching selements whose "elements": [
    {
    "hostid": "12345"
    }

    I cannot neither filter by "selementid" 123 using this:

    curl -s -X POST -H 'Content-Type: application/json-rpc' -d '{"jsonrpc":"2.0","method":"map.get","params":{ "output": "extend", "selectSelements": "extend" , "search": {"selements": {"selementid": "123"} } },"auth":"APITOKEN" ,"id":1 }' 'http://zabbix.server/api_jsonrpc.php'


    Thanks

    Alberto
  • Alberto Tagliasacchi
    Junior Member
    • Jun 2024
    • 6

    #2
    Hi,
    I deployed a workaround:
    • map.get ( output': 'selements', 'selectSelements': 'extend' )
    • for each selementid, print 'label' and add to an array
      • search the name of the host in the array, if matches, print the map-id
    Alberto

    Comment

    Working...