Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.6/site-packages/agent360/plugins/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.6/site-packages/agent360/plugins/__pycache__/diskstatus-nvme.cpython-36.pyc

3

�uGhR�@sPddlZddlZddlZddlZddlZGdd�dej�ZedkrLe�j�dS)�Nc@seZdZdZdd�ZdS)�Pluginzdiskstatus-nvmecCsi}y>tjdtjtjdd�j�d}tj|jd��}|dd}Wntk
rZd}dSX|dk�rx�|dD]�}i}tj	d	j
|d
��j�}ytj|�}Wntk
r�YnXx:|j�D].\}	}
|	j
d�r�t|
dd�||	<q�|
||	<q�W|||d
jd
d�<qpW|S)z�
        Monitor nvme disk status
        For NVME drives install nvme-cli (https://github.com/linux-nvme/nvme-cli#distro-support)
        This plugin requires the agent to be run under the root user.
        z nvme --list --output-format=jsonT)�stdout�stderr�shellrzutf-8ZDevicesFz'Could not fetch nvme status informationz&nvme smart-log {} --output-format=jsonZ
DevicePathZtemperaturegfffffq@z/dev/�)�
subprocess�Popen�PIPE�communicate�json�loads�decode�	Exception�os�popen�format�read�items�
startswith�round�replace)�self�config�results�dataZnvme�valueZdeviceZ	disk_dataZ	data_diskZdisk_keyZ
disk_value�r�I/root/tmp/pip-build-gzoz1_uw/agent360/agent360/plugins/diskstatus-nvme.py�runs.

z
Plugin.runN)�__name__�
__module__�__qualname__rrrrrr	sr�__main__)	rrZpluginsr�reZ
BasePluginrr�executerrrr�<module>s%

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists