HEX
Server: LiteSpeed
System: Linux s3.sitechai.com 4.18.0-553.51.1.lve.1.el8.x86_64 #1 SMP Wed May 14 14:34:57 UTC 2025 x86_64
User: workzeni (2217)
PHP: 8.1.32
Disabled: mail, show_source, system, shell_exec, passthru, exec, eval, shell
Upload Files
File: //usr/local/lib/python3.6/site-packages/agent360/plugins/__pycache__/diskstatus-nvme.cpython-36.pyc
3

�~AhR�@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-bifl_51s/agent360/agent360/plugins/diskstatus-nvme.py�runs.

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