Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
4a42f729
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 搜索 >>
提交
4a42f729
编写于
9月 09, 2018
作者:
N
nicolargo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Disable automatic sorting between cpu_percent, io_counters and memory_percent #1317
上级
ea84db45
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
16 deletion
+10
-16
glances/events.py
glances/events.py
+10
-16
未找到文件。
glances/events.py
浏览文件 @
4a42f729
...
@@ -75,7 +75,7 @@ class GlancesEvents(object):
...
@@ -75,7 +75,7 @@ class GlancesEvents(object):
return
i
return
i
return
-
1
return
-
1
def
get_
process
_sort_key
(
self
,
event_type
):
def
get_
event
_sort_key
(
self
,
event_type
):
"""Return the process sort key"""
"""Return the process sort key"""
# Process sort depending on alert type
# Process sort depending on alert type
if
event_type
.
startswith
(
"MEM"
):
if
event_type
.
startswith
(
"MEM"
):
...
@@ -91,14 +91,13 @@ class GlancesEvents(object):
...
@@ -91,14 +91,13 @@ class GlancesEvents(object):
def
set_process_sort
(
self
,
event_type
):
def
set_process_sort
(
self
,
event_type
):
"""Define the process auto sort key from the alert type."""
"""Define the process auto sort key from the alert type."""
glances_processes
.
auto_sort
=
True
if
glances_processes
.
auto_sort
:
glances_processes
.
sort_key
=
self
.
get_process
_sort_key
(
event_type
)
glances_processes
.
sort_key
=
self
.
get_event
_sort_key
(
event_type
)
def
reset_process_sort
(
self
):
def
reset_process_sort
(
self
):
"""Reset the process auto sort key."""
"""Reset the process auto sort key."""
# Default sort is...
if
glances_processes
.
auto_sort
:
glances_processes
.
auto_sort
=
True
glances_processes
.
sort_key
=
'cpu_percent'
glances_processes
.
sort_key
=
'cpu_percent'
def
add
(
self
,
event_state
,
event_type
,
event_value
,
def
add
(
self
,
event_state
,
event_type
,
event_value
,
proc_list
=
None
,
proc_desc
=
""
,
peak_time
=
6
):
proc_list
=
None
,
proc_desc
=
""
,
peak_time
=
6
):
...
@@ -178,18 +177,11 @@ class GlancesEvents(object):
...
@@ -178,18 +177,11 @@ class GlancesEvents(object):
self
.
events_list
.
remove
(
self
.
events_list
[
event_index
])
self
.
events_list
.
remove
(
self
.
events_list
[
event_index
])
else
:
else
:
# Update the item
# Update the item
self
.
set_process_sort
(
event_type
)
# State
# State
if
event_state
==
"CRITICAL"
:
if
event_state
==
"CRITICAL"
:
self
.
events_list
[
event_index
][
2
]
=
event_state
self
.
events_list
[
event_index
][
2
]
=
event_state
# Value
# if event_value > self.events_list[event_index][4]:
# # MAX
# self.events_list[event_index][4] = event_value
# elif event_value < self.events_list[event_index][6]:
# # MIN
# self.events_list[event_index][6] = event_value
# Min value
# Min value
self
.
events_list
[
event_index
][
6
]
=
min
(
self
.
events_list
[
event_index
][
6
],
self
.
events_list
[
event_index
][
6
]
=
min
(
self
.
events_list
[
event_index
][
6
],
event_value
)
event_value
)
...
@@ -204,9 +196,11 @@ class GlancesEvents(object):
...
@@ -204,9 +196,11 @@ class GlancesEvents(object):
# TOP PROCESS LIST (only for CRITICAL ALERT)
# TOP PROCESS LIST (only for CRITICAL ALERT)
if
event_state
==
"CRITICAL"
:
if
event_state
==
"CRITICAL"
:
events_sort_key
=
self
.
get_event_sort_key
(
event_type
)
# Sort the current process list to retreive the TOP 3 processes
# Sort the current process list to retreive the TOP 3 processes
self
.
events_list
[
event_index
][
9
]
=
sort_stats
(
proc_list
,
glances_processes
.
sort_key
)[
0
:
3
]
self
.
events_list
[
event_index
][
9
]
=
sort_stats
(
proc_list
,
self
.
events_list
[
event_index
][
11
]
=
glances_processes
.
sort_key
events_sort_key
)[
0
:
3
]
self
.
events_list
[
event_index
][
11
]
=
events_sort_key
# MONITORED PROCESSES DESC
# MONITORED PROCESSES DESC
self
.
events_list
[
event_index
][
10
]
=
proc_desc
self
.
events_list
[
event_index
][
10
]
=
proc_desc
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录