Ad Widget

Collapse

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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • user1234
    Member
    • Jul 2022
    • 35

    #1

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

    I would like to get 'itemid' using 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"], "filter": { "ip": "1.1.1.1" } }, "auth": "038e1d7b1735c6a5436ee9eae095879e", "id": 1 }

    Any idea for me pls?
  • user1234
    Member
    • Jul 2022
    • 35

    #2
    Hey,

    any idea for me please??

    Comment

    • Markku
      Senior Member
      Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
      • Sep 2018
      • 1781

      #3
      Any idea for me pls?
      Sure, ideas. You don't say the Zabbix version so I'll assume the current latest LTS version = 6.0. First use the Host interface API to get the interfaces and hostids that match the IP address. Then use the Item API to get the items you want.

      Markku

      Comment

      • user1234
        Member
        • Jul 2022
        • 35

        #4
        Thanks for replying!
        so i understand i must use two APIs here: hostinterface.get and item.get.
        i can't use only one API right?

        Comment

        Working...