%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/states/ |
Current File : //lib/python2.7/site-packages/salt/states/telemetry_alert.pyo |
� ���^c @@ sm d Z d d l m Z m Z m Z d d l m Z d d l m Z d � Z d d d � Z d d d � Z d S( u" Manage Telemetry alert configurations ===================================== .. versionadded:: 2016.3.0 Create, Update and destroy Mongo Telemetry alert configurations. This module uses requests, which can be installed via package, or pip. This module accepts explicit credential (telemetry api key) or can also read api key credentials from a pillar. Example: .. code-block:: yaml ensure telemetry alert X is defined on deployment Y: telemetry_alert.present: - deployment_id: "rs-XXXXXX" - metric_name: "testMetric" - alert_config: max: 1 filter: SERVER_ROLE_MONGOD_PRIMARY escalate_to: "example@pagerduty.com" - name: "**MANAGED BY ORCA DO NOT EDIT BY HAND** manages alarm on testMetric" i ( t absolute_importt unicode_literalst print_function( t string_types( t sixc C@ s d t k r d St S( Nu telemetry.get_alert_configu telemetry_alert( t __salt__t False( ( ( s? /usr/lib/python2.7/site-packages/salt/states/telemetry_alert.pyt __virtual__# s u telemetryc C@ s i | d 6t d 6d d 6i d 6} t d | | | | � } i | d 6| j d � d 6t d | j d � � j � d 6i | d 6| j d � d 6| j d � d 6d 6} g } | r�x| j � D]� \ } } | | k r� | j d j | | � � q� n | | } | | k rq� n t | t � rEt j | � t j | � k rEq� n t | t � rl| t | � k rlq� n t | t � r�| t | � k r�q� n | j d j | | | � � q� Wn | j d � | | | | | f } | r�t | � d k rd j | � | d <| St d rAd j | � } | | d <d j | � | d <| St d | � \ } } | rx| | d d <d | d <qt | d <d j | | � | d <n~ t d r�d j | � } | | d <d | d <| St d | � \ } } | r�| | d d <n t | d <d j | | � | d <| S(! u� Ensure the telemetry alert exists. name An optional description of the alarm (not currently supported by telemetry API) deployment_id Specifies the ID of the root deployment resource (replica set cluster or sharded cluster) to which this alert definition is attached metric_name Specifies the unique ID of the metric to whose values these thresholds will be applied alert_config: Is a list of dictionaries where each dict contains the following fields: filter By default the alert will apply to the deployment and all its constituent resources. If the alert only applies to a subset of those resources, a filter may be specified to narrow this scope. min the smallest "ok" value the metric may take on; if missing or null, no minimum is enforced. max the largest "ok" value the metric may take on; if missing or null, no maximum is enforced. notify_all Used to indicate if you want to alert both onCallEngineer and apiNotifications api_key Telemetry api key for the user profile A dict of telemetry config information. If present, will be used instead of api_key. u nameu resultu u commentu changesu telemetry.get_alert_configu deploymentu filteru% telemetry.get_notification_channel_idu escalate_tou notificationChannelu metricu maxu minu conditionu {0}={1} (new)u {0}='{1}' was: '{2}'u new alert configi u% alert config {0} present and matchingu testu"