Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
cd06e045
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 搜索 >>
提交
cd06e045
编写于
12月 08, 2018
作者:
N
nicolargo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a CSV output format to the STDOUT output mode #1363
上级
e2b61d94
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
43 addition
and
7 deletion
+43
-7
NEWS
NEWS
+1
-0
README.rst
README.rst
+23
-0
docs/quickstart.rst
docs/quickstart.rst
+10
-0
glances/outputs/glances_stdout_csv.py
glances/outputs/glances_stdout_csv.py
+9
-7
未找到文件。
NEWS
浏览文件 @
cd06e045
...
...
@@ -7,6 +7,7 @@ Version 3.1
Enhancements and new features:
* Add a CSV output format to the STDOUT output mode #1363
* Feature request: HDD S.M.A.R.T. reports (thanks to @tnibert) #1288
* Sort docker stats #1276
...
...
README.rst
浏览文件 @
cd06e045
...
...
@@ -358,6 +358,29 @@ network or defined in the configuration file:
$ glances --browser
You can also display raw stats on stdout:
.. code-block:: console
$ glances --stdout cpu.user,mem.used,load
cpu.user: 30.7
mem.used: 3278204928
load: {'cpucore': 4, 'min1': 0.21, 'min5': 0.4, 'min15': 0.27}
cpu.user: 3.4
mem.used: 3275251712
load: {'cpucore': 4, 'min1': 0.19, 'min5': 0.39, 'min15': 0.27}
...
or in a CSV format thanks to the stdout-csv option:
.. code-block:: console
$ glances --stdout-csv now,cpu.user,mem.used,load
now,cpu.user,mem.used,load.cpucore,load.min1,load.min5,load.min15
2018-12-08 22:04:20 CEST,7.3,5948149760,4,1.04,0.99,1.04
2018-12-08 22:04:23 CEST,5.4,5949136896,4,1.04,0.99,1.04
...
and RTFM, always.
Documentation
...
...
docs/quickstart.rst
浏览文件 @
cd06e045
...
...
@@ -37,6 +37,16 @@ It is also possible to display RAW JSON stats directly to stdout using:
load: {'cpucore': 4, 'min1': 0.19, 'min5': 0.39, 'min15': 0.27}
...
or in a CSV format thanks to the stdout-csv option:
.. code-block:: console
$ glances --stdout-csv now,cpu.user,mem.used,load
now,cpu.user,mem.used,load.cpucore,load.min1,load.min5,load.min15
2018-12-08 22:04:20 CEST,7.3,5948149760,4,1.04,0.99,1.04
2018-12-08 22:04:23 CEST,5.4,5949136896,4,1.04,0.99,1.04
...
Note: It will display one line per stat per refresh.
Client/Server Mode
...
...
glances/outputs/glances_stdout_csv.py
浏览文件 @
cd06e045
...
...
@@ -112,6 +112,7 @@ class GlancesStdoutCsv(object):
Refresh every duration second.
"""
# Build the stats list
line
=
''
for
plugin
,
attribute
in
self
.
plugins_list
:
# Check if the plugin exist and is enable
if
plugin
in
stats
.
getPluginsList
()
and
\
...
...
@@ -120,17 +121,18 @@ class GlancesStdoutCsv(object):
else
:
continue
# Build the line to display (header or data)
if
self
.
header
:
line
=
self
.
build_header
(
plugin
,
attribute
,
stat
)
# Display header one time
self
.
header
=
False
else
:
line
=
self
.
build_data
(
plugin
,
attribute
,
stat
)
# Build the line to display (header or data)
if
self
.
header
:
line
+=
self
.
build_header
(
plugin
,
attribute
,
stat
)
else
:
line
+=
self
.
build_data
(
plugin
,
attribute
,
stat
)
# Display the line (without the last 'separator')
print
(
line
[:
-
1
])
# Display header one time
self
.
header
=
False
# Wait until next refresh
if
duration
>
0
:
time
.
sleep
(
duration
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录