HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/zenoss.cpython-310.pyc
o

�N�gV�@s,dZddlZe�e�Zdd�Zddd�ZdS)	a�
State to manage monitoring in Zenoss.

.. versionadded:: 2016.3.0

This state module depends on the 'zenoss' Salt execution module.

Allows for setting a state of minions in Zenoss using the Zenoss API. Currently Zenoss 4.x and 5.x are supported.

.. code-block:: yaml

    enable_monitoring:
      zenoss.monitored:
        - name: web01.example.com
        - device_class: /Servers/Linux
        - collector: localhost
        - prod_state: 1000
�NcCsdtvrdSdS)z@
    Only load if the Zenoss execution module is available.
    �zenoss.add_deviceZzenoss)Fz,The zenoss execution module is not available)�__salt__�rr�F/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/zenoss.py�__virtual__sr�	localhostcCs<i}||d<td|�}|rVd|d<d|d<|�d�|d<|durT|d	|krTtd
r7|�d�|d<d|d<ntd||�|�d
�|d<d�|d	�d|��d�|d<|Std
rod|�d�|d<ddd�|d<d|d<|Std||||�r�d|d<ddd�|d<|�d�|d<|Sd|d<d|d<d|�d�|d<|S)a[
    Ensure a device is monitored. The 'name' given will be used for Zenoss device name and should be resolvable.

    .. code-block:: yaml

        enable_monitoring:
          zenoss.monitored:
            - name: web01.example.com
            - device_class: /Servers/Linux
            - collector: localhost
            - prod_state: 1000
    �namezzenoss.find_deviceT�resultNZchangesz is already monitoredZcommentZproductionState�testz3 is already monitored but prodState will be updatedzzenoss.set_prod_statez/ is already monitored but prodState was updatedzprodState == {}z
prodState == )�old�newzThe state of "z" will be changed.zmonitored == Falsezmonitored == Truerz has been added to ZenossFzUnable to add z
 to Zenoss)rZ__opts__�format)rZdevice_classZ	collectorZ
prod_state�retZdevicerrr�	monitored#sB�
�
��r)NrN)�__doc__�logging�	getLogger�__name__�logrrrrrr�<module>s