Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
f0e8ef44
G
glances
项目概览
蜕变的菜鸟
/
glances
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
glances
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f0e8ef44
编写于
8月 17, 2019
作者:
N
nicolargo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor all the way config file is loaded (now by each plugin). Should solve issues #1508.
上级
504450ca
变更
36
显示空白变更内容
内联
并排
Showing
36 changed file
with
89 addition
and
56 deletion
+89
-56
conf/glances.conf
conf/glances.conf
+5
-3
glances/plugins/glances_alert.py
glances/plugins/glances_alert.py
+2
-1
glances/plugins/glances_amps.py
glances/plugins/glances_amps.py
+1
-0
glances/plugins/glances_cloud.py
glances/plugins/glances_cloud.py
+2
-2
glances/plugins/glances_core.py
glances/plugins/glances_core.py
+2
-2
glances/plugins/glances_cpu.py
glances/plugins/glances_cpu.py
+4
-2
glances/plugins/glances_diskio.py
glances/plugins/glances_diskio.py
+2
-1
glances/plugins/glances_docker.py
glances/plugins/glances_docker.py
+2
-1
glances/plugins/glances_folders.py
glances/plugins/glances_folders.py
+1
-0
glances/plugins/glances_fs.py
glances/plugins/glances_fs.py
+2
-1
glances/plugins/glances_gpu.py
glances/plugins/glances_gpu.py
+2
-1
glances/plugins/glances_help.py
glances/plugins/glances_help.py
+1
-1
glances/plugins/glances_ip.py
glances/plugins/glances_ip.py
+2
-2
glances/plugins/glances_irq.py
glances/plugins/glances_irq.py
+2
-1
glances/plugins/glances_load.py
glances/plugins/glances_load.py
+2
-1
glances/plugins/glances_mem.py
glances/plugins/glances_mem.py
+2
-1
glances/plugins/glances_memswap.py
glances/plugins/glances_memswap.py
+2
-1
glances/plugins/glances_network.py
glances/plugins/glances_network.py
+2
-1
glances/plugins/glances_now.py
glances/plugins/glances_now.py
+2
-2
glances/plugins/glances_percpu.py
glances/plugins/glances_percpu.py
+2
-1
glances/plugins/glances_plugin.py
glances/plugins/glances_plugin.py
+7
-2
glances/plugins/glances_ports.py
glances/plugins/glances_ports.py
+1
-0
glances/plugins/glances_processcount.py
glances/plugins/glances_processcount.py
+2
-1
glances/plugins/glances_processlist.py
glances/plugins/glances_processlist.py
+2
-1
glances/plugins/glances_psutilversion.py
glances/plugins/glances_psutilversion.py
+2
-2
glances/plugins/glances_quicklook.py
glances/plugins/glances_quicklook.py
+2
-1
glances/plugins/glances_raid.py
glances/plugins/glances_raid.py
+2
-2
glances/plugins/glances_sensors.py
glances/plugins/glances_sensors.py
+6
-5
glances/plugins/glances_smart.py
glances/plugins/glances_smart.py
+2
-1
glances/plugins/glances_system.py
glances/plugins/glances_system.py
+2
-2
glances/plugins/glances_uptime.py
glances/plugins/glances_uptime.py
+2
-2
glances/plugins/glances_wifi.py
glances/plugins/glances_wifi.py
+2
-1
glances/plugins/sensors/__init__.py
glances/plugins/sensors/__init__.py
+0
-0
glances/plugins/sensors/glances_batpercent.py
glances/plugins/sensors/glances_batpercent.py
+2
-1
glances/plugins/sensors/glances_hddtemp.py
glances/plugins/sensors/glances_hddtemp.py
+8
-5
glances/stats.py
glances/stats.py
+5
-5
未找到文件。
conf/glances.conf
浏览文件 @
f0e8ef44
...
...
@@ -188,15 +188,17 @@ critical=90
#folder_3_path=/nonexisting
#folder_4_path=/root
[
hddtemp
]
# Define hddtemp server IP and port (default is 127.0.0.1 and 7634 (TCP))
host
=
127
.
0
.
0
.
1
port
=
7634
[
sensors
]
# Sensors core thresholds (in Celsius...)
# Default values if not defined: 60/70/80
temperature_core_careful
=
60
temperature_core_warning
=
70
temperature_core_critical
=
80
# Define hddtemp server IP and port (default is 127.0.0.1 and 7634 (TCP))
hddtemp_host
=
127
.
0
.
0
.
1
hddtemp_port
=
7634
# Temperatures threshold in °C for hddtemp
# Default values if not defined: 45/52/60
temperature_hdd_careful
=
45
...
...
glances/plugins/glances_alert.py
浏览文件 @
f0e8ef44
...
...
@@ -88,9 +88,10 @@ class Plugin(GlancesPlugin):
Only for display.
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
stats_init_value
=
[])
# We want to display the stat in the curse interface
...
...
glances/plugins/glances_amps.py
浏览文件 @
f0e8ef44
...
...
@@ -30,6 +30,7 @@ class Plugin(GlancesPlugin):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
stats_init_value
=
[])
self
.
args
=
args
self
.
config
=
config
...
...
glances/plugins/glances_cloud.py
浏览文件 @
f0e8ef44
...
...
@@ -51,9 +51,9 @@ class Plugin(GlancesPlugin):
stats is a dict
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
)
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
)
# We want to display the stat in the curse interface
self
.
display_curse
=
True
...
...
glances/plugins/glances_core.py
浏览文件 @
f0e8ef44
...
...
@@ -32,9 +32,9 @@ class Plugin(GlancesPlugin):
stats is integer (number of core)
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
)
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
)
# We dot not want to display the stat in the curse interface
# The core number is displayed by the load plugin
...
...
glances/plugins/glances_cpu.py
浏览文件 @
f0e8ef44
...
...
@@ -59,9 +59,11 @@ class Plugin(GlancesPlugin):
percentage.
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the CPU plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
items_history_list
=
items_history_list
)
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
items_history_list
=
items_history_list
)
# We want to display the stat in the curse interface
self
.
display_curse
=
True
...
...
glances/plugins/glances_diskio.py
浏览文件 @
f0e8ef44
...
...
@@ -42,9 +42,10 @@ class Plugin(GlancesPlugin):
stats is a list
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
items_history_list
=
items_history_list
,
stats_init_value
=
[])
...
...
glances/plugins/glances_docker.py
浏览文件 @
f0e8ef44
...
...
@@ -72,9 +72,10 @@ class Plugin(GlancesPlugin):
stats is a dict: {'version': {...}, 'containers': [{}, {}]}
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
items_history_list
=
items_history_list
)
# The plgin can be disable using: args.disable_docker
...
...
glances/plugins/glances_folders.py
浏览文件 @
f0e8ef44
...
...
@@ -34,6 +34,7 @@ class Plugin(GlancesPlugin):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
stats_init_value
=
[])
self
.
args
=
args
self
.
config
=
config
...
...
glances/plugins/glances_fs.py
浏览文件 @
f0e8ef44
...
...
@@ -70,9 +70,10 @@ class Plugin(GlancesPlugin):
stats is a list
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
items_history_list
=
items_history_list
,
stats_init_value
=
[])
...
...
glances/plugins/glances_gpu.py
浏览文件 @
f0e8ef44
...
...
@@ -48,9 +48,10 @@ class Plugin(GlancesPlugin):
stats is a list of dictionaries with one entry per GPU
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
stats_init_value
=
[])
# Init the NVidia API
...
...
glances/plugins/glances_help.py
浏览文件 @
f0e8ef44
...
...
@@ -32,7 +32,7 @@ class Plugin(GlancesPlugin):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
)
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
)
# Set the config instance
self
.
config
=
config
...
...
glances/plugins/glances_ip.py
浏览文件 @
f0e8ef44
...
...
@@ -53,9 +53,9 @@ class Plugin(GlancesPlugin):
stats is a dict
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
)
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
)
# We want to display the stat in the curse interface
self
.
display_curse
=
True
...
...
glances/plugins/glances_irq.py
浏览文件 @
f0e8ef44
...
...
@@ -33,9 +33,10 @@ class Plugin(GlancesPlugin):
stats is a list
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
stats_init_value
=
[])
# We want to display the stat in the curse interface
...
...
glances/plugins/glances_load.py
浏览文件 @
f0e8ef44
...
...
@@ -50,9 +50,10 @@ class Plugin(GlancesPlugin):
stats is a dict
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
items_history_list
=
items_history_list
)
# We want to display the stat in the curse interface
...
...
glances/plugins/glances_mem.py
浏览文件 @
f0e8ef44
...
...
@@ -59,9 +59,10 @@ class Plugin(GlancesPlugin):
stats is a dict
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
items_history_list
=
items_history_list
)
# We want to display the stat in the curse interface
...
...
glances/plugins/glances_memswap.py
浏览文件 @
f0e8ef44
...
...
@@ -47,9 +47,10 @@ class Plugin(GlancesPlugin):
stats is a dict
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
items_history_list
=
items_history_list
)
# We want to display the stat in the curse interface
...
...
glances/plugins/glances_network.py
浏览文件 @
f0e8ef44
...
...
@@ -51,9 +51,10 @@ class Plugin(GlancesPlugin):
stats is a list
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
items_history_list
=
items_history_list
,
stats_init_value
=
[])
...
...
glances/plugins/glances_now.py
浏览文件 @
f0e8ef44
...
...
@@ -31,9 +31,9 @@ class Plugin(GlancesPlugin):
stats is (string)
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
)
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
)
# We want to display the stat in the curse interface
self
.
display_curse
=
True
...
...
glances/plugins/glances_percpu.py
浏览文件 @
f0e8ef44
...
...
@@ -39,9 +39,10 @@ class Plugin(GlancesPlugin):
for each CPU.
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
items_history_list
=
items_history_list
,
stats_init_value
=
[])
...
...
glances/plugins/glances_plugin.py
浏览文件 @
f0e8ef44
...
...
@@ -41,6 +41,7 @@ class GlancesPlugin(object):
def
__init__
(
self
,
args
=
None
,
config
=
None
,
items_history_list
=
None
,
stats_init_value
=
{}):
"""Init the plugin of plugins class.
...
...
@@ -66,7 +67,8 @@ class GlancesPlugin(object):
:stats_init_value: Default value for a stats item
"""
# Plugin name (= module name without glances_)
self
.
plugin_name
=
self
.
__class__
.
__module__
[
len
(
'glances_'
):]
pos
=
self
.
__class__
.
__module__
.
find
(
'glances_'
)
+
len
(
'glances'
)
+
1
self
.
plugin_name
=
self
.
__class__
.
__module__
[
pos
:]
# logger.debug("Init plugin %s" % self.plugin_name)
# Init the args
...
...
@@ -83,8 +85,11 @@ class GlancesPlugin(object):
self
.
items_history_list
=
items_history_list
self
.
stats_history
=
self
.
init_stats_history
()
# Init the limits dictionnary
# Init the limits
(configuration keys)
dictionnary
self
.
_limits
=
dict
()
if
not
self
.
load_limits
(
config
=
config
):
logger
.
debug
(
'Can not load section {} in {}'
.
format
(
self
.
plugin_name
,
config
))
# Init the actions
self
.
actions
=
GlancesActions
(
args
=
args
)
...
...
glances/plugins/glances_ports.py
浏览文件 @
f0e8ef44
...
...
@@ -48,6 +48,7 @@ class Plugin(GlancesPlugin):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
stats_init_value
=
[])
self
.
args
=
args
self
.
config
=
config
...
...
glances/plugins/glances_processcount.py
浏览文件 @
f0e8ef44
...
...
@@ -51,9 +51,10 @@ class Plugin(GlancesPlugin):
'name'
:
'process name'
,
None
:
'None'
}
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
items_history_list
=
items_history_list
)
# We want to display the stat in the curse interface
...
...
glances/plugins/glances_processlist.py
浏览文件 @
f0e8ef44
...
...
@@ -91,9 +91,10 @@ class Plugin(GlancesPlugin):
'name'
:
'[{}]'
}
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
stats_init_value
=
[])
# We want to display the stat in the curse interface
...
...
glances/plugins/glances_psutilversion.py
浏览文件 @
f0e8ef44
...
...
@@ -29,9 +29,9 @@ class Plugin(GlancesPlugin):
stats is a tuple
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
)
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
)
self
.
reset
()
...
...
glances/plugins/glances_quicklook.py
浏览文件 @
f0e8ef44
...
...
@@ -59,9 +59,10 @@ class Plugin(GlancesPlugin):
'stats' is a dictionary.
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the quicklook plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
items_history_list
=
items_history_list
)
# We want to display the stat in the curse interface
self
.
display_curse
=
True
...
...
glances/plugins/glances_raid.py
浏览文件 @
f0e8ef44
...
...
@@ -39,9 +39,9 @@ class Plugin(GlancesPlugin):
stats is a dict (see pymdstat documentation)
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
)
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
)
# We want to display the stat in the curse interface
self
.
display_curse
=
True
...
...
glances/plugins/glances_sensors.py
浏览文件 @
f0e8ef44
...
...
@@ -24,8 +24,8 @@ import warnings
from
glances.logger
import
logger
from
glances.compat
import
iteritems
from
glances.plugins.glances_batpercent
import
Plugin
as
BatPercentPlugin
from
glances.plugins.glances_hddtemp
import
Plugin
as
HddTempPlugin
from
glances.plugins.
sensors.
glances_batpercent
import
Plugin
as
BatPercentPlugin
from
glances.plugins.
sensors.
glances_hddtemp
import
Plugin
as
HddTempPlugin
from
glances.plugins.glances_plugin
import
GlancesPlugin
SENSOR_TEMP_UNIT
=
'C'
...
...
@@ -45,9 +45,10 @@ class Plugin(GlancesPlugin):
The hard disks are already sorted by name.
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
stats_init_value
=
[])
# Init the sensor class
...
...
@@ -55,11 +56,11 @@ class Plugin(GlancesPlugin):
# Instance for the HDDTemp Plugin in order to display the hard disks
# temperatures
self
.
hddtemp_plugin
=
HddTempPlugin
(
args
=
args
)
self
.
hddtemp_plugin
=
HddTempPlugin
(
args
=
args
,
config
=
config
)
# Instance for the BatPercent in order to display the batteries
# capacities
self
.
batpercent_plugin
=
BatPercentPlugin
(
args
=
args
)
self
.
batpercent_plugin
=
BatPercentPlugin
(
args
=
args
,
config
=
config
)
# We want to display the stat in the curse interface
self
.
display_curse
=
True
...
...
glances/plugins/glances_smart.py
浏览文件 @
f0e8ef44
...
...
@@ -152,6 +152,7 @@ class Plugin(GlancesPlugin):
def
__init__
(
self
,
args
=
None
,
config
=
None
,
stats_init_value
=
[]):
"""Init the plugin."""
# check if user is admin
...
...
@@ -159,7 +160,7 @@ class Plugin(GlancesPlugin):
disable
(
args
,
"smart"
)
logger
.
debug
(
"Current user is not admin, HDD SMART plugin disabled."
)
super
(
Plugin
,
self
).
__init__
(
args
=
args
)
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
)
# We want to display the stat in the curse interface
self
.
display_curse
=
True
...
...
glances/plugins/glances_system.py
浏览文件 @
f0e8ef44
...
...
@@ -83,9 +83,9 @@ class Plugin(GlancesPlugin):
stats is a dict
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
)
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
)
# We want to display the stat in the curse interface
self
.
display_curse
=
True
...
...
glances/plugins/glances_uptime.py
浏览文件 @
f0e8ef44
...
...
@@ -35,9 +35,9 @@ class Plugin(GlancesPlugin):
stats is date (string)
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
)
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
)
# We want to display the stat in the curse interface
self
.
display_curse
=
True
...
...
glances/plugins/glances_wifi.py
浏览文件 @
f0e8ef44
...
...
@@ -49,9 +49,10 @@ class Plugin(GlancesPlugin):
Get stats of the current Wifi hotspots.
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
stats_init_value
=
[])
# We want to display the stat in the curse interface
...
...
glances/plugins/sensors/__init__.py
0 → 100644
浏览文件 @
f0e8ef44
glances/plugins/glances_batpercent.py
→
glances/plugins/
sensors/
glances_batpercent.py
浏览文件 @
f0e8ef44
...
...
@@ -49,9 +49,10 @@ class Plugin(GlancesPlugin):
stats is a list
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
stats_init_value
=
[])
# Init the sensor class
...
...
glances/plugins/glances_hddtemp.py
→
glances/plugins/
sensors/
glances_hddtemp.py
浏览文件 @
f0e8ef44
...
...
@@ -33,17 +33,20 @@ class Plugin(GlancesPlugin):
stats is a list
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
,
config
=
None
):
"""Init the plugin."""
super
(
Plugin
,
self
).
__init__
(
args
=
args
,
config
=
config
,
stats_init_value
=
[])
# Init the sensor class
hddtemp_host
=
self
.
get_conf_value
(
"host"
,
default
=
[
"127.0.0.1"
])[
0
]
hddtemp_port
=
int
(
self
.
get_conf_value
(
"port"
,
default
=
"7634"
))
self
.
hddtemp
=
GlancesGrabHDDTemp
(
args
=
args
,
host
=
self
.
get_conf_value
(
"hddtemp_host"
,
default
=
"127.0.0.1"
),
port
=
int
(
self
.
get_conf_value
(
"hddtemp_port"
,
default
=
"7634"
)))
host
=
hddtemp_host
,
port
=
hddtemp_port
)
# We do not want to display the stat in a dedicated area
# The HDD temp is displayed within the sensors plugin
...
...
glances/stats.py
浏览文件 @
f0e8ef44
...
...
@@ -47,7 +47,8 @@ class GlancesStats(object):
self
.
load_modules
(
self
.
args
)
# Load the limits (for plugins)
self
.
load_limits
(
self
.
config
)
# Not necessary anymore, configuration file is loaded on init
# self.load_limits(self.config)
def
__getattr__
(
self
,
item
):
"""Overwrite the getattr method in case of attribute is not found.
...
...
@@ -109,14 +110,13 @@ class GlancesStats(object):
# for example, the file glances_xxx.py
# generate self._plugins_list["xxx"] = ...
name
=
plugin_script
[
len
(
self
.
header
):
-
3
].
lower
()
# Loaf the plugin class
try
:
# Import the plugin
plugin
=
__import__
(
plugin_script
[:
-
3
])
# Init and add the plugin to the dictionary
if
name
in
(
'help'
,
'amps'
,
'ports'
,
'folders'
):
self
.
_plugins
[
name
]
=
plugin
.
Plugin
(
args
=
args
,
config
=
config
)
else
:
self
.
_plugins
[
name
]
=
plugin
.
Plugin
(
args
=
args
)
except
Exception
as
e
:
# If a plugin can not be loaded, display a critical message
# on the console but do not crash
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录