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_alert.cpython-36.pyc
3

Eo�c*�@s$dZddlmZddlmZddlmZddlmZdgdd�dd	gd
d�ddgd
d�d
dgd
d�ddgd
d�ddgd
d�ddgd
d�ddgd
d�ddgd
d�g	Zdddddiddid�iddid�idd	ddiddd idd!id�id�iddidd"id�d�id�iZ	d#d$�Z
Gd%d&�d&e�Zd'S)(z
Alert plugin.�)�datetime)�glances_events)�glances_thresholds)�
GlancesPluginz%No warning or critical alert detected)�msg�
thresholds�thresholds_minzHigh CPU user modeZcpu_user�zHigh CPU kernel usageZ
cpu_systemzHigh CPU I/O waitingZ
cpu_iowaitzALarge CPU stolen time. System running the hypervisor is too busy.Z	cpu_stealzHigh CPU niced valueZ	cpu_nicedz'System overloaded in the last 5 minutes�loadzHigh swap (paging) usageZmemswapzHigh memory consumptionZmemZ_msgzMemory issuez
Swap issue)Z_yesZ_noz	I/O issueZ	cpu_totalzCPU issue with user process(es)zJCPU issue with stolen time. System running the hypervisor may be too busy.z!CPU issue with system process(es)zExternal issuecsltj��x*tD]"}t�fdd�|dD��|d<qWttdd�d�}|d|dkr\|d	Std
d	SdS)zvParse the decision tree and return the message.

    Note: message corresponding to the current thresholds values
    cs g|]}|�kr�|j��qS�)�value)�.0�t)�current_thresholdsr�#/usr/lib/python3.6/glances_alert.py�
<listcomp>�sz"global_message.<locals>.<listcomp>r�weightcSs|dS)Nrr)�drrr�<lambda>�sz global_message.<locals>.<lambda>)�keyrrrN)r�get�tree�sum�max)�iZthemaxr)rr�global_message�s
"rcs>eZdZdZd�fdd�	Zdd�Zd
dd�Zdd
d�Z�ZS)�Pluginz1Glances alert plugin.

    Only for display.
    Ncs&tt|�j||gd�d|_d|_dS)zInit the plugin.)�args�configZstats_init_valueTZbottomN)�superr�__init__Z
display_curseZalign)�selfrr)�	__class__rrr �szPlugin.__init__cCstj�|_dS)z7Nothing to do here. Just return the global glances_log.N)rr�stats)r!rrr�update�sz
Plugin.updatecCs�g}|js|j�r|S|j|jt�d���xx|jD�]l}|j|j��ttj|d��}|j|j|��|ddkr�dj	tj|d�tj|d��}nd}|j|j|��|j|jd��|ddkr�dj	|d|d	�}|j|j|��n$t|d	�}|j|j||dd
��|j
|d|dd
d��r@dj	|d�}ndj	|d|d|d�}|j|j|��djdd�|dD��}|dkr6dj	|�}|j|j|��q6W|S)z2Return the dict to display in the curse interface.ZTITLEr�z ({})z
 (ongoing)z - z{} on {}r	�)Z
decoration��g�������?)�	tolerancez	 ({:.1f})�z$ (Min:{:.1f} Mean:{:.1f} Max:{:.1f})z, cSsg|]}|d�qS)�namer)r
�prrrr�sz$Plugin.msg_curse.<locals>.<listcomp>�	�z: {})r#Zis_disabled�appendZcurse_add_linerZcurse_new_line�strrZ
fromtimestamp�format�approx_equal�join)r!rZ	max_width�retZalertrZtop_processrrr�	msg_curse�s6$
zPlugin.msg_curse�cCsNtt|��j�rBtt|��j�rBt||�tt|�t|��|kS||kSdS)z4Compare a with b using the tolerance (if numerical).N)r0�int�isdigit�absr)r!�a�br)rrrr2�s "zPlugin.approx_equal)NN)NN)r6)	�__name__�
__module__�__qualname__�__doc__r r$r5r2�
__classcell__rr)r"rr�s

	
1rN)r?rZglances.eventsrZglances.thresholdsrZglances.plugins.glances_pluginrrZtree_newrrrrrr�<module>
s>