Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
7c1e039e
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 搜索 >>
提交
7c1e039e
编写于
11月 15, 2020
作者:
N
nicolargo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Filter docker containers #1748
上级
bc0cf31a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
31 addition
and
15 deletion
+31
-15
conf/glances.conf
conf/glances.conf
+5
-1
docs/aoa/docker.rst
docs/aoa/docker.rst
+4
-0
docs/man/glances.1
docs/man/glances.1
+1
-10
glances/plugins/glances_docker.py
glances/plugins/glances_docker.py
+5
-1
glances/plugins/glances_plugin.py
glances/plugins/glances_plugin.py
+16
-3
未找到文件。
conf/glances.conf
浏览文件 @
7c1e039e
...
...
@@ -327,7 +327,11 @@ port_default_gateway=True
[
docker
]
disable
=
False
# Hide some containers (comma separeted list)
# Only show specific containers (comma separeted list of container name or regular expression)
# Comment this line to display all containers (default configuration)
#show=telegraf
# Hide some containers (comma separeted list of container name or regular expression)
# Comment this line to display all containers (default configuration)
#hide=telegraf
# Define the maximum docker size name (default is 20 chars)
max_name_size
=
20
...
...
docs/aoa/docker.rst
浏览文件 @
7c1e039e
...
...
@@ -21,6 +21,10 @@ under the ``[docker]`` section:
[docker]
disable=False
# Only show specific containers (comma separeted list of container name or regular expression)
show=thiscontainer,andthisone,andthoseones.*
# Hide some containers (comma separeted list of container name or regular expression)
hide=donotshowthisone,andthose.*
# Define the maximum docker size name (default is 20 chars)
max_name_size=20
# Global containers' thresholds for CPU and MEM (in %)
...
...
docs/man/glances.1
浏览文件 @
7c1e039e
.\" Man page generated from reStructuredText.
.
.TH "GLANCES" "1" "Nov
07
, 2020" "3.1.6_b1" "Glances"
.TH "GLANCES" "1" "Nov
15
, 2020" "3.1.6_b1" "Glances"
.SH NAME
glances \- An eye on your system
.
...
...
@@ -395,9 +395,6 @@ Sort processes by I/O rate
Show/hide IP module
.TP
.B \fBk\fP
Kill selected process (only in curses/standalone mode)
.TP
.B \fBK\fP
Show/hide TCP connections
.TP
.B \fBl\fP
...
...
@@ -483,12 +480,6 @@ Enable/disable mean GPU mode
.B \fB/\fP
Switch between process command line or command name
.TP
.B \fBUP\fP
Up in the processes list
.TP
.B \fBDOWN\fP
Down in the processes list
.TP
.B \fBF5\fP
Refresh stats in curses user interface
.UNINDENT
...
...
glances/plugins/glances_docker.py
浏览文件 @
7c1e039e
...
...
@@ -210,7 +210,11 @@ class Plugin(GlancesPlugin):
# Get stats for all containers
stats
[
'containers'
]
=
[]
for
container
in
containers
:
# Do not take hide container into account
# Only show specific containers
if
not
self
.
is_show
(
nativestr
(
container
.
name
)):
continue
# Do not take hiden container into account
if
self
.
is_hide
(
nativestr
(
container
.
name
)):
continue
...
...
glances/plugins/glances_plugin.py
浏览文件 @
7c1e039e
...
...
@@ -752,6 +752,21 @@ class GlancesPlugin(object):
except
KeyError
:
return
default
def
is_show
(
self
,
value
,
header
=
""
):
"""Return True if the value is in the show configuration list.
If the show value is empty, return True (show by default)
The show configuration list is defined in the glances.conf file.
It is a comma separed list of regexp.
Example for diskio:
show=sda.*
"""
# @TODO: possible optimisation: create a re.compile list
if
self
.
get_conf_value
(
'show'
,
header
=
header
)
==
[]:
return
True
else
:
return
any
(
j
for
j
in
[
re
.
match
(
i
,
value
)
for
i
in
self
.
get_conf_value
(
'show'
,
header
=
header
)])
def
is_hide
(
self
,
value
,
header
=
""
):
"""Return True if the value is in the hide configuration list.
...
...
@@ -760,9 +775,7 @@ class GlancesPlugin(object):
Example for diskio:
hide=sda2,sda5,loop.*
"""
# TODO: possible optimisation: create a re.compile list
# Old version (see issue #1691)
#return not all(j is None for j in [re.match(i, value.lower()) for i in self.get_conf_value('hide', header=header)])
# @TODO: possible optimisation: create a re.compile list
return
any
(
j
for
j
in
[
re
.
match
(
i
,
value
)
for
i
in
self
.
get_conf_value
(
'hide'
,
header
=
header
)])
def
has_alias
(
self
,
header
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录