def stats(): if 'key' not in request.form: return(jsonify(status='error', message='API Key required')), 401 if request.form['key'] == warboard_stats_key: nr_results = get_newrelic_results() pd_results = get_pingdom_results() sp_results = get_sirportly_results() return(jsonify(status='ok', pingdom_count=pd_results['total_checks'], newrelic_count=nr_results['total_checks'], resolved_tickets=sp_results['resolved_tickets'], unassigned_tickets=sp_results['unassigned_tickets'], pingdom_up=pd_results['pingdom_up'], pingdom_down=pd_results['pingdom_down'], pingdom_paused=pd_results['pingdom_paused'], pingdom_accounts=pd_results['total_pingdom_accounts'], pingdom_failed=pd_results['failed_pingdom'], pingdom_working=pd_results['working_pingdom'], newrelic_accounts=nr_results['total_newrelic_accounts'], newrelic_working=nr_results['working_newrelic'], newrelic_failed=nr_results['failed_newrelic'])) else: return(jsonify(status='error', message='Invalid Key')), 401
def stats(): if 'key' not in request.form: return (jsonify(status='error', message='API Key required')), 401 if request.form['key'] == warboard_stats_key: resource_results = get_resource_results() port_results = get_port_monitoring_results() sp_results = get_sirportly_results() # This breaks backwards compatability return (jsonify( status='ok', resolved_tickets=sp_results['resolved_tickets'], unassigned_tickets=sp_results['unassigned_tickets'], waitingstaff_tickets=sp_results['waitingstaff_tickets'], latency_checks_total=port_results['total_checks'], latency_checks_up=port_results['up'], latency_checks_down=port_results['down'], latency_checks_paused=port_results['paused'], latency_accounts_total=port_results['total_accounts'], latency_accounts_failed=port_results['failed_accounts'], latency_accounts_working=port_results['working_accounts'], resource_checks_total=resource_results['total_checks'], resource_accounts_total=resource_results['total_accounts'], resource_accounts_failed=resource_results['failed_accounts'], resource_accounts_working=resource_results['working_accounts'])) else: return (jsonify(status='error', message='Invalid Key')), 401
def warboard(): return(render_template('warboard.html', title=warboard_title, refresh_time=refresh_time(), pingdom_results=get_pingdom_results(), newrelic_results=get_newrelic_results(), sirportly_results=get_sirportly_results(), sirportly_users=sirportly_users, sirportly_user_order=sirportly_user_order, calendar_items=get_calendar_items()))
def warboard(): return (render_template( 'warboard.html', title=warboard_title, refresh_time=refresh_time(), pingdom_results=get_pingdom_results(), latency_max_name_length=latency_max_name_length, resource_results=get_resource_results(), resources_max_name_length=resources_max_name_length, sirportly_results=get_sirportly_results(), sirportly_users=sirportly_users, sirportly_user_order=sirportly_user_order, calendar_items=get_calendar_items()))
def warboard(): logger.debug('Serving warboard') return (render_template( 'warboard.html', title=warboard_title, refresh_time=refresh_time(), port_results=get_port_monitoring_results(), latency_max_name_length=latency_max_name_length, resource_results=get_resource_results(), resources_max_name_length=resources_max_name_length, sirportly_results=get_sirportly_results(), sirportly_users=sirportly_users, sirportly_user_order=sirportly_user_order, calendar_items=get_calendar_items()))
def warboard_short(): logger.debug('Serving shortened warboard') port_results = get_port_monitoring_results() # As I don't use filters or lambda functions I feel this needs explanation. # For the most part we aren't interested in checks that are up. # If they are taking more than 2 seconds to return then maybe we are # filter runs the function for each check in our list of checks and then # returns the list of the ones that it is true for. port_results['checks'] = list( filter(lambda x: x['status'] != 'up' or x['lastresponsetime'] > 1000, port_results['checks'])) return (render_template( 'warboard.html', title=warboard_title, refresh_time=refresh_time(), port_results=port_results, latency_max_name_length=latency_max_name_length, resource_results=get_resource_results(), resources_max_name_length=resources_max_name_length, sirportly_results=get_sirportly_results(), sirportly_users=sirportly_users, sirportly_user_order=sirportly_user_order, calendar_items=get_calendar_items()))