%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/modules/kapacitor.pyc

�
���^c@@s�dZddlmZmZmZddlmZddlZddl	Zddl
ZddlmZddl
Zeje�Zd�Zed��Zd�Zd	�Zd
�Zddddd
�Zd�Zd�Zd�ZdS(uJ
Kapacitor execution module.

:configuration: This module accepts connection configuration details either as
    parameters or as configuration settings in /etc/salt/minion on the relevant
    minions::

        kapacitor.host: 'localhost'
        kapacitor.port: 9092

    .. versionadded:: 2016.11.0

    Also protocol and SSL settings could be configured::

        kapacitor.unsafe_ssl: 'false'
        kapacitor.protocol: 'http'

    .. versionadded:: 2019.2.0

    This data can also be passed into pillar. Options passed into opts will
    overwrite options passed into pillar.

i(tabsolute_importtprint_functiontunicode_literals(tsixN(tmemoizecC@stjjjd�rdStS(Nu	kapacitor(tsalttutilstpathtwhichtFalse(((s:/usr/lib/python2.7/site-packages/salt/modules/kapacitor.pyt__virtual__(scC@s9tdd�}|s5tjtddd��}n|S(u$
    Get the kapacitor version.
    upkg.versionu	kapacitoru
config.optionukapacitor.versionulatest(t__salt__Rtstring_types(tversion((s:/usr/lib/python2.7/site-packages/salt/modules/kapacitor.pyR
,scC@sLtddd�}tddd�}tddd�}dj|||�S(	u 
    Get the kapacitor URL.
    u
config.optionukapacitor.protocoluhttpukapacitor.hostu	localhostukapacitor.porti�#u
{0}://{1}:{2}(Rtformat(tprotocolthosttport((s:/usr/lib/python2.7/site-packages/salt/modules/kapacitor.pyt_get_url7scC@s�t�}t�dkr-dj||�}ndj||�}tjjj|dt�}|ddkrndStjj	j
|d�}t�dkr�i|dd	6|d
d6|dd
6|dd6Si|d	d	6|dd6|d
d
6|ddkd6S(u�
    Get a dict of data on a task.

    name
        Name of the task to get information about.

    CLI Example:

    .. code-block:: bash

        salt '*' kapacitor.get_task cpu
    u0.13u{0}/task?name={1}u+{0}/kapacitor/v1/tasks/{1}?skip-format=truetstatusustatusi�ubodyu
TICKscriptuscriptuTypeutypeuDBRPsudbrpsuEnableduenabledN(RR
RRRthttptquerytTruetNonetjsontloads(tnameturlttask_urltresponsetdata((s:/usr/lib/python2.7/site-packages/salt/modules/kapacitor.pytget_taskBs&
	cC@s�i}it�d6tddd�d6}td|d|�}|jd�r`|d|d<n|jd	�r�|d	|d	<n|d
dk|d<|S(
u?
    Run a Kapacitor task and return a dictionary of info.
    u
KAPACITOR_URLu
config.optionukapacitor.unsafe_sslufalseuKAPACITOR_UNSAFE_SSLucmd.run_alltenvustdoutustderruretcodeiusuccess(RRtget(tcmdtrettenv_varstresult((s:/usr/lib/python2.7/site-packages/salt/modules/kapacitor.pyt_run_cmdms
ustreamudefaultcC@s|r|rtjd�tSt�dkr@dj|�}ndj|�}|jd�rttd|t�}n|dj|�7}|r�|dj|�7}n|s�g}n|r�|r�d	j||�}|j|�n|r
x$|D]}|d
j|�7}q�Wnt	|�S(u
    Define a task. Serves as both create/update.

    name
        Name of the task.

    tick_script
        Path to the TICK script for the task. Can be a salt:// source.

    task_type
        Task type. Defaults to 'stream'

    dbrps
        A list of databases and retention policies in "dbname"."rpname" format
        to fetch data from. For backward compatibility, the value of
        'database' and 'retention_policy' will be merged as part of dbrps.

        .. versionadded:: 2019.2.0

    database
        Which database to fetch data from.

    retention_policy
        Which retention policy to fetch data from. Defaults to 'default'.

    CLI Example:

    .. code-block:: bash

        salt '*' kapacitor.define_task cpu salt://kapacitor/cpu.tick database=telegraf
    u.Providing database name or dbrps is mandatory.u0.13ukapacitor define -name {0}ukapacitor define {0}usalt://u
cp.cache_fileu
 -tick {0}u
 -type {0}u{0}.{1}u
 -dbrp {0}(
tlogterrorR	R
Rt
startswithRt__env__tappendR&(Rttick_scriptt	task_typetdatabasetretention_policytdbrpsR"tdbrp((s:/usr/lib/python2.7/site-packages/salt/modules/kapacitor.pytdefine_task�s(%
	
cC@stdj|��S(u�
    Delete a kapacitor task.

    name
        Name of the task to delete.

    CLI Example:

    .. code-block:: bash

        salt '*' kapacitor.delete_task cpu
    ukapacitor delete tasks {0}(R&R(R((s:/usr/lib/python2.7/site-packages/salt/modules/kapacitor.pytdelete_task�s
cC@stdj|��S(u�
    Enable a kapacitor task.

    name
        Name of the task to enable.

    CLI Example:

    .. code-block:: bash

        salt '*' kapacitor.enable_task cpu
    ukapacitor enable {0}(R&R(R((s:/usr/lib/python2.7/site-packages/salt/modules/kapacitor.pytenable_task�s
cC@stdj|��S(u�
    Disable a kapacitor task.

    name
        Name of the task to disable.

    CLI Example:

    .. code-block:: bash

        salt '*' kapacitor.disable_task cpu
    ukapacitor disable {0}(R&R(R((s:/usr/lib/python2.7/site-packages/salt/modules/kapacitor.pytdisable_task�s
(t__doc__t
__future__RRRtsalt.extRtsalt.utils.httpRtsalt.utils.jsontsalt.utils.pathtsalt.utils.decoratorsRtloggingtloggert	getLoggert__name__R'R
R
RRR&RR2R3R4R5(((s:/usr/lib/python2.7/site-packages/salt/modules/kapacitor.pyt<module>s(			+	?		

Zerion Mini Shell 1.0