/usr/share/cagefs-skeleton/usr/lib/python3.9/site-packages/glances/plugins/__pycache__
a ���c � @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZ zddl m Z W n8 ey| Z z da e�d�e�� W Y d Z[nd Z[0 0 d a dd� Zd d� ZG dd� de�Zd S )a� Hard disk SMART attributes plugin. Depends on pySMART and smartmontools Must execute as root "usermod -a -G disk USERNAME" is not sufficient unfortunately SmartCTL (/usr/sbin/smartctl) must be in system path for python2. Regular PySMART is a python2 library. We are using the pySMART.smartx updated library to support both python 2 and 3. If we only have disk group access (no root): $ smartctl -i /dev/sda smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.15.0-30-generic] (local build) Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org Probable ATA device behind a SAT layer Try an additional '-d ata' or '-d sat' argument. This is not very hopeful: https://medium.com/opsops/why-smartctl-could-not-be-run-without-root-7ea0583b1323 So, here is what we are going to do: Check for admin access. If no admin access, disable SMART plugin. If smartmontools is not installed, we should catch the error upstream in plugin initialization. � )� GlancesPlugin)�logger)�disable)�is_admin)� DeviceListTz5Missing Python Lib ({}), HDD Smart plugin is disabledNFc C s. | j | j| j| j| j| j| j| j| j| j d� S )N) �name�num�flags�raw�value�worstZ threshold�type�updated�when_failed) r r r r r r Zthreshr r r )�attr� r �A/usr/lib/python3.9/site-packages/glances/plugins/glances_smart.py�convert_attribute_to_dict4 s �r c C s� g } z t � }W n< tyJ } z$t�d�|�� da| W Y d}~S d}~0 0 |jD ]�}| �dd�|j|j �i� |j D ]v}|du r�qvt|�}|�dd�}zW nB t y� } z*t�d�||�� W Y d}~qvW Y d}~n d}~0 0 || d |<