HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/munin.cpython-310.pyc
o

�N�g~	�@sVdZddlZddlZddlZddlZdZdd�Zddd�Zd	d
�Z	dd�Z
d
d�ZdS)zC
Run munin plugins/checks from salt and format the output as data.
�Nz/etc/munin/plugins/cCstj�d�rdSdS)z9
    Only load the module if munin-node is installed
    z/etc/munin/munin-node.confZmunin)FzIThe munin execution module cannot be loaded: munin-node is not installed.)�os�path�exists�rr�F/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/munin.py�__virtual__sr�/etc/munin/munin-node.cfgcCsFtjj�|d��}tjj�|���Wd�S1swYdS)N�r)�salt�utils�filesZfopenZstringutilsZ
to_unicode�read)�fnameZfp_rrr�	_get_confs$�rc
Cs�t�}t|t�r
|�d�}i}|D]O}||vrqi||<tdd|��dd�}|�d�D]3}d|vr_|�d�\}}|�d	�d
}zd	|vrJt|�}nt|�}||||<Wq,ty^Yq,wq,q|S)z�
    Run one or more named munin plugins

    CLI Example:

    .. code-block:: bash

        salt '*' munin.run uptime
        salt '*' munin.run uptime,cpu,load,memory
    �,zcmd.runz
munin-run F)Zpython_shell�
�value� �.r)�list_plugins�
isinstance�str�splitZ__salt__�float�int�
ValueError)�pluginsZall_plugins�data�pluginZmuninout�line�key�valrrr�runs0


���
r"cCs&t�}i}|D]	}|�t|��q|S)zo
    Run all the munin plugins

    CLI Example:

    .. code-block:: bash

        salt '*' munin.run_all
    )r�updater")r�retrrrr�run_allEs

r%c	Csft�t�}g}|D]'}tj�t|�}z
tjt�|�tj@}Wn	ty(Ynw|r0|�	|�q	|S)zu
    List all the munin plugins

    CLI Example:

    .. code-block:: bash

        salt '*' munin.list_plugins
    )
r�listdir�	PLUGINDIRr�join�stat�S_IXUSR�ST_MODE�OSError�append)Z
pluginlistr$rZstatfZ
executebitrrrrVs

�
�r)r)�__doc__rr)Zsalt.utils.filesr
Zsalt.utils.stringutilsr'rrr"r%rrrrr�<module>s
&