Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
a35a7d54
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 搜索 >>
提交
a35a7d54
编写于
3月 31, 2019
作者:
N
nicolargo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Version to be tested. All feature are implemented. Documentation to be done.
上级
20ca58d5
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
28 addition
and
11 deletion
+28
-11
NEWS
NEWS
+1
-0
glances/main.py
glances/main.py
+2
-0
glances/outputs/glances_curses.py
glances/outputs/glances_curses.py
+1
-0
glances/plugins/glances_plugin.py
glances/plugins/glances_plugin.py
+4
-4
glances/plugins/glances_quicklook.py
glances/plugins/glances_quicklook.py
+20
-7
未找到文件。
NEWS
浏览文件 @
a35a7d54
...
...
@@ -7,6 +7,7 @@ Version 3.1.1
Enhancements and new features:
* Please add some sparklines! #1446
* Add authprovider for cassandra export (thanks to @EmilienMottet) #1395
* Curses's browser server list sorting added (thanks to @limfreee) #1396
* ElasticSearch: add date to index, unbreak object push (thanks to @genevera) # 1438
...
...
glances/main.py
浏览文件 @
a35a7d54
...
...
@@ -240,6 +240,8 @@ Examples of use:
dest
=
'fahrenheit'
,
help
=
'display temperature in Fahrenheit (default is Celsius)'
)
parser
.
add_argument
(
'--fs-free-space'
,
action
=
'store_true'
,
default
=
False
,
dest
=
'fs_free_space'
,
help
=
'display FS free space instead of used'
)
parser
.
add_argument
(
'--sparkline'
,
action
=
'store_true'
,
default
=
False
,
dest
=
'sparkline'
,
help
=
'displat sparklines instead of bar in the curses interface'
)
parser
.
add_argument
(
'--theme-white'
,
action
=
'store_true'
,
default
=
False
,
dest
=
'theme_white'
,
help
=
'optimize display colors for white background'
)
# Globals options
...
...
glances/outputs/glances_curses.py
浏览文件 @
a35a7d54
...
...
@@ -73,6 +73,7 @@ class _GlancesCurses(object):
'Q'
:
{
'switch'
:
'enable_irq'
},
'R'
:
{
'switch'
:
'disable_raid'
},
's'
:
{
'switch'
:
'disable_sensors'
},
'S'
:
{
'switch'
:
'sparkline'
},
'T'
:
{
'switch'
:
'network_sum'
},
'U'
:
{
'switch'
:
'network_cumul'
},
'W'
:
{
'switch'
:
'disable_wifi'
},
...
...
glances/plugins/glances_plugin.py
浏览文件 @
a35a7d54
...
...
@@ -149,19 +149,19 @@ class GlancesPlugin(object):
except
UnicodeDecodeError
:
return
json
.
dumps
(
d
,
ensure_ascii
=
False
)
def
_
history_enable
(
self
):
def
history_enable
(
self
):
return
self
.
args
is
not
None
and
not
self
.
args
.
disable_history
and
self
.
get_items_history_list
()
is
not
None
def
init_stats_history
(
self
):
"""Init the stats history (dict of GlancesAttribute)."""
if
self
.
_
history_enable
():
if
self
.
history_enable
():
init_list
=
[
a
[
'name'
]
for
a
in
self
.
get_items_history_list
()]
logger
.
debug
(
"Stats history activated for plugin {} (items: {})"
.
format
(
self
.
plugin_name
,
init_list
))
return
GlancesHistory
()
def
reset_stats_history
(
self
):
"""Reset the stats history (dict of GlancesAttribute)."""
if
self
.
_
history_enable
():
if
self
.
history_enable
():
reset_list
=
[
a
[
'name'
]
for
a
in
self
.
get_items_history_list
()]
logger
.
debug
(
"Reset history for plugin {} (items: {})"
.
format
(
self
.
plugin_name
,
reset_list
))
self
.
stats_history
.
reset
()
...
...
@@ -174,7 +174,7 @@ class GlancesPlugin(object):
else
:
item_name
=
self
.
get_key
()
# Build the history
if
self
.
get_export
()
and
self
.
_
history_enable
():
if
self
.
get_export
()
and
self
.
history_enable
():
for
i
in
self
.
get_items_history_list
():
if
isinstance
(
self
.
get_export
(),
list
):
# Stats is a list of data
...
...
glances/plugins/glances_quicklook.py
浏览文件 @
a35a7d54
...
...
@@ -43,6 +43,9 @@ else:
items_history_list
=
[{
'name'
:
'cpu'
,
'description'
:
'CPU percent usage'
,
'y_unit'
:
'%'
},
{
'name'
:
'percpu'
,
'description'
:
'PERCPU percent usage'
,
'y_unit'
:
'%'
},
{
'name'
:
'mem'
,
'description'
:
'MEM percent usage'
,
'y_unit'
:
'%'
},
...
...
@@ -120,10 +123,11 @@ class Plugin(GlancesPlugin):
if
not
self
.
stats
or
self
.
is_disable
():
return
ret
# Define the data (Sparkline or Bar)
# Sparkline is the default behavor (see https://github.com/nicolargo/glances/issues/1446)
data
=
Sparkline
(
max_width
)
sparkline_tag
=
data
.
available
# Define the data: Bar (default behavor) or Sparkline
sparkline_tag
=
False
if
self
.
args
.
sparkline
and
self
.
history_enable
():
data
=
Sparkline
(
max_width
)
sparkline_tag
=
data
.
available
if
not
sparkline_tag
:
# Fallback to bar if Sparkline module is not installed
data
=
Bar
(
max_width
)
...
...
@@ -139,13 +143,22 @@ class Plugin(GlancesPlugin):
ret
.
append
(
self
.
curse_new_line
())
for
key
in
[
'cpu'
,
'mem'
,
'swap'
]:
if
key
==
'cpu'
and
args
.
percpu
:
for
cpu
in
self
.
stats
[
'percpu'
]:
bar
.
percent
=
cpu
[
'total'
]
if
sparkline_tag
:
raw_cpu
=
self
.
get_raw_history
(
item
=
'percpu'
,
nb
=
data
.
size
)
for
cpu_index
,
cpu
in
enumerate
(
self
.
stats
[
'percpu'
]):
if
sparkline_tag
:
# Sparkline display an history
data
.
percents
=
[
i
[
1
][
cpu_index
][
'total'
]
for
i
in
raw_cpu
]
# A simple padding in order to align metrics to the right
data
.
percents
+=
[
None
]
*
(
data
.
size
-
len
(
data
.
percents
))
else
:
# Bar only the last value
data
.
percent
=
cpu
[
'total'
]
if
cpu
[
cpu
[
'key'
]]
<
10
:
msg
=
'{:3}{} '
.
format
(
key
.
upper
(),
cpu
[
'cpu_number'
])
else
:
msg
=
'{:4} '
.
format
(
cpu
[
'cpu_number'
])
ret
.
extend
(
self
.
_msg_create_line
(
msg
,
bar
,
key
))
ret
.
extend
(
self
.
_msg_create_line
(
msg
,
data
,
key
))
ret
.
append
(
self
.
curse_new_line
())
else
:
if
sparkline_tag
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录