Module Import alias Import alias Import alias Import alias Import alias ImportFrom alias alias ImportFrom alias ImportFrom alias Expr Call AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad keyword NameLoad keyword IfExp CompareIn Str AttributeLoad NameLoad attr NameLoad NameLoad keyword NameLoad Assign NameStore Str Assign NameStore Call AttributeLoad Str attr NameLoad Str Assign NameStore Call AttributeLoad Str attr NameLoad Str Assign NameStore Call AttributeLoad Str attr NameLoad Str Assign NameStore Call AttributeLoad Str attr NameLoad Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Num Assign AttributeStore NameLoad attr Call NameLoad NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign AttributeStore NameLoad attr Dict Str AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Pass decorator_list FunctionDef arguments args NameParam defaults body Expr Str If UnaryOpNot AttributeLoad NameLoad attr body Raise Call NameLoad Str If UnaryOpNot AttributeLoad NameLoad attr body Raise Call NameLoad Str If BoolOpOr UnaryOpNot AttributeLoad NameLoad attr UnaryOpNot AttributeLoad NameLoad attr UnaryOpNot AttributeLoad NameLoad attr body Raise Call NameLoad BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr FunctionDef arguments args defaults body Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad If UnaryOpNot NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Return Str TryExcept body Assign NameStore Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Return Str If CompareNotIn Call AttributeLoad NameLoad attr Str NameLoad ListLoad Str Str body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad Return Str Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad TryExcept body If NameLoad body Expr Call NameLoad NameLoad NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad Return Str decorator_list Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr keyword ListLoad Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body If UnaryOpNot NameLoad body Return NameLoad If CompareIn Str NameLoad body Return AttributeLoad NameLoad attr Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body If UnaryOpNot SubscriptLoad NameLoad Index Str body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad Return Assign NameStore SubscriptLoad NameLoad Index Str If BoolOpOr Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad body Assign NameStore Dict Str Str NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad orelse If BoolOpOr Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad body Assign NameStore Dict Str Str NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad orelse If BoolOpOr Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Num body Expr Str If CompareEq NameLoad Num body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad Return TryExcept body Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad SubscriptLoad NameLoad Index Str Index Str If CompareIn SubscriptLoad NameLoad Index Str ListLoad Str body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad orelse Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad BinOpAdd NameLoad Num handlers ExceptHandler type NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore SubscriptLoad NameLoad Index Str If BoolOpOr Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad body Assign NameStore Dict Str Str NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad orelse If BoolOpOr Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad body Assign NameStore Dict Str Str NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad orelse If BoolOpOr Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Num body Expr Str If CompareEq NameLoad Num body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad Return TryExcept body Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad SubscriptLoad NameLoad Index Str Index Str Assign NameStore NameLoad For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad body AugAssignBitAnd NameStore CompareIn SubscriptLoad NameLoad Index Str ListLoad Str If UnaryOpNot NameLoad body Break If NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad orelse For NameStore NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad BinOpAdd NameLoad Num handlers ExceptHandler body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return BoolOpAnd NameLoad Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Return BoolOpAnd NameLoad Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Return BoolOpAnd NameLoad Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Return BoolOpAnd NameLoad Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Return BoolOpAnd NameLoad Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Return BoolOpAnd NameLoad Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore NameLoad If NameLoad body Assign NameStore Dict Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad NameLoad attr keyword NameLoad attr If CompareIn Str NameLoad body Return IfExp SubscriptLoad NameLoad Index Str SubscriptLoad SubscriptLoad NameLoad Index Str Index Num NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Dict For NameStore NameLoad body Assign NameStore Dict Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad NameLoad attr keyword NameLoad attr Assign SubscriptStore NameLoad Index NameLoad IfExp SubscriptLoad NameLoad Index Str SubscriptLoad SubscriptLoad NameLoad Index Str Index Num NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad If NameLoad body Return Call AttributeLoad NameLoad attr NameLoad NameLoad Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Return Call AttributeLoad NameLoad attr Str NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Assign NameStore Dict For TupleStore NameStore NameStore NameLoad body Assign SubscriptStore NameLoad Index NameLoad NameLoad Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Pass decorator_list FunctionDef arguments args NameParam NameParam defaults body Pass decorator_list FunctionDef arguments args NameParam NameParam defaults body Pass decorator_list FunctionDef arguments args NameParam NameParam defaults body Pass decorator_list decorator_list
N/A N/A six N/A sys N/A json N/A eventlet N/A requests flask request Flask six.moves urllib_parse st2reactor.sensor.base Sensor N/A N/A N/A eventlet monkey_patch os True select True socket True thread N/A N/A --use-debugger N/A sys argv False True time True N/A PACK newrelic N/A WEB_APP_ALERT_TRIGGER_REF N/A N/A {}.{} format PACK WebAppAlertTrigger N/A WEB_APP_NORMAL_TRIGGER_REF N/A N/A {}.{} format PACK WebAppNormalTrigger N/A SERVER_ALERT_TRIGGER_REF N/A N/A {}.{} format PACK ServerAlertTrigger N/A SERVER_NORMAL_TRIGGER_REF N/A N/A {}.{} format PACK ServerNormalTrigger N/A NR_API_URL_KEY api_url N/A NR_API_KEY_KEY api_key N/A APP_HOST_KEY host N/A APP_PORT_KEY port N/A APP_URL_KEY url N/A NORMAL_REPORT_DELAY_KEY normal_report_delay LegacyNewRelicHookSensor N/A Sensor N/A N/A 
    Sensor class that starts up a flask webapp that listens to alert hooks from NewRelic.
    It translates hooks into appropriate triggers using the following mapping -
       1. Web app incident and apdex problem opened -> WEB_APP_ALERT_TRIGGER
       2. Incident escalated to downtime (app)      -> WEB_APP_ALERT_TRIGGER
       3. Apdex problem closed (app)                -> WEB_APP_NORMAL_TRIGGER_REF
       4. Downtime problem closed (app)             -> WEB_APP_NORMAL_TRIGGER_REF
       5. Server incident and CPU problem opened    -> SERVER_ALERT_TRIGGER_REF
       6. Incident escalated after 5 minutes        -> SERVER_ALERT_TRIGGER_REF
       7. Server downtime ends                      -> SERVER_NORMAL_TRIGGER_REF
       8. CPU problem closed                        -> SERVER_NORMAL_TRIGGER_REF

    Note : Some hooks like cancel or disable of an inciden and open or close of alert policy
    are ignored.

    All return to normal events are always fired after a delay period.
     __init__ N/A N/A self sensor_service config N/A None N/A N/A N/A self _config config N/A N/A self _sensor_service sensor_service N/A N/A self _api_url N/A N/A config get NR_API_URL_KEY None N/A N/A self _api_key N/A N/A config get NR_API_KEY_KEY None N/A N/A self _host N/A N/A self _get_sensor_config_param N/A self _config APP_HOST_KEY N/A N/A self _port N/A N/A self _get_sensor_config_param N/A self _config APP_PORT_KEY N/A N/A self _url N/A N/A self _get_sensor_config_param N/A self _config APP_URL_KEY N/A N/A self _normal_report_delay N/A N/A self _get_sensor_config_param N/A self _config NORMAL_REPORT_DELAY_KEY 300 N/A N/A self _app N/A Flask __name__ N/A N/A self _log N/A N/A N/A self _sensor_service get_logger __name__ N/A N/A self _headers N/A X-Api-Key N/A self _api_key N/A setup N/A N/A self N/A N/A N/A N/A run N/A N/A self N/A N/A N/A 
        Validate required params and starts up the webapp that listen to hooks from NewRelic.
         N/A N/A N/A self _api_url N/A N/A N/A Exception NewRelic API url not found. N/A N/A N/A self _api_key N/A N/A N/A Exception NewRelic API key not found. N/A N/A N/A N/A self _host N/A N/A self _port N/A N/A self _url N/A N/A N/A Exception N/A NewRelic webhook app config (host:%s, port:%s, url:%s) N/A N/A self _host N/A self _port N/A self _url N/A N/A N/A N/A self _log info LegacyNewRelicHookSensor up. host %s, port %s, url %s N/A self _host N/A self _port N/A self _url handle_nrhook N/A N/A N/A N/A N/A data N/A request form N/A alert_body N/A N/A data get alert None N/A N/A alert_body N/A N/A N/A N/A N/A self _log info Request doesn't contain "alert" attribute, ignoring... N/A IGNORED N/A N/A N/A alert_body N/A N/A json loads alert_body N/A N/A N/A Exception N/A N/A N/A N/A N/A self _log exception N/A Failed to parse request body: %s alert_body N/A IGNORED N/A N/A N/A N/A alert_body get severity None N/A critical downtime N/A N/A N/A N/A N/A self _log debug Ignoring alert %s as it is not severe enough. alert_body N/A ACCEPTED N/A hook_headers N/A N/A self _get_headers_as_dict N/A request headers N/A hook_handler N/A N/A self _get_hook_handler alert_body hook_headers N/A N/A N/A hook_handler N/A N/A N/A hook_handler alert_body hook_headers N/A N/A N/A Exception N/A N/A N/A N/A N/A self _log exception Failed to handle nr hook %s. alert_body N/A ACCEPTED N/A N/A N/A N/A self _app route N/A self _url methods N/A POST N/A N/A N/A N/A self _app run host N/A self _host port N/A self _port N/A _get_hook_handler N/A N/A self alert_body hook_headers N/A N/A N/A N/A alert_body N/A N/A None N/A N/A servers alert_body N/A N/A N/A self _server_hook_handler N/A N/A self _app_hook_handler N/A _app_hook_handler N/A N/A self alert_body hook_headers N/A N/A N/A N/A N/A alert_body N/A application_name N/A N/A N/A N/A N/A self _log info No application found for alert %s. Will Ignore. alert_body N/A N/A long_description N/A alert_body N/A long_description N/A N/A N/A N/A self _is_alert_opened long_description N/A N/A self _is_escalated_downtime long_description N/A N/A payload N/A alert header alert_body hook_headers N/A N/A N/A self _dispatch_trigger WEB_APP_ALERT_TRIGGER_REF payload N/A N/A N/A N/A N/A self _is_alert_closed long_description N/A N/A self _is_downtime_recovered long_description N/A N/A payload N/A alert header alert_body hook_headers N/A N/A N/A N/A self _log info App alert closed. Delay. N/A N/A N/A eventlet spawn_after N/A self _normal_report_delay N/A self _dispatch_application_normal payload N/A N/A N/A N/A N/A self _is_alert_canceled long_description N/A N/A self _is_alert_acknowledged long_description N/A N/A N/A N/A N/A self _log info Ignored alert : %s. alert_body N/A _dispatch_application_normal N/A N/A self payload attempt_no N/A 0 N/A N/A 
        Dispatches WEB_APP_NORMAL_TRIGGER_REF if the application health_status is 'green'.
         N/A N/A attempt_no 10 N/A N/A N/A N/A N/A self _log warning Abandoning WEB_APP_NORMAL_TRIGGER_REF dispatch. Payload %s payload N/A N/A N/A N/A application N/A N/A self _get_application N/A N/A payload N/A alert N/A application_name N/A N/A N/A application N/A health_status N/A green N/A N/A N/A N/A self _dispatch_trigger WEB_APP_NORMAL_TRIGGER_REF payload N/A N/A N/A N/A N/A self _log info Application %s has state %s. Rescheduling normal check. N/A application N/A name N/A application N/A health_status N/A N/A N/A eventlet spawn_after N/A self _normal_report_delay N/A self _dispatch_application_normal payload N/A attempt_no 1 N/A N/A N/A Exception N/A N/A N/A N/A N/A self _log exception Failed delay dispatch. Payload %s. payload N/A _server_hook_handler N/A N/A self alert_body hook_headers N/A N/A N/A long_description N/A alert_body N/A long_description N/A N/A N/A N/A self _is_alert_opened long_description N/A N/A self _is_escalated_downtime long_description N/A N/A payload N/A alert header alert_body hook_headers N/A N/A N/A self _dispatch_trigger SERVER_ALERT_TRIGGER_REF payload N/A N/A N/A N/A N/A self _is_alert_closed long_description N/A N/A self _is_downtime_recovered long_description N/A N/A payload N/A alert header alert_body hook_headers N/A N/A N/A N/A self _log info App alert closed. Delay. N/A N/A N/A eventlet spawn_after N/A self _normal_report_delay N/A self _dispatch_server_normal payload N/A N/A N/A N/A N/A self _is_alert_canceled long_description N/A N/A self _is_alert_acknowledged long_description N/A N/A N/A N/A N/A self _log info Ignored alert : %s. alert_body N/A _dispatch_server_normal N/A N/A self payload attempt_no N/A 0 N/A N/A 
        Dispatches SERVER_NORMAL_TRIGGER_REF if the all servers health_status is 'green'.
         N/A N/A attempt_no 10 N/A N/A N/A N/A N/A self _log warning Abandoning SERVER_NORMAL_TRIGGER_REF dispatch. Payload %s payload N/A N/A N/A N/A servers N/A N/A self _get_servers N/A N/A payload N/A alert N/A servers N/A all_servers_ok True N/A N/A name server N/A N/A six iteritems servers N/A N/A all_servers_ok N/A N/A server N/A health_status N/A green N/A N/A all_servers_ok N/A N/A N/A all_servers_ok N/A N/A N/A N/A self _dispatch_trigger SERVER_NORMAL_TRIGGER_REF payload N/A N/A server servers N/A N/A N/A N/A N/A self _log info server %s has state %s. Rescheduling normal check. N/A server N/A name N/A server N/A health_status N/A N/A N/A eventlet spawn_after N/A self _normal_report_delay N/A self _dispatch_server_normal payload N/A attempt_no 1 N/A N/A N/A N/A N/A N/A N/A self _log exception Failed delay dispatch. Payload %s. payload N/A _dispatch_trigger N/A N/A self trigger payload N/A N/A N/A N/A N/A N/A self _sensor_service dispatch trigger payload N/A N/A N/A N/A self _log info Dispatched %s with payload %s. trigger payload N/A _is_alert_opened N/A N/A self long_description N/A N/A N/A N/A long_description N/A N/A long_description startswith Alert opened N/A _is_alert_closed N/A N/A self long_description N/A N/A N/A N/A long_description N/A N/A long_description startswith Alert ended N/A _is_alert_canceled N/A N/A self long_description N/A N/A N/A N/A long_description N/A N/A long_description startswith Alert canceled N/A _is_alert_acknowledged N/A N/A self long_description N/A N/A N/A N/A long_description N/A N/A long_description startswith Alert acknowledged N/A _is_escalated_downtime N/A N/A self long_description N/A N/A N/A N/A long_description N/A N/A long_description startswith Alert escalated to downtime N/A _is_downtime_recovered N/A N/A self long_description N/A N/A N/A N/A long_description N/A N/A long_description startswith Alert downtime recovered N/A _get_application N/A N/A self app_name N/A N/A N/A params None N/A app_name N/A N/A params N/A filter[name] app_name N/A url N/A N/A urllib_parse urljoin N/A self _api_url applications.json N/A resp N/A N/A N/A N/A requests get url headers N/A self _headers params params json N/A N/A applications resp N/A N/A N/A N/A resp N/A applications N/A N/A resp N/A applications N/A 0 None N/A None N/A _get_servers N/A N/A self server_names N/A N/A N/A servers N/A N/A server_name server_names N/A N/A params N/A filter[name] server_name N/A url N/A N/A urllib_parse urljoin N/A self _api_url servers.json N/A resp N/A N/A N/A N/A requests get url headers N/A self _headers params params json N/A N/A servers N/A server_name N/A N/A resp N/A servers N/A N/A resp N/A servers N/A 0 None N/A servers N/A _get_sensor_config_param N/A N/A config param_name default N/A None N/A N/A sensor_config N/A N/A LegacyNewRelicHookSensor _get_sensor_config config N/A sensor_config N/A N/A N/A N/A sensor_config get param_name default N/A default N/A staticmethod _get_sensor_config N/A N/A config N/A N/A N/A N/A N/A config get sensor_config None N/A staticmethod _get_headers_as_dict N/A N/A headers N/A N/A N/A headers_dict N/A N/A N/A k v headers N/A N/A N/A headers_dict N/A k v N/A headers_dict N/A staticmethod cleanup N/A N/A self N/A N/A N/A N/A add_trigger N/A N/A self trigger N/A N/A N/A N/A update_trigger N/A N/A self trigger N/A N/A N/A N/A remove_trigger N/A N/A self trigger N/A N/A N/A N/A N/A