Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
da5bb38d
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,发现更多精彩内容 >>
提交
da5bb38d
编写于
11月 01, 2017
作者:
N
nicolargo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Job done for plugins IRQ, RAID, Folders and Port
上级
09281ae7
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
46 addition
and
32 deletion
+46
-32
glances/plugins/glances_folders.py
glances/plugins/glances_folders.py
+11
-7
glances/plugins/glances_irq.py
glances/plugins/glances_irq.py
+7
-8
glances/plugins/glances_ports.py
glances/plugins/glances_ports.py
+9
-4
glances/plugins/glances_raid.py
glances/plugins/glances_raid.py
+16
-7
glances/plugins/glances_wifi.py
glances/plugins/glances_wifi.py
+3
-6
未找到文件。
glances/plugins/glances_folders.py
浏览文件 @
da5bb38d
...
...
@@ -99,25 +99,29 @@ class Plugin(GlancesPlugin):
if
not
self
.
stats
or
self
.
is_disable
():
return
ret
# Build the string message
# Max size for the interface name
name_max_width
=
max_width
-
7
# Header
msg
=
'{}'
.
format
(
'FOLDERS'
)
msg
=
'{:{width}}'
.
format
(
'FOLDERS'
,
width
=
name_max_width
)
ret
.
append
(
self
.
curse_add_line
(
msg
,
"TITLE"
))
# Data
for
i
in
self
.
stats
:
ret
.
append
(
self
.
curse_new_line
())
if
len
(
i
[
'path'
])
>
15
:
if
len
(
i
[
'path'
])
>
name_max_width
:
# Cut path if it is too long
path
=
'_'
+
i
[
'path'
][
-
15
+
1
:]
path
=
'_'
+
i
[
'path'
][
-
name_max_width
+
1
:]
else
:
path
=
i
[
'path'
]
msg
=
'{:<16} '
.
format
(
path
)
msg
=
'{:{width}}'
.
format
(
path
,
width
=
name_max_width
)
ret
.
append
(
self
.
curse_add_line
(
msg
))
try
:
msg
=
'{:>
6
}'
.
format
(
self
.
auto_unit
(
i
[
'size'
]))
msg
=
'{:>
9
}'
.
format
(
self
.
auto_unit
(
i
[
'size'
]))
except
(
TypeError
,
ValueError
):
msg
=
'{:>
6
}'
.
format
(
i
[
'size'
])
msg
=
'{:>
9
}'
.
format
(
i
[
'size'
])
ret
.
append
(
self
.
curse_add_line
(
msg
,
self
.
get_alert
(
i
)))
return
ret
glances/plugins/glances_irq.py
浏览文件 @
da5bb38d
...
...
@@ -92,23 +92,22 @@ class Plugin(GlancesPlugin):
if
not
LINUX
or
not
self
.
stats
or
not
self
.
args
.
enable_irq
:
return
ret
if
max_width
is
not
None
and
max_width
>=
23
:
irq_max_width
=
max_width
-
14
else
:
irq_max_width
=
9
# Max size for the interface name
name_max_width
=
max_width
-
7
# Build the string message
# Header
msg
=
'{:{width}}'
.
format
(
'IRQ'
,
width
=
irq
_max_width
)
msg
=
'{:{width}}'
.
format
(
'IRQ'
,
width
=
name
_max_width
)
ret
.
append
(
self
.
curse_add_line
(
msg
,
"TITLE"
))
msg
=
'{:>
14
}'
.
format
(
'Rate/s'
)
msg
=
'{:>
9
}'
.
format
(
'Rate/s'
)
ret
.
append
(
self
.
curse_add_line
(
msg
))
for
i
in
self
.
stats
:
ret
.
append
(
self
.
curse_new_line
())
msg
=
'{:<15}'
.
format
(
i
[
'irq_line'
][:
15
])
msg
=
'{:{width}}'
.
format
(
i
[
'irq_line'
][:
name_max_width
],
width
=
name_max_width
)
ret
.
append
(
self
.
curse_add_line
(
msg
))
msg
=
'{:>
8
}'
.
format
(
str
(
i
[
'irq_rate'
]))
msg
=
'{:>
9
}'
.
format
(
str
(
i
[
'irq_rate'
]))
ret
.
append
(
self
.
curse_add_line
(
msg
))
return
ret
...
...
glances/plugins/glances_ports.py
浏览文件 @
da5bb38d
...
...
@@ -132,6 +132,9 @@ class Plugin(GlancesPlugin):
if
not
self
.
stats
or
args
.
disable_ports
:
return
ret
# Max size for the interface name
name_max_width
=
max_width
-
7
# Build the string message
for
p
in
self
.
stats
:
if
'host'
in
p
:
...
...
@@ -147,13 +150,15 @@ class Plugin(GlancesPlugin):
# Convert second to ms
status
=
'{0:.0f}ms'
.
format
(
p
[
'status'
]
*
1000.0
)
msg
=
'{:14.14} '
.
format
(
p
[
'description'
])
msg
=
'{:{width}}'
.
format
(
p
[
'description'
][
0
:
name_max_width
],
width
=
name_max_width
)
ret
.
append
(
self
.
curse_add_line
(
msg
))
msg
=
'{:>
8
}'
.
format
(
status
)
msg
=
'{:>
9
}'
.
format
(
status
)
ret
.
append
(
self
.
curse_add_line
(
msg
,
self
.
get_ports_alert
(
p
)))
ret
.
append
(
self
.
curse_new_line
())
elif
'url'
in
p
:
msg
=
'{:14.14} '
.
format
(
p
[
'description'
])
msg
=
'{:{width}}'
.
format
(
p
[
'description'
][
0
:
name_max_width
],
width
=
name_max_width
)
ret
.
append
(
self
.
curse_add_line
(
msg
))
if
isinstance
(
p
[
'status'
],
numbers
.
Number
):
status
=
'Code {}'
.
format
(
p
[
'status'
])
...
...
@@ -161,7 +166,7 @@ class Plugin(GlancesPlugin):
status
=
'Scanning'
else
:
status
=
p
[
'status'
]
msg
=
'{:>
8
}'
.
format
(
status
)
msg
=
'{:>
9
}'
.
format
(
status
)
ret
.
append
(
self
.
curse_add_line
(
msg
,
self
.
get_web_alert
(
p
)))
ret
.
append
(
self
.
curse_new_line
())
...
...
glances/plugins/glances_raid.py
浏览文件 @
da5bb38d
...
...
@@ -60,6 +60,9 @@ class Plugin(GlancesPlugin):
if
self
.
input_method
==
'local'
:
# Update stats using the PyMDstat lib (https://github.com/nicolargo/pymdstat)
try
:
# Just for test
# mds = MdStat(path='~/dev/pymdstat/tests/mdstat.02')
# Note: replace 02 by 02 ==> 09
mds
=
MdStat
()
self
.
stats
=
mds
.
get_stats
()[
'arrays'
]
except
Exception
as
e
:
...
...
@@ -82,13 +85,16 @@ class Plugin(GlancesPlugin):
if
not
self
.
stats
:
return
ret
# Build the string message
# Max size for the interface name
name_max_width
=
max_width
-
12
# Header
msg
=
'{:11}'
.
format
(
'RAID disks'
)
msg
=
'{:{width}}'
.
format
(
'RAID disks'
,
width
=
name_max_width
)
ret
.
append
(
self
.
curse_add_line
(
msg
,
"TITLE"
))
msg
=
'{:>
6
}'
.
format
(
'Used'
)
msg
=
'{:>
7
}'
.
format
(
'Used'
)
ret
.
append
(
self
.
curse_add_line
(
msg
))
msg
=
'{:>
6
}'
.
format
(
'Avail'
)
msg
=
'{:>
7
}'
.
format
(
'Avail'
)
ret
.
append
(
self
.
curse_add_line
(
msg
))
# Data
arrays
=
sorted
(
iterkeys
(
self
.
stats
))
...
...
@@ -99,12 +105,15 @@ class Plugin(GlancesPlugin):
status
=
self
.
raid_alert
(
self
.
stats
[
array
][
'status'
],
self
.
stats
[
array
][
'used'
],
self
.
stats
[
array
][
'available'
])
# Data: RAID type name | disk used | disk available
array_type
=
self
.
stats
[
array
][
'type'
].
upper
()
if
self
.
stats
[
array
][
'type'
]
is
not
None
else
'UNKNOWN'
msg
=
'{:<5}{:>6}'
.
format
(
array_type
,
array
)
# Build the full name = array type + array name
full_name
=
'{} {}'
.
format
(
array_type
,
array
)
msg
=
'{:{width}}'
.
format
(
full_name
,
width
=
name_max_width
)
ret
.
append
(
self
.
curse_add_line
(
msg
))
if
self
.
stats
[
array
][
'status'
]
==
'active'
:
msg
=
'{:>
6
}'
.
format
(
self
.
stats
[
array
][
'used'
])
msg
=
'{:>
7
}'
.
format
(
self
.
stats
[
array
][
'used'
])
ret
.
append
(
self
.
curse_add_line
(
msg
,
status
))
msg
=
'{:>
6
}'
.
format
(
self
.
stats
[
array
][
'available'
])
msg
=
'{:>
7
}'
.
format
(
self
.
stats
[
array
][
'available'
])
ret
.
append
(
self
.
curse_add_line
(
msg
,
status
))
elif
self
.
stats
[
array
][
'status'
]
==
'inactive'
:
ret
.
append
(
self
.
curse_new_line
())
...
...
glances/plugins/glances_wifi.py
浏览文件 @
da5bb38d
...
...
@@ -169,11 +169,7 @@ class Plugin(GlancesPlugin):
return
ret
# Max size for the interface name
if
max_width
is
not
None
and
max_width
>=
23
:
# Interface size name = max_width - space for encyption + quality
ifname_max_width
=
max_width
-
5
else
:
ifname_max_width
=
16
ifname_max_width
=
max_width
-
5
# Build the string message
# Header
...
...
@@ -198,7 +194,8 @@ class Plugin(GlancesPlugin):
if
len
(
hotspotname
)
>
ifname_max_width
:
hotspotname
=
'_'
+
hotspotname
[
-
ifname_max_width
+
1
:]
# Add the new hotspot to the message
msg
=
'{:{width}}'
.
format
(
hotspotname
,
width
=
ifname_max_width
)
msg
=
'{:{width}}'
.
format
(
hotspotname
,
width
=
ifname_max_width
)
ret
.
append
(
self
.
curse_add_line
(
msg
))
msg
=
'{:>7}'
.
format
(
i
[
'signal'
],
width
=
ifname_max_width
)
ret
.
append
(
self
.
curse_add_line
(
msg
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录