Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
6f4b6d6e
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,发现更多精彩内容 >>
提交
6f4b6d6e
编写于
3月 25, 2013
作者:
M
MendelGusmao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adding a specific entry in conf to deal with hdd temperatures' limits
上级
3253ee78
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
61 addition
and
5 deletion
+61
-5
glances/conf/glances.conf
glances/conf/glances.conf
+8
-1
glances/glances.py
glances/glances.py
+53
-4
未找到文件。
glances/conf/glances.conf
浏览文件 @
6f4b6d6e
...
...
@@ -43,12 +43,19 @@ warning=70
critical
=
90
[
temperature
]
# Temperatures in °C for sensors
/hddtemp
# Temperatures in °C for sensors
# Defaults values if not defined: 60/70/80
careful
=
60
warning
=
70
critical
=
80
[
hddtemperature
]
# Temperatures in °C for hddtemp
# Defaults values if not defined: 45/52/60
careful
=
45
warning
=
52
critical
=
60
[
filesystem
]
# Defaults limits for free filesytem space in %
# Defaults values if not defined: 50/70/90
...
...
glances/glances.py
浏览文件 @
6f4b6d6e
...
...
@@ -255,7 +255,8 @@ class glancesLimits:
STD is for defaults limits (CPU/MEM/SWAP/FS)
CPU_IOWAIT limits (iowait in %)
LOAD is for LOAD limits (5 min/15 min)
TEMP is for sensors/hddtemp limits (temperature in °C)
TEMP is for sensors limits (temperature in °C)
HDDTEMP is for hddtemp limits (temperature in °C)
"""
__limits_list
=
{
'STD'
:
[
50
,
70
,
90
],
'CPU_USER'
:
[
50
,
70
,
90
],
...
...
@@ -265,6 +266,7 @@ class glancesLimits:
'MEM'
:
[
50
,
70
,
90
],
'SWAP'
:
[
50
,
70
,
90
],
'TEMP'
:
[
60
,
70
,
80
],
'HDDTEMP'
:
[
45
,
52
,
60
],
'FS'
:
[
50
,
70
,
90
],
'PROCESS_CPU'
:
[
50
,
70
,
90
],
'PROCESS_MEM'
:
[
50
,
70
,
90
]}
...
...
@@ -307,6 +309,11 @@ class glancesLimits:
self
.
__setLimits
(
'TEMP'
,
'temperature'
,
'careful'
)
self
.
__setLimits
(
'TEMP'
,
'temperature'
,
'warning'
)
self
.
__setLimits
(
'TEMP'
,
'temperature'
,
'critical'
)
if
config
.
has_section
(
'hddtemperature'
):
# Read HDDTEMP limits
self
.
__setLimits
(
'HDDTEMP'
,
'hddtemperature'
,
'careful'
)
self
.
__setLimits
(
'HDDTEMP'
,
'hddtemperature'
,
'warning'
)
self
.
__setLimits
(
'HDDTEMP'
,
'hddtemperature'
,
'critical'
)
if
config
.
has_section
(
'filesystem'
):
# Read FS limits
self
.
__setLimits
(
'FS'
,
'filesystem'
,
'careful'
)
...
...
@@ -409,6 +416,15 @@ class glancesLimits:
def
getTEMPCritical
(
self
):
return
self
.
getCritical
(
'TEMP'
)
def
getHDDTEMPCareful
(
self
):
return
self
.
getCareful
(
'HDDTEMP'
)
def
getHDDTEMPWarning
(
self
):
return
self
.
getWarning
(
'HDDTEMP'
)
def
getHDDTEMPCritical
(
self
):
return
self
.
getCritical
(
'HDDTEMP'
)
def
getFSCareful
(
self
):
return
self
.
getCareful
(
'FS'
)
...
...
@@ -1730,6 +1746,35 @@ class glancesScreen:
"""
return
self
.
__colors_list2
[
self
.
__getSensorsAlert
(
current
)]
def
__getHDDTempAlert
(
self
,
current
=
0
):
# Alert for HDDTemp (temperature in degre)
# If current < CAREFUL then alert = OK
# If current > CAREFUL then alert = CAREFUL
# If current > WARNING then alert = WARNING
# If current > CRITICALthen alert = CRITICAL
if
current
>
limits
.
getHDDTEMPCritical
():
return
'CRITICAL'
elif
current
>
limits
.
getHDDTEMPWarning
():
return
'WARNING'
elif
current
>
limits
.
getHDDTEMPCareful
():
return
'CAREFUL'
return
'OK'
def
__getHDDTempColor
(
self
,
current
=
0
):
"""
Return color for HDDTemp temperature
"""
return
self
.
__colors_list
[
self
.
__getHDDTempAlert
(
current
)]
def
__getHDDTempColor2
(
self
,
current
=
0
):
"""
Return color for HDDTemp temperature
"""
return
self
.
__colors_list2
[
self
.
__getHDDTempAlert
(
current
)]
def
__getProcessAlert
(
self
,
current
=
0
,
max
=
100
,
stat
=
''
,
core
=
1
):
# If current < CAREFUL of max then alert = OK
# If current > CAREFUL of max then alert = CAREFUL
...
...
@@ -2458,7 +2503,7 @@ class glancesScreen:
self
.
term_window
.
addnstr
(
self
.
hddtemp_y
+
1
+
i
,
self
.
hddtemp_x
+
20
,
format
(
hddtemp
[
i
][
'value'
],
'>3'
),
3
,
self
.
__get
Sensors
Color
(
hddtemp
[
i
][
'value'
]))
self
.
__get
HDDTemp
Color
(
hddtemp
[
i
][
'value'
]))
ret
=
ret
+
1
return
ret
return
0
...
...
@@ -2969,8 +3014,9 @@ class glancesScreen:
stat_labels
=
[
_
(
"CPU user %"
),
_
(
"CPU system %"
),
_
(
"CPU iowait %"
),
_
(
"Load"
),
_
(
"RAM memory %"
),
_
(
"Swap memory %"
),
_
(
"Temp °C"
),
_
(
"Filesystem %"
),
_
(
"CPU process %"
),
_
(
"MEM process %"
)]
_
(
"Temp °C"
),
_
(
"HDD Temp °C"
),
_
(
"Filesystem %"
),
_
(
"CPU process %"
),
_
(
"MEM process %"
)]
width
=
8
limits_table_x
=
self
.
help_x
+
2
...
...
@@ -3002,6 +3048,9 @@ class glancesScreen:
[
0
,
limits
.
getTEMPCareful
(),
limits
.
getTEMPWarning
(),
limits
.
getTEMPCritical
()],
[
0
,
limits
.
getHDDTEMPCareful
(),
limits
.
getHDDTEMPWarning
(),
limits
.
getHDDTEMPCritical
()],
[
0
,
limits
.
getFSCareful
(),
limits
.
getFSWarning
(),
limits
.
getFSCritical
()],
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录