Ad Widget

Collapse

Zabbix API, how can you get hostname from a graph item?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • omeek
    Junior Member
    • Sep 2014
    • 2

    #1

    Zabbix API, how can you get hostname from a graph item?

    Hello!

    I am using the Zabbix API (with the zabbix_api module for python) and am trying to get the hostname of a graph item. Basically, I am getting the screenid and using that to get the screen items.

    Once I have the screen item details (example below), I am not sure how to map any of that data to the actual host item.

    Output:
    {u'application': u'', u'style': u'0', u'rowspan': u'1', u'sort_triggers': u'0', u'halign': u'0', u'resourcetype': u'0', u'resourceid': u'6649', u'screenid': u'34', u'dynamic': u'0', u'url': u'', u'screenitemid': u'216', u'height': u'100', u'width': u'500', u'elements': u'0', u'valign': u'0', u'colspan': u'1', u'y': u'1', u'x': u'0'}

    Does anyone know the best way to get a hostname from a graph item in a particular screen?
  • omeek
    Junior Member
    • Sep 2014
    • 2

    #2
    Ok, looks like I figured out the path. In case anyone else needs the info, here it is:
    • screen.get (search for screenid)
    • screenitem.get (use screenid to get resourceid which is the same value as graphid)
    • graphitem.get (use graphid to get itemid)
    • item.get (use itemid to get hostid)
    • host.get (use hostid to get host value)

    Not sure if there is a shorter path to the data I need but, it works as expected.

    Comment

    Working...