Reputation: 201
i have one question about getting history from zabbix with python. I'm only start learn python, so please don't dislike) so, i have little script python, who get the host, who showing all items, and i try from this information get history for the one second, but then don't filter.
>>> from pyzabbix import ZabbixAPI
>>> zapi = ZabbixAPI("http://192.168.55.128/zabbix")
>>> zapi.login("admin", "zabbix")
>>> for host in zapi.host.get(filter={'groupids': '9'}):
... print host
>>>for item in zapi.item.get(filter={'host':'Zabbix server', 'name' : 'Processor load (5 min average per core)'}):
... print item
>>> history = zapi.history.get({"itemid" : "23297","time_from":"2014-10-04 00:10:00", "time_till":"2014-10-04 00:10:01", "output":"extend" })
>>> print history
and after this, i have all items, and no filter time, why? help please. P.S. what i must filter, so them return to me only the value (for the setting date)
Thanks
Upvotes: 1
Views: 8199
Reputation: 1
I don't know if anyone else has had this issue but it's 2022 and after a whole week being frustrated the answer posted down is the only thing that has helped me AND ACTUALLY WORKED:
history=zapi.history.get(hostids=['10333'],itemids[56411],time_from=1489420800,time_till=1489562140)
Upvotes: 0
Reputation: 1
history=zapi.history.get(hostids=['10333'],itemids=
[56411],time_from=1489420800,time_till=1489562140)
Upvotes: -1
Reputation: 2250
In time_from
and time_till
parameters, try using a Unix timestamp, like so:
>>> history = zapi.history.get({"itemids":"23297", "time_from":"1412370600", "time_till":"1412370601", "output":"extend" })
>>> print history
Upvotes: 3