File: //usr/local/lib/python3.9/site-packages/agent360/plugins/__pycache__/system.cpython-39.pyc
a
q�dg� � @ s� zd dl Z W n ey" dZ Y n0 d dlZd dlZd dlmZmZ d dlZd dlZd dl Z d dl
Z
zd dlZW n ey� dZY n0 d
dd�Zdd� Z
dd � ZG d
d� de
j�Zedkr�e� �� dS )� N)�Popen�PIPETc C sz d}d}z t | �� td�}|�� d }W n ty: Y n0 |rZ|du rT|�d�}q^|}ng }|rn|�d�}ng }||fS )N� )�stdoutr T�
)r �splitr �communicate� Exception)�Command�newlinesZOutput�Error�procZStdoutZStderr� r �A/usr/local/lib/python3.9/site-packages/agent360/plugins/system.py�
systemCommand s r c
C s d} z�t dd��"}t|�� �� d�} W d � n1 s80 Y d}t�d���}|D ]j}|j�d�shqVt |jd d��8}d|�� �� kr�W d � qVn|| 7 }W d � qV1 s�0 Y qVW d � n1 s�0 Y |W S t � y� Y dS 0 d S ) Nr z+/sys/devices/system/memory/block_size_bytes�r� z/sys/devices/system/memory/�memoryz/stateZonline)
�open�int�readline�strip�os�scandir�name�
startswith�pathr )�
block_size�fr �it�entryr r r �linux_hardware_memory+ s 0Fr! c C s� i } i | d<