コード例 #1
0
def get_all_alert_violations(api_key, start_date, end_date, only_open):
    params = {
        'start_date': start_date,
        'end_date': end_date,
        'only_open': only_open
    }
    return utils.get_paginated_entities(api_key, ALERT_VIOLATIONS_URL,
                                        VIOLATIONS, params)
コード例 #2
0
def get_dashboard_definition(api_key, name):
    params = {'filter[title]': name}
    result = {'entityFound': False, 'status': 404}
    results = utils.get_paginated_entities(api_key, GET_DASHBOARDS_URL,
                                           DASHBOARDS, params)
    if results['response_count'] <= 0:
        return result
    for dashboard in results[DASHBOARDS]:
        if dashboard['title'] == name:
            result['status'] = 200
            result['entityFound'] = True
            result['entity'] = dashboard
            break
    return result
コード例 #3
0
def get_nrql_conditions(api_key, policy_id):
    params = {'policy_id': policy_id}
    return utils.get_paginated_entities(api_key, NRQL_CONDITIONS_URL,
                                        NRQL_CONDITIONS, params)
コード例 #4
0
def get_location_failure_conditions(api_key, policy_id):
    get_url = LOC_FAILURE_CONDITIONS_URL + str(policy_id) + '.json'
    return utils.get_paginated_entities(api_key, get_url,
                                        LOCATION_FAILURE_CONDITIONS)
コード例 #5
0
def get_synthetic_conditions(api_key, alert_id):
    params = {'policy_id': alert_id}
    return utils.get_paginated_entities(api_key, GET_SYNTH_CONDITIONS_URL,
                                        SYNTH_CONDITIONS, params)
コード例 #6
0
def get_channels(api_key):
    return utils.get_paginated_entities(api_key, ALERTS_CHANNEL_URL, CHANNELS)
コード例 #7
0
def get_all_alert_policies(api_key):
    return utils.get_paginated_entities(api_key, ALERT_POLICIES_URL, POLICIES)
コード例 #8
0
def get_extsvc_conditions(api_key, policy_id):
    params = {'policy_id': policy_id}
    return utils.get_paginated_entities(api_key, EXTSVC_CONDITIONS_URL,
                                        EXTSVC_CONDITIONS, params)
コード例 #9
0
def get_app_conditions(api_key, alert_id):
    params = {'policy_id': alert_id}
    return utils.get_paginated_entities(api_key, GET_APP_CONDITIONS_URL,
                                        CONDITIONS, params)
コード例 #10
0
def delete_all_dashboards(api_key):
    result = utils.get_paginated_entities(api_key, GET_DASHBOARDS_URL,
                                          'dashboards')
    for dashboard in result['dashboards']:
        logger.info('Deleting ' + dashboard['title'])
        delete_dashboard(api_key, dashboard['id'])