%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/states/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/states/serverdensity_device.pyo

�
���^c@@s{dZddlmZmZmZddlZddlZddlm	Z	ej
e�Zd�Z
deedd�ZdS(u
Monitor Server with Server Density
==================================

.. versionadded:: 2014.7.0

`Server Density <https://www.serverdensity.com/>`_
Is a hosted monitoring service.

.. warning::

    This state module is beta. It might be changed later to include more or
    less automation.

.. note::

    This state module requires a pillar for authentication with Server Density
    To install a v1 agent:

    .. code-block:: yaml

        serverdensity:
          api_token: "b97da80a41c4f61bff05975ee51eb1aa"
          account_url: "https://your-account.serverdensity.io"

    To install a v2 agent:

    .. code-block:: yaml

        serverdensity:
          api_token: "b97da80a41c4f61bff05975ee51eb1aa"
          account_name: "your-account"

.. note::

    Although Server Density allows duplicate device names in its database, this
    module will raise an exception if you try monitoring devices with the same
    name.


Example:

.. code-block:: yaml

    'server_name':
      serverdensity_device.monitored
i(tabsolute_importtunicode_literalstprint_functionN(tsixcC@sXtd�}td�}i}y |d|d<|d|d<|ddkrfid	d
6dd6}n"i|dj�d
6|dd6}tjjj|�|d<|d
d|d<tjt|ddd�d�|d<tjt|ddd�d�|d<tjjj|d�|d<tjjj|d�|d<Wnt	k
rSnX|S(u�
    Try to get all sort of parameters for Server Density server info.

    NOTE: Missing publicDNS and publicIPs parameters. There might be way of
    getting them with salt-cloud.
    ustatus.all_statusugrains.itemsuidunameuhostuhostnameukerneluDarwinumacucodeuMacuosucpuinfou	cpu coresucpuCoresumeminfouMemTotaluvalueiuinstalledRAMu	SwapTotalu	swapSpaceufqdn_ip4u
privateIPsufqdnu
privateDNS(
t__salt__tlowertsalttutilstjsontdumpsRt	text_typetinttKeyError(t	all_statst
all_grainstparamstsd_os((sD/usr/lib/python2.7/site-packages/salt/states/serverdensity_device.pyt_get_salt_paramsEs$

"))!
icK@sli|d6id6dd6dd6}t�}|rM|jd�}||d<n
|jd�|rm||d<n|dkr�d}n|r�x'tj|�D]\}}	|	||<q�W|}
n|}
td	d
|�r�tnt}dtd�kr�tnt}|r-|r-t|d<d
|d<i|d<|S|s�td||�}
|
d}d|d<i|
d6|d<tdrd|d<d|d<|Snw|r�td	d
|�d}
|
d}d|d<nCt|d<d|d<i|d<tdrd|d<d|d<n|Stdr)d|d<d|d<|Std||�}t|d<d|d<i|
d6|d6|d<|S(uf
    Device is monitored with Server Density.

    name
        Device name in Server Density.

    salt_name
        If ``True`` (default), takes the name from the ``id`` grain. If
        ``False``, the provided name is used.

    group
        Group name under with device will appear in Server Density dashboard.
        Default - `None`.

    agent_version
        The agent version you want to use. Valid values are 1 or 2.
        Default - 1.

    salt_params
        If ``True`` (default), needed config parameters will be sourced from
        grains and from :mod:`status.all_status
        <salt.modules.status.all_status>`.

    params
        Add parameters that you want to appear in the Server Density dashboard.
        Will overwrite the `salt_params` parameters. For more info, see the
        `API docs`__.

    .. __: https://apidocs.serverdensity.com/Inventory/Devices/Creating

    Usage example:

    .. code-block:: yaml

        'server_name':
          serverdensity_device.monitored

    .. code-block:: yaml

        'server_name':
          serverdensity_device.monitored:
            - group: web-servers

    .. code-block:: yaml

        'my_special_server':
          serverdensity_device.monitored:
            - salt_name: False
            - group: web-servers
            - cpuCores: 2
            - os: '{"code": "linux", "name": "Linux"}'
    unameuchangesuresultuucommentugroupiiuserverdensity_device.lstnameusd-agentu
pkg.list_pkgsuYSuch server name already exists in this Server Density account. And sd-agent is installeduserverdensity_device.createuagentKeyu$Device created in Server Density db.udevice_createdutestu.Device set to be created in Server Density db.iu(Device was already in Server Density db.uYFailed to create device in Server Density DB and this device does not exist in db either.uAAgent is not installed and device is not in the Server Density DBuWServer Density agent is set to be installed and device created in the Server Density DBu"serverdensity_device.install_agentuESuccessfully installed agent and created device in Server Density db.ucreated_deviceuinstalled_agentN(	tNoneRtpopRt	iteritemsRtTruetFalset__opts__(Rtgroupt	salt_nametsalt_paramst
agent_versionRtrettparams_from_salttkeytvaluet
params_to_usetdevice_in_sdtsd_agent_installedtdevicet	agent_keytinstalled_agent((sD/usr/lib/python2.7/site-packages/salt/states/serverdensity_device.pyt	monitoredbsf5"	


		




















(t__doc__t
__future__RRRtloggingtsalt.utils.jsonRtsalt.extRt	getLoggert__name__tlogRRRR'(((sD/usr/lib/python2.7/site-packages/salt/states/serverdensity_device.pyt<module>0s	

Zerion Mini Shell 1.0