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

Eo�c�	�@sDdZddlmZmZddlmZddlZddiZGdd�de�ZdS)	zUptime plugin.�)�datetime�	timedelta)�
GlancesPluginN�_uptimez1.3.6.1.2.1.1.3.0csHeZdZdZd�fdd�	Zdd�Zejejdd���Z	dd	d
�Z
�ZS)
�Pluginz7Glances uptime plugin.

    stats is date (string)
    Ncs<tt|�j||d�d|_d|_tj�tjtj	��|_
dS)zInit the plugin.)�args�configT�rightN)�superr�__init__Z
display_curseZalignr�now�
fromtimestamp�psutil�	boot_time�uptime)�selfrr)�	__class__��$/usr/lib/python3.6/glances_uptime.pyrszPlugin.__init__cCsdt|jj��iS)zPOverwrite the default export method.

        Export uptime in seconds.
        �seconds)�intrZ
total_seconds)rrrr�
get_export)szPlugin.get_exportcCs�|j�}|jdkr@tj�tjtj��|_t|j�j	d�d}nJ|jdkr�|j
td�d}yttt
|�dd��}Wntk
r�YnX||_|jS)	z*Update uptime stat using the input method.Zlocal�.rZsnmp)�snmp_oidr�d)r)Zget_init_valueZinput_methodrrr
rrr�str�splitZget_stats_snmprrr�	Exception�stats)rrrrrr�update2s

z
Plugin.updatecCs0g}|js|j�r|S|jdj|j��g}|S)z4Return the string to display in the curse interface.z
Uptime: {})rZis_disabledZcurse_add_line�format)rrZ	max_width�retrrr�	msg_curseMs
zPlugin.msg_curse)NN)NN)�__name__�
__module__�__qualname__�__doc__rrrZ_check_decoratorZ_log_result_decoratorrr"�
__classcell__rr)rrrs
	r)r&rrZglances.plugins.glances_pluginrrrrrrrr�<module>
s