def get_global_process_data_after(key=None, timestamp=None, check=None, enddate=None, timezone='UTC', filtered_servers=None): now = datetime.utcnow() data = [] active_checks = ['memory', 'cpu', 'io'] if check in active_checks and timestamp: data = process_model.get_global_data_after(timestamp=timestamp, enddate=enddate, key=key, timezone=timezone, check=check, filtered_servers=filtered_servers ) try: now_local = dateformatcharts_local(datetime_to_unixtime(now), tz=timezone) except: now_local = False response = { 'data': data, 'last_update': datetime_to_unixtime(now), 'now_local': now_local } return response
def get_global_plugin_data_after(metric=None, timestamp=None, check=None, enddate=None, timezone='UTC', filtered_servers=None): now = datetime.utcnow() data = plugin_model.get_global_data_after( timestamp=timestamp, metric=metric, timezone=timezone, filtered_servers=filtered_servers) try: now_local = dateformatcharts_local(datetime_to_unixtime(now), tz=timezone) except: now_local = False response = { 'data': data, 'last_update': datetime_to_unixtime(now), 'now_local': now_local } return response
def get_global_process_data_after(key=None, timestamp=None, check=None, enddate=None, timezone='UTC', filtered_servers=None): now = datetime.utcnow() data = [] active_checks = ['memory', 'cpu', 'io'] if check in active_checks and timestamp: data = process_model.get_global_data_after( timestamp=timestamp, enddate=enddate, key=key, timezone=timezone, check=check, filtered_servers=filtered_servers) try: now_local = dateformatcharts_local(datetime_to_unixtime(now), tz=timezone) except: now_local = False response = { 'data': data, 'last_update': datetime_to_unixtime(now), 'now_local': now_local } return response
def get_plugin_data_after(plugin_id=None, timestamp=None, gauge_id=None, enddate=None, timezone='UTC'): now = datetime.utcnow() gauge = plugin_model.get_gauge_by_id(gauge_id=gauge_id) data = plugin_model.get_gauge_data_after(enddate=enddate, timestamp=timestamp, gauge=gauge, timezone=timezone) try: now_local = dateformatcharts_local(datetime_to_unixtime(now), tz=timezone) except: now_local = False response = { 'data': data, 'last_update': datetime_to_unixtime(now), 'now_local': now_local } return response
def get_process_data_after(process_id=None, server_id=None, timestamp=None, check=None, enddate=None, timezone='UTC'): now = datetime.utcnow() server = server_model.get_by_id(server_id) process = process_model.get_by_id(process_id) data = [] active_checks = ['memory', 'cpu', 'io'] if check in active_checks and timestamp: data = process_model.get_data_after(timestamp=timestamp, enddate=enddate, server=server, timezone=timezone, process=process, check=check) try: now_local = dateformatcharts_local(datetime_to_unixtime(now), tz=timezone) except: now_local = False response = { 'data': data, 'last_update': datetime_to_unixtime(now), 'now_local': now_local } return response
def get_system_data_after(server_id=None, timestamp=None, check=None, enddate=None, timezone='UTC', device_id=None): server = server_model.get_by_id(server_id) data = [] now = datetime.utcnow() active_checks = [ 'memory', 'loadavg', 'cpu', 'disk', 'network.inbound', 'network.outbound' ] if check in active_checks and timestamp: if check in ['network.inbound', 'network.outbound']: key = 'i' if check == 'network.inbound' else 'o' filtered_servers = [server] data = system_model.get_global_device_data_after( timestamp=timestamp, enddate=enddate, filtered_servers=filtered_servers, key=key, timezone=timezone, check='network') elif check == 'disk': data = system_model.get_device_data_after(timestamp=timestamp, enddate=enddate, server=server, timezone=timezone, check=check, device_id=device_id) else: data = system_model.get_data_after(timestamp=timestamp, enddate=enddate, server=server, check=check, timezone=timezone) try: now_local = dateformatcharts_local(datetime_to_unixtime(now), tz=timezone) except: now_local = False response = { 'data': data, 'last_update': datetime_to_unixtime(now), 'now_local': now_local, 'chart_type': 'line' } return response
def get_global_system_data_after(timestamp=None, check=None, key=None, enddate=None, timezone='UTC', filtered_servers=None): data = [] now = datetime.utcnow() active_checks = ['memory', 'loadavg', 'cpu', 'disk', 'network'] if check in active_checks and timestamp: if check in ['disk', 'network']: data = system_model.get_global_device_data_after( timestamp=timestamp, enddate=enddate, timezone=timezone, check=check, key=key, filtered_servers=filtered_servers) else: data = system_model.get_global_data_after( timestamp=timestamp, enddate=enddate, check=check, key=key, timezone=timezone, filtered_servers=filtered_servers) try: now_local = dateformatcharts_local(datetime_to_unixtime(now), tz=timezone) except: now_local = False response = { 'data': data, 'last_update': datetime_to_unixtime(now), 'now_local': now_local, 'chart_type': 'line', } return response
def get_system_data_after(server_id=None, timestamp=None, check=None, enddate=None, timezone='UTC', device_id=None): server = server_model.get_by_id(server_id) data = [] now = datetime.utcnow() active_checks = ['memory', 'loadavg', 'cpu', 'disk', 'network.inbound', 'network.outbound'] if check in active_checks and timestamp: if check in ['network.inbound', 'network.outbound']: key = 'i' if check == 'network.inbound' else 'o' filtered_servers = [server] data = system_model.get_global_device_data_after(timestamp=timestamp, enddate=enddate, filtered_servers=filtered_servers, key=key, timezone=timezone, check='network' ) elif check == 'disk': data = system_model.get_device_data_after(timestamp=timestamp, enddate=enddate, server=server, timezone=timezone, check=check, device_id=device_id) else: data = system_model.get_data_after(timestamp=timestamp, enddate=enddate, server=server, check=check, timezone=timezone) try: now_local = dateformatcharts_local(datetime_to_unixtime(now), tz=timezone) except: now_local = False response = { 'data': data, 'last_update': datetime_to_unixtime(now), 'now_local': now_local, 'chart_type': 'line' } return response
def get_global_system_data_after(timestamp=None, check=None, key=None, enddate=None, timezone='UTC', filtered_servers=None): data = [] now = datetime.utcnow() active_checks = ['memory', 'loadavg', 'cpu', 'disk', 'network'] if check in active_checks and timestamp: if check in ['disk', 'network']: data = system_model.get_global_device_data_after(timestamp=timestamp, enddate=enddate, timezone=timezone, check=check, key=key, filtered_servers=filtered_servers ) else: data = system_model.get_global_data_after(timestamp=timestamp, enddate=enddate, check=check, key=key, timezone=timezone, filtered_servers=filtered_servers ) try: now_local = dateformatcharts_local(datetime_to_unixtime(now), tz=timezone) except: now_local = False response = { 'data': data, 'last_update': datetime_to_unixtime(now), 'now_local': now_local, 'chart_type': 'line', } return response
def get_process_data_after(process_id=None, server_id=None, timestamp=None, check=None, enddate=None, timezone='UTC'): now = datetime.utcnow() server = server_model.get_by_id(server_id) process = process_model.get_by_id(process_id) data = [] active_checks = ['memory', 'cpu', 'io'] if check in active_checks and timestamp: data = process_model.get_data_after(timestamp=timestamp, enddate=enddate, server=server, timezone=timezone, process=process,check=check) try: now_local = dateformatcharts_local(datetime_to_unixtime(now), tz=timezone) except: now_local = False response = { 'data': data, 'last_update': datetime_to_unixtime(now), 'now_local': now_local } return response