aciducen1995
aciducen1995

Reputation: 1

Zabbix fetch value from graph

Is it possible to fetch data from zabbix graph for reporting? For example, i would like to fetch memory utilization value from xxx to xxx (date/time).

zabbix graph example

My zabbix server version is 5.0.17 and appreciate if someone can help me using api from scratch.

I have tried using the api below which i found on one of the post but i could not find zabbix api token auth in my zabbix frontend

curl -L -k -i -X POST -H 'Content-Type:application/json' -d '{"jsonrpc":"2.0","method":"trend.get","id":1,"aut h":"1a543455bd48e6ddc222219acccb52e9","params" : {"output": ["clock","value_avg","value_min","value_max","num", "itemid"],"itemids":["10234"],"time_from": "1632112200","time_till": "1632198600", "limit": "1"}}' https://172.30.134.03:423//api_jsonrpc.php

api missing

The post that i found related to my needs.

Zabbix api value is different from Graph value

Upvotes: 0

Views: 364

Answers (1)

Simone Zabberoni
Simone Zabberoni

Reputation: 2113

While not a complete duplicate, you could refer to my answer to this question: create zapi.item.get from same host

You can use the python sample as a starting point, it calls the item.get and history.get api and fetches all the values of an item in a specific time interval

# ./getItemHistoryByName.py -H some-host  -I "ICMP response time" -f "26/6/2018 16:00" -t "27/6/2018 23:59"
ItemID: 77013 - Item: ICMP response time - Key: icmppingsec
1530021641 26/06/2018 16:00:41 Value: 0.1042
1530021701 26/06/2018 16:01:41 Value: 0.0993
1530021762 26/06/2018 16:02:42 Value: 0.1024
1530021822 26/06/2018 16:03:42 Value: 0.0966
[cut]

The script just outputs them, but you can adapt it to your needs.

Upvotes: 0

Related Questions