Im working on a python script that does some analysis. This script uses the following zabbix api to get the last value of an item:
getlastvalue = {
"jsonrpc":"2.0",
"method":"item.get",
"params":{
"output":"extend",
"hostids":"10084",
"search":{
"key_":"vfs.fs.size[/var/log,used]"
},
"sortfield":"name"
},
"auth":mytoken,
"id":1
}
My script analyzes the response and produces this feedback:
LatestValue:499728384 LatestValueEpoch:1553573850 HowLongAgo:33secs ItemID:51150
Now, I wish to know what the value of the item was 24 hours ago...meaning 24 hours from the LatestValueEpoch time. This is where Im having an issue. I think I may not be using the right json. But here's what I've been using:
historyget = {
"jsonrpc":"2.0",
"method":"history.get",
"params":{
"output":[
"itemid",
"extend"
],
"time_from":"",
"time_to":"",
"itemids":[
"51150"
]
},
"auth":mytoken,
"id":1
}
I replace the value of time_from
and time_to
in my script to reflect yesterday's time (24 hours ago exactly from the current time). But the response I get isnt what I want. What am i doing wrong here?