예제 #1
0
def data():
    arr = {}
    import time, random
    curr_time = int(round(time.time() * 1000)) 
    
    #http://127.0.0.1:5000/zabbix_get_history/68362/5

    arr['data_1'] = [[curr_time , random.randint(0,1)]]
    arr['data_2'] = [[curr_time , random.randint(0,1)]]
    # arr['data_3'] = [[curr_time , random.randint(0,99)]]

    client = ZabbixAction()
    client.login_test()
    res = client.get_host_history(itemids="68362",limit="100")
    for i in res:
        arr['data_3'] = [[int(i["clock"]) * 1000 , float(i['value'])]]
    print arr
    return json.dumps(arr)
예제 #2
0
def zabbix_get_history(itemids,limit):
      client = ZabbixAction()
      client.login_test()
      res = json.dumps(client.get_host_history(itemids,limit)) 
      return res