def set_zas(self): strsql = "select distinct hostid from target_items;" t_hostids = sf.exec_selsql(MYSQL_JUBATUS, strsql) hostids = [] for h in t_hostids: hostids.extend(h) print hostids zas = [] for hostid in hostids: zas.append(ZabbixAnomaly(hostid)) self.zas = zas
def _get_lastcopyclock(self): dat = sf.exec_selsql(MYSQL_JUBATUS, "select clock from last_copy limit 1;", 0) if len(dat) == 0: return -1 else: return dat[0]
def _get_target_itemids(self): strsql = "select itemid from target_items where enabled = 1;" self._itemids = sf.exec_selsql(MYSQL_JUBATUS, strsql, 0)
def exec_selsql(self, strsql): return sf.exec_selsql(MYSQL_JUBATUS, strsql)