Ad Widget

Collapse

Finding itemid For Use in API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gibbont
    Junior Member
    • Aug 2015
    • 2

    #1

    Finding itemid For Use in API

    Hey,

    Been searching and can't seem to find out exactly how to find the [I]itemid[I] for a given item.

    Currently using the pyzabbix module to access the API.

    Apologies in advance if this is something obvious.

    Thanks.
  • gibbont
    Junior Member
    • Aug 2015
    • 2

    #2
    Found the answer to my own question right after posting this.

    By going to the graph of an item (or any of the pages related to it) the itemid can be seen in the url.

    For example, if I view the graph for available memory on a server the url with the itemid will look like:

    (itemid is bolded)

    Code:
    http://mysever:port/zabbix/history.php?action=showgraph&[B]itemids[]=23702[/B]&sid=7787d8f3c831b065

    Comment

    • lazylion.ca
      Junior Member
      • Apr 2018
      • 7

      #3
      Correct.

      If you need to pass the item id to something like a trigger or external check, create a macro for the host or template.
      You can then run a script like

      Code:
        somescript [ ${ itemIDmacro } ]
      What I would really like is to be able to pass an item's id the same way you'd pass it's last value.

      Code:
       somescript [ someItem.itemid() , otherItem.last() ]


      I built a script that uses the api to pull a range of item values and perform some calculatoins that Zabbix functions can't quite handle yet.





      Note: spaces inserted for readability.

      Comment

      Working...