Ad Widget

Collapse

API - icmping history

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Phan479
    Junior Member
    • May 2024
    • 1

    #1

    API - icmping history

    Good morning,

    The operations department has set a team goal to achieve a certain uptime for key network infrastructure. To this end, they have asked me to interface with Zabbix and download some data so we can create a few KPIs.

    I've been able to access the API using the zabbix_utils Python package. However, when I try to get the ping history for a hostname, I only seem to be able to download successful ping responses, which results in a 100% uptime for the queried host. In the Zabbix web application, I can see that the uptime is close to, but not exactly, 100%.

    Currently, I do the following:

    I query to get the host_id from:
    api.host.get(filter={"host": host_name})
    I query to get the item_key from:
    api.item.get(filter={"hostid": host_id, "key_": icmpping_item_key})

    (the icmpping_item_key is 'icmpping')
    I then query the item history as follows:
    api.history.get(itemids=icmp_ping_item_id, time_from=time_from, time_till=time_to, output="extend", history=3)

    I get a lot of records with this query, but I only receive value = 1 responses. Can someone help?
Working...