%PDF- %PDF-
| Direktori : /proc/self/root/proc/self/root/proc/self/root/lib/python2.7/site-packages/salt/states/ |
| Current File : //proc/self/root/proc/self/root/proc/self/root/lib/python2.7/site-packages/salt/states/opsgenie.pyo |
�
���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z d d l Z e j e
� Z d d d d d � Z
d d d d d � Z d S( u�
Create/Close an alert in OpsGenie
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. versionadded:: 2018.3.0
This state is useful for creating or closing alerts in OpsGenie
during state runs.
.. code-block:: yaml
used_space:
disk.status:
- name: /
- maximum: 79%
- minimum: 20%
opsgenie_create_action_sender:
opsgenie.create_alert:
- api_key: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
- reason: 'Disk capacity is out of designated range.'
- name: disk.status
- onfail:
- disk: used_space
opsgenie_close_action_sender:
opsgenie.close_alert:
- api_key: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
- name: disk.status
- require:
- disk: used_space
i ( t absolute_importt print_functiont unicode_literalsNu Createc
C@ sR t j t j � � \ } } } } t j d | � i d d 6d d 6d d 6d d 6} | d k sk | d k r� t j j d � � n t d t
k r� d j | | � | d <d | d <| St d
d | d | d
| d | � \ } } d | k o� d k n r1t j d | | � d j | | � | d <t
| d <n t j
d | | � t | d <| S( u�
Create an alert in OpsGenie. Example usage with Salt's requisites and other
global state arguments could be found above.
Required Parameters:
api_key
It's the API Key you've copied while adding integration in OpsGenie.
reason
It will be used as alert's default message in OpsGenie.
Optional Parameters:
name
It will be used as alert's alias. If you want to use the close
functionality you must provide name field for both states like
in above case.
action_type
OpsGenie supports the default values Create/Close for action_type.
You can customize this field with OpsGenie's custom actions for
other purposes like adding notes or acknowledging alerts.
u Arguments values: %su u resultu nameu changesu commentu! API Key or Reason cannot be None.u testuB Test: {0} alert request will be processed using the API Key="{1}".u opsgenie.post_datat api_keyt namet reasont action_typei� i, u; POST Request has succeeded with message: %s status code: %su6 POST Request has failed with error: %s status code: %sN( t inspectt getargvaluest currentframet logt infot Nonet saltt
exceptionst SaltInvocationErrort __opts__t Truet formatt __salt__t errort False( R R R R t _t valuest rett response_status_codet
response_text( ( s8 /usr/lib/python2.7/site-packages/salt/states/opsgenie.pyt create_alert. sB !
u Conditions are met.u Closec C@ s4 | d k r! t j j d � � n t | | | | � S( u"
Close an alert in OpsGenie. It's a wrapper function for create_alert.
Example usage with Salt's requisites and other global state arguments
could be found above.
Required Parameters:
name
It will be used as alert's alias. If you want to use the close
functionality you must provide name field for both states like
in above case.
Optional Parameters:
api_key
It's the API Key you've copied while adding integration in OpsGenie.
reason
It will be used as alert's default message in OpsGenie.
action_type
OpsGenie supports the default values Create/Close for action_type.
You can customize this field with OpsGenie's custom actions for
other purposes like adding notes or acknowledging alerts.
u Name cannot be None.N( R R
R R R ( R R R R ( ( s8 /usr/lib/python2.7/site-packages/salt/states/opsgenie.pyt close_alertz s ( t __doc__t
__future__R R R t loggingR t salt.exceptionsR
t getLoggert __name__R
R R R ( ( ( s8 /usr/lib/python2.7/site-packages/salt/states/opsgenie.pyt <module>"