Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
e18be6cd
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,体验更适合开发者的 AI 搜索 >>
提交
e18be6cd
编写于
9月 14, 2016
作者:
N
Nicolargo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Do not highlight zero value on CPU and MEM processes list
上级
546df867
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
4 deletion
+16
-4
glances/plugins/glances_plugin.py
glances/plugins/glances_plugin.py
+14
-2
glances/plugins/glances_processlist.py
glances/plugins/glances_processlist.py
+2
-2
未找到文件。
glances/plugins/glances_plugin.py
浏览文件 @
e18be6cd
...
...
@@ -432,7 +432,13 @@ class GlancesPlugin(object):
"""Set the limits to input_limits."""
self
.
_limits
=
input_limits
def
get_alert
(
self
,
current
=
0
,
minimum
=
0
,
maximum
=
100
,
header
=
""
,
log
=
False
):
def
get_alert
(
self
,
current
=
0
,
minimum
=
0
,
maximum
=
100
,
highlight_zero
=
True
,
header
=
""
,
log
=
False
):
"""Return the alert status relative to a current value.
Use this function for minor stats.
...
...
@@ -442,13 +448,19 @@ class GlancesPlugin(object):
If current > WARNING of max then alert = WARNING
If current > CRITICAL of max then alert = CRITICAL
If highlight=True than 0.0 is highlighted
If defined 'header' is added between the plugin name and the status.
Only useful for stats with several alert status.
If log=True than add log if necessary
elif log=False than do not log
eli
g
log=None than apply the config given in the conf file
eli
f
log=None than apply the config given in the conf file
"""
# Manage 0 (0.0) value if highlight_zero is not True
if
not
highlight_zero
and
current
==
0
:
return
'DEFAULT'
# Compute the %
try
:
value
=
(
current
*
100
)
/
maximum
...
...
glances/plugins/glances_processlist.py
浏览文件 @
e18be6cd
...
...
@@ -199,7 +199,7 @@ class Plugin(GlancesPlugin):
else
:
msg
=
'{:>6.1f}'
.
format
(
p
[
'cpu_percent'
])
ret
.
append
(
self
.
curse_add_line
(
msg
,
self
.
get_alert
(
p
[
'cpu_percent'
],
header
=
"cpu"
)))
self
.
get_alert
(
p
[
'cpu_percent'
],
h
ighlight_zero
=
False
,
h
eader
=
"cpu"
)))
else
:
msg
=
'{:>6}'
.
format
(
'?'
)
ret
.
append
(
self
.
curse_add_line
(
msg
))
...
...
@@ -207,7 +207,7 @@ class Plugin(GlancesPlugin):
if
'memory_percent'
in
p
and
p
[
'memory_percent'
]
is
not
None
and
p
[
'memory_percent'
]
!=
''
:
msg
=
'{:>6.1f}'
.
format
(
p
[
'memory_percent'
])
ret
.
append
(
self
.
curse_add_line
(
msg
,
self
.
get_alert
(
p
[
'memory_percent'
],
header
=
"mem"
)))
self
.
get_alert
(
p
[
'memory_percent'
],
h
ighlight_zero
=
False
,
h
eader
=
"mem"
)))
else
:
msg
=
'{:>6}'
.
format
(
'?'
)
ret
.
append
(
self
.
curse_add_line
(
msg
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录