Reputation: 1245
I'm using pyzabbix for the first time. I'd like to get a history of CPU for a specific host. I feel I may be using/understanding the library incorrectly since I'm not getting the result I'm expecting. When I make the following call:
time_till = time.mktime(datetime.now().timetuple())
time_from = time_till - 60 * 60 * 4
history = zapi.history.get(hostids=["10632"],
itemids=["78815"],
time_from=time_from,
time_till=time_till,
output='extend',
limit=5,
history=0,
sortfield='clock',
sortorder='DESC'
)
I get the following result:
[
{
"clock": "1520260023",
"itemid": "78783",
"ns": "353845414",
"value": "100.0000"
},
{
"clock": "1520260018",
"itemid": "78778",
"ns": "315473640",
"value": "0.1677"
},
{
"clock": "1520260018",
"itemid": "78898",
"ns": "321212433",
"value": "40.7421"
},
{
"clock": "1520260017",
"itemid": "78777",
"ns": "313120971",
"value": "0.3103"
},
{
"clock": "1520260016",
"itemid": "78896",
"ns": "308593447",
"value": "99.6560"
}
]
Based on these results, I have two questions:
1) shouldn't all my results have "itemid": "78815" since this is what I requested in my API call?
2) what is the "ns" value?
Upvotes: 0
Views: 138
Reputation: 4143
Try omitting hostids
from your request. The ns
value is the nanosecond value in that second.
Upvotes: 1