Ad Widget

Collapse

how to get an item with pyzabbix api ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • peter.prusi
    Junior Member
    • Aug 2013
    • 1

    #1

    how to get an item with pyzabbix api ?

    hi,

    how can i get the contet of an item via python api ?
    my code looks like
    Code:
    #! /usr/bin/python
    
    from pyzabbix import ZabbixAPI
    
    ZABBIX_SERVER = 'server'
    zapi = ZabbixAPI(ZABBIX_SERVER)
    zapi.login('user', 'password')
    list_item = zapi.item.get({"output": "extend","filter":{'host':'cl0001ms0001'},"search":{'key_':'uptime'}})
    for item in list_item:
    	if item['itemid'] == '23513':
    		print item
    the result is : {u'itemid': u'23513'}, but not the content of the item.
    can anyone help me ?

    thanks
  • Abhiram_Cloud4c
    Junior Member
    • Nov 2016
    • 10

    #2
    Use name in output

    please try the below.

    Im able to access the item-id with its respective name.

    items = zapi.item.get(monitored=True,output=["name"],filter={"state":1})


    ###This is for not supported items###

    Comment

    • iuic
      Junior Member
      • Jul 2018
      • 4

      #3
      events = zapi.event.get(output='extend') # <----- error , why?

      Comment

      Working...