HEX
Server: LiteSpeed
System: Linux baran.dnsprotection.me 4.18.0-553.83.1.lve.el8.x86_64 #1 SMP Wed Nov 12 10:04:12 UTC 2025 x86_64
User: ddir12 (3618)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/glances/plugins/__pycache__/glances_load.cpython-36.opt-1.pyc
3

Eo�c<�@s�dZddlZddlZddlmZddlmZddlm	Z	ddl
mZddd	�d
dd	�ddd	�dd
d	�d�Zdddd�Z
ddd�ddd�ddd�gZGdd�de	�ZdS)zLoad plugin.�N)�	iteritems)�Plugin)�
GlancesPlugin)�loggerzrAverage sum of the number of processes waiting in the run-queue plus the number currently executing over 1 minute.�float)�descriptionZunitzsAverage sum of the number of processes waiting in the run-queue plus the number currently executing over 5 minutes.ztAverage sum of the number of processes waiting in the run-queue plus the number currently executing over 15 minutes.zTotal number of CPU core.Znumber)�min1�min5�min15�cpucorez1.3.6.1.4.1.2021.10.1.3.1z1.3.6.1.4.1.2021.10.1.3.2z1.3.6.1.4.1.2021.10.1.3.3)rr	r
rz
1 minute load)�namerr	z5 minutes loadr
z15 minutes loadcsTeZdZdZd
�fdd�	Zdd�Zejejdd���Z	�fd	d
�Z
ddd�Z�ZS)rz.Glances load plugin.

    stats is a dict
    Ncsvtt|�j||ttd�d|_yt|jd�j�d|_	Wn8t
k
rp}ztjdj
|��d|_	WYdd}~XnXdS)zInit the plugin.)�args�config�items_history_list�fields_descriptionT)r
�logz>Error: Can not retrieve the CPU core number (set it to 1) ({})�N)�superr�__init__rrZ
display_curse�
CorePluginr
�update�nb_log_core�	ExceptionrZwarning�format)�selfr
r�e)�	__class__��"/usr/lib/python3.6/glances_load.pyrDs
zPlugin.__init__cCsHytj�Sttfk
r YnXytj�Sttfk
rBdSXdS)z<Get load average. On both Linux and Windows thanks to PsUtilN)�psutil�
getloadavg�AttributeError�OSError�os)rrrr�_getloadavgTszPlugin._getloadavgcCs�|j�}|jdkrJ|j�}|dkr,|j�}q�|d|d|d|jd�}nZ|jdkr�|jtd�}|d	d
krx|j�}|Sx t|�D]\}}t|�||<q�W|j|d<||_|jS)zUpdate load stats.ZlocalNrr�)rr	r
rZsnmp)�snmp_oidr�r)	Zget_init_valueZinput_methodr$rZget_stats_snmpr&rr�stats)rr(�load�k�vrrrr_s 



z
Plugin.updatecs|tt|�j�yT|j|jdd|jdd�|jdd<|j|jdd|jdd�|jdd<Wntk
rvYnXdS)zUpdate stats views.r
�dr)Zmaximum�
decorationr	N)rr�update_viewsZ
get_alert_logr(ZviewsZ	get_alert�KeyError)r)rrrr.�s$,zPlugin.update_viewscCsTg}|js|jiks|j�r"|Sdjd�}|j|j|d��dj|j|jd���}|j|j|��d|jkr�|jddkr�djt|jd��}|j|j|��x�dD]�}|j|j��djd
j|��}|j|j|��|j	o�|j
dk�r|jdj|�|j
d}dj|�}n|jdj|�}dj|�}|j|j||jdj|�dd���q�W|S)z2Return the dict to display in the curse interface.z{:4}ZLOADZTITLEz {:1}rrrz{:3}core�1�5�15z{:7}z{} minzmin{}r,z	{:>5.1f}%z{:>6.2f}r-)�keyZoption)r0r1r2)r(Zis_disabledr�appendZcurse_add_lineZ	trend_msgZ	get_trend�intZcurse_new_lineZdisable_irixrZ	get_views)rr
Z	max_width�ret�msgZ	load_timeZ	load_statrrr�	msg_curse�s*


&zPlugin.msg_curse)NN)NN)
�__name__�
__module__�__qualname__�__doc__rr$rZ_check_decoratorZ_log_result_decoratorrr.r8�
__classcell__rr)rrr>s$r)r<r#rZglances.compatrZglances.plugins.glances_corerrZglances.plugins.glances_pluginrZglances.loggerrrr&rrrrr�<module>
s(