zabbixzabbix-apizabbix-custom-reports

Is it possible to get item id by host ip using one zabbix api?


I would like to get 'itemid' by item.get api, and filter it by host ip

I tried this request, but it doesn't work (works only when giving host id):

{ "jsonrpc": "2.0", "method": "item.get", "params": { "output": "extend", "selectInterfaces":["ip"], "search": { "ip": "1.1.1.1" } }, "auth": "038e1d7b1735c6a5436ee9eae095879e", "id": 1 }

Any idea for me pls?


Solution

  • I guess you want the item id of a specific item key/name from an host with specific ip address.

    You can do a hostinterface.get with a filter for the required ip address, to obtain the hostid. Then you can do a item.get passing the hostid and a filter for the item key or name to get the itemid.