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: //usr/lib/python3.6/site-packages/glances/plugins/__pycache__/glances_system.cpython-36.opt-1.pyc
3

Eo�c�
@s�dZddlZddlZddlZddlmZddlmZddlm	Z	ddd�ddd	d
�d�Z
dd
dddddddd�iZdd�ZGdd�de	�Z
dS)zSystem plugin.�N)�open)�	iteritems)�
GlancesPluginz1.3.6.1.2.1.1.5.0z1.3.6.1.2.1.1.1.0)�hostname�system_namez1.3.6.1.4.1.789.1.1.5.0)rr�platform)�defaultZnetapp�windowszWindows 10 or Server 2016zWindows 8.1 or Server 2012R2zWindows 8 or Server 2012zWindows 7 or Server 2008R2zWindows Vista or Server 2008z Windows XP 64bits or 2003 serverz
Windows XPzWindows 2000)zWindows Version 10.0zWindows Version 6.3zWindows Version 6.2zWindows Version 6.1zWindows Version 6.0zWindows Version 5.2zWindows Version 5.1zWindows Version 5.0cCs�d}i}ddg}yhttjjdd���L}xD|D]<}x6|D].}|j|�r6tjdd|j�jd�d�||<q6Wq,WWd	QRXWnt	t
fk
r�|SX|r�d|kr�|d}d|kr�|d
j|d�7}|S)aTry to determine the name of a Linux distribution.

    This function checks for the /etc/os-release file.
    It takes the name from the 'NAME' field and the version from 'VERSION_ID'.
    An empty string is returned if the above values cannot be determined.
    ��NAMEZ
VERSION_IDz/etcz
os-releasez^"|"$�=�Nz {})r�os�path�join�
startswith�re�sub�strip�split�OSError�IOError�format)Zpretty_nameZashtray�keys�f�line�key�r�$/usr/lib/python3.6/glances_system.py�_linux_os_release0s"


6rcs@eZdZdZd	�fdd�	Zejejdd���Zd
dd�Z	�Z
S)�Pluginz6Glances' host/system plugin.

    stats is a dict
    Ncs0tt|�j||d�d|_|j�r,|jd�dS)zInit the plugin.)�args�configT�<N)�superr �__init__Z
display_curseZget_refreshZset_refresh)�selfr!r")�	__class__rrr%SszPlugin.__init__cCsR|j�}|jdk�r�tj�|d<tj�|d<tj�d|d<|ddkr�ytj�}Wntk
rrt�|d<Yn0X|ddkr�t�|d<nd	j	|d
d��|d<tj
�|d<n�|djd
�s�|ddkr�tj
�|d<nx|ddkr�tj�d|d<nZ|ddk�rHtj
�}d	j	|d
d
d��|d<|ddk�rPdtjk�rPd|d<nd|d<|ddk�rl|d|d<ndj|d|d�|d<|ddj|d�7<n�|jdk�rFy|jt|jd�}Wn&tk
�r�|jtdd�}YnX|d|d<|jdk�r:x6ttd�D]&\}}tj||d��r||d<P�qW|d|d<||_|jS)z]Update the host/system info using the input method.

        :return: the stats dict
        Zlocal�os_namerrr�Linux�linux_distror
� N��
os_versionZBSDZSunOSZDarwinZWindows�32bitZPROCESSOR_ARCHITEW6432�64bitZhr_namez{} {}z {}�snmp)�snmp_oidrrr	)Zget_init_valueZinput_methodr�systemZnodeZarchitectureZlinux_distribution�AttributeErrorrr�release�endswithZmac_verZ	win32_verr�environrZget_stats_snmpr1Zshort_system_name�KeyErrorr�
snmp_to_humanr�search�stats)r&r:r*r-�r�vrrr�update^sT
z
Plugin.updatec
CsPg}|js|j�r|S|jr�|jj�dkrDd}|j|j|d��nJ|jj�dkrjd}|j|j|d��n$|jj�dkr�d}|j|j|d��|jd	}|j|j|d
��|jddkr�|jd
r�dj|jd
|jd|jd|jd�}nLy$dj|jd|jd|jd�}Wn&tk
�r6dj|jd�}YnX|j|j|dd��|S)z4Return the string to display in the curse interface.Z	connectedz
Connected to ZOKr0z
SNMP from ZdisconnectedzDisconnected from ZCRITICALrZTITLEr(r)r*z ({} {} / {} {})rr-z ({} {} {})z ({})T)Zoptional)	r:Zis_disabledZclientZ	cs_status�lower�appendZcurse_add_liner�	Exception)r&r!Z	max_width�ret�msgrrr�	msg_curse�s0
&$zPlugin.msg_curse)NN)NN)�__name__�
__module__�__qualname__�__doc__r%rZ_check_decoratorZ_log_result_decoratorr=rC�
__classcell__rr)r'rr Ls
Cr )rGrrr�iorZglances.compatrZglances.plugins.glances_pluginrr1r8rr rrrr�<module>
s*