简体   繁体   中英

Zabbix api value is different from Graph value

i have zabbix 5. I've been trying to write a shell script to get item trend for a range of time. the shell script works correctly but the value it return doesn't match what is showing on graph.
for example:

I have an item with itemid "10234" which return "percentage of used CPU".
i want to get the zabbix trend for this item from "2021/09/20 09:00:00" till "2021/09/21 09:00:00".
Unix time for this rang is: 1632112200, 1632198600

I run this command to get the values:
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

output:
{"clock":"1632114000","value_avg":"14.968717529411 764","value_min":"12.683622999999997","value_max": "17.635707999999994"}

but in Graph it shows:

在此处输入图像描述

why this happens and how to fix it?

In most cases, the graphs apply approximations. If you zoom in, you should see the same data you get from the API. The most zoom you can apply is 1 minute, while the API will get you the exact point in time value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM