def get_sync_zabbix_host(): from app.common.zabbix import init init() zabbix_hosts = db.session.query(ZbHost).all() db.session.close() #不在cache表里的数据 # select * from server where id not in zabbix_hosts_cmdb_id hostid = [zb.cmdb_hostid for zb in zabbix_hosts] #在缓存表里的服务器id servers = db.session.query(Server).filter(~Server.id.in_(hostid)).all() ##~表示取反 return json.dumps([{"hostname":s.hostname, "id":s.id} for s in servers])
def get_sync_zabbix_host(): from app.common.zabbix import init init() zabbix_hosts = db.session.query(ZbHost).all() db.session.close() #不在cache表里的数据 # select * from server where id not in zabbix_hosts_cmdb_id hostid = [zb.cmdb_hostid for zb in zabbix_hosts] #在缓存表里的服务器id servers = db.session.query(Server).filter( ~Server.id.in_(hostid)).all() ##~表示取反 return json.dumps([{"hostname": s.hostname, "id": s.id} for s in servers])
def get_zabbix_data_by_group(): from app.common.zabbix import get_zabbix_data,init init() params = dict(request.form) hosts = api_action('server.get', { 'output':['id'], 'where':{ 'server_purpose':params['server_purpose'][0], 'service_id':params['service_id'][0]} }) ret = get_zabbix_data(hosts) return json.dumps(ret)
def get_zabbix_data_by_group(): from app.common.zabbix import get_zabbix_data, init init() params = dict(request.form) hosts = api_action( 'server.get', { 'output': ['id'], 'where': { 'server_purpose': params['server_purpose'][0], 'service_id': params['service_id'][0] } }) ret = get_zabbix_data(hosts) return json.dumps(ret)
def get_zabbix_data_by_group(): from app.common.zabbix import get_zabbix_data, init init() params = dict(request.form) hosts = api_action( "server.get", { "output": ["id"], "where": { "server_purpose": params["server_purpose"][0], "service_id": params["service_id"][0] } }) ret = get_zabbix_data(hosts) return json.dumps(ret)
def get_zabbix_data_by_group(): from app.common.zabbix import get_zabbix_data, init init() params = dict(request.form) hosts = api_action( "server.get", { "output": ["id"], "where": {"server_purpose": params["server_purpose"][0], "service_id": params["service_id"][0]}, }, ) ret = get_zabbix_data(hosts) return json.dumps(ret)