python - Can not fetch the history data of memory when using zabbix api -
i trying history data of vm.memory.size[used], vm.memory.size[cached], vm.memory.size[buffers], vm.memory.size[total]
using history.get
method, returned nothing.
can itemid item.get
call. code listed below.
import sys import time import logging pyzabbix import zabbixapi stream = logging.streamhandler(sys.stdout) stream.setlevel(logging.debug) log = logging.getlogger('pyzabbix') log.addhandler(stream) log.setlevel(logging.debug) zapi = zabbixapi(zabbix_server) zapi.login(user, passwd) # itemid items = zapi.item.get(output='extend', hostids=['10470', '10471', '10472', '10473'], search={'key_': 'vm.memory.size[used]'}) history = zapi.history.get(output='extend', itemids=['83140', '83141', '83142', '83143'], history=0, time_from=time.time() - 3600, time_till=time.time(), sortfield='clock', sortorder='desc')
history empty list []
, how can history data of memory?
i have python script generate custom report of zabbix , timestamp works in form.
date_f = "04/10/2015" date_t = "07/10/2015" begin = time.mktime(datetime.datetime.strptime(date_f, "%d/%m/%y").timetuple()) end = time.mktime(datetime.datetime.strptime(date_t, "%d/%m/%y").timetuple()
Comments
Post a Comment