Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
ba1757a2
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 搜索 >>
提交
ba1757a2
编写于
4月 12, 2014
作者:
N
Nicolas Hennion
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename get_curse to get_stats_display
上级
edee3fb2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
41 addition
and
51 deletion
+41
-51
glances/outputs/glances_bottle.py
glances/outputs/glances_bottle.py
+14
-14
glances/outputs/glances_curses.py
glances/outputs/glances_curses.py
+26
-26
glances/plugins/glances_plugin.py
glances/plugins/glances_plugin.py
+1
-11
未找到文件。
glances/outputs/glances_bottle.py
浏览文件 @
ba1757a2
...
...
@@ -133,29 +133,29 @@ class glancesBottle:
html
=
template
(
'header'
,
refresh_time
=
refresh_time
)
html
+=
'<header>'
html
+=
self
.
display_plugin
(
'system'
,
self
.
stats
.
get_plugin
(
'system'
).
get_
curse
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'uptime'
,
self
.
stats
.
get_plugin
(
'uptime'
).
get_
curse
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'system'
,
self
.
stats
.
get_plugin
(
'system'
).
get_
stats_display
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'uptime'
,
self
.
stats
.
get_plugin
(
'uptime'
).
get_
stats_display
(
args
=
self
.
args
))
html
+=
'</header>'
html
+=
template
(
'newline'
)
html
+=
'<section>'
html
+=
self
.
display_plugin
(
'cpu'
,
self
.
stats
.
get_plugin
(
'cpu'
).
get_
curse
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'load'
,
self
.
stats
.
get_plugin
(
'load'
).
get_
curse
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'mem'
,
self
.
stats
.
get_plugin
(
'mem'
).
get_
curse
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'memswap'
,
self
.
stats
.
get_plugin
(
'memswap'
).
get_
curse
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'cpu'
,
self
.
stats
.
get_plugin
(
'cpu'
).
get_
stats_display
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'load'
,
self
.
stats
.
get_plugin
(
'load'
).
get_
stats_display
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'mem'
,
self
.
stats
.
get_plugin
(
'mem'
).
get_
stats_display
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'memswap'
,
self
.
stats
.
get_plugin
(
'memswap'
).
get_
stats_display
(
args
=
self
.
args
))
html
+=
'</section>'
html
+=
template
(
'newline'
)
html
+=
'<div>'
html
+=
'<aside>'
html
+=
self
.
display_plugin
(
'network'
,
self
.
stats
.
get_plugin
(
'network'
).
get_
curse
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'diskio'
,
self
.
stats
.
get_plugin
(
'diskio'
).
get_
curse
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'fs'
,
self
.
stats
.
get_plugin
(
'fs'
).
get_
curse
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'sensors'
,
self
.
stats
.
get_plugin
(
'sensors'
).
get_
curse
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'network'
,
self
.
stats
.
get_plugin
(
'network'
).
get_
stats_display
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'diskio'
,
self
.
stats
.
get_plugin
(
'diskio'
).
get_
stats_display
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'fs'
,
self
.
stats
.
get_plugin
(
'fs'
).
get_
stats_display
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'sensors'
,
self
.
stats
.
get_plugin
(
'sensors'
).
get_
stats_display
(
args
=
self
.
args
))
html
+=
'</aside>'
html
+=
'<section>'
html
+=
self
.
display_plugin
(
'alert'
,
self
.
stats
.
get_plugin
(
'alert'
).
get_
curse
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'processcount'
,
self
.
stats
.
get_plugin
(
'processcount'
).
get_
curse
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'monitor'
,
self
.
stats
.
get_plugin
(
'monitor'
).
get_
curse
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'processlist'
,
self
.
stats
.
get_plugin
(
'processlist'
).
get_
curse
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'alert'
,
self
.
stats
.
get_plugin
(
'alert'
).
get_
stats_display
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'processcount'
,
self
.
stats
.
get_plugin
(
'processcount'
).
get_
stats_display
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'monitor'
,
self
.
stats
.
get_plugin
(
'monitor'
).
get_
stats_display
(
args
=
self
.
args
))
html
+=
self
.
display_plugin
(
'processlist'
,
self
.
stats
.
get_plugin
(
'processlist'
).
get_
stats_display
(
args
=
self
.
args
))
html
+=
'</section>'
html
+=
'</div>'
html
+=
template
(
'newline'
)
...
...
glances/outputs/glances_curses.py
浏览文件 @
ba1757a2
...
...
@@ -270,7 +270,7 @@ class glancesCurses:
if
(
self
.
args
.
help_tag
):
# Display the stats...
self
.
display_plugin
(
stats
.
get_plugin
(
'help'
).
get_
curse
(
args
=
self
.
args
))
self
.
display_plugin
(
stats
.
get_plugin
(
'help'
).
get_
stats_display
(
args
=
self
.
args
))
# ... and exit
return
False
...
...
@@ -278,24 +278,24 @@ class glancesCurses:
self
.
args
.
cs_status
=
cs_status
# Display first line (system+uptime)
stats_system
=
stats
.
get_plugin
(
'system'
).
get_
curse
(
args
=
self
.
args
)
stats_uptime
=
stats
.
get_plugin
(
'uptime'
).
get_
curse
()
l
=
self
.
get_
curse_width
(
stats_system
)
+
self
.
get_curse
_width
(
stats_uptime
)
+
self
.
space_between_column
stats_system
=
stats
.
get_plugin
(
'system'
).
get_
stats_display
(
args
=
self
.
args
)
stats_uptime
=
stats
.
get_plugin
(
'uptime'
).
get_
stats_display
()
l
=
self
.
get_
stats_display_width
(
stats_system
)
+
self
.
get_stats_display
_width
(
stats_uptime
)
+
self
.
space_between_column
self
.
display_plugin
(
stats_system
,
display_optional
=
(
screen_x
>=
l
))
self
.
display_plugin
(
stats_uptime
)
# Display second line (CPU|PERCPU+LOAD+MEM+SWAP+<SUMMARY>)
# CPU|PERCPU
if
(
self
.
args
.
percpu
):
stats_percpu
=
stats
.
get_plugin
(
'percpu'
).
get_
curse
()
l
=
self
.
get_
curse
_width
(
stats_percpu
)
stats_percpu
=
stats
.
get_plugin
(
'percpu'
).
get_
stats_display
()
l
=
self
.
get_
stats_display
_width
(
stats_percpu
)
else
:
stats_cpu
=
stats
.
get_plugin
(
'cpu'
).
get_
curse
()
l
=
self
.
get_
curse
_width
(
stats_cpu
)
stats_load
=
stats
.
get_plugin
(
'load'
).
get_
curse
()
stats_mem
=
stats
.
get_plugin
(
'mem'
).
get_
curse
()
stats_memswap
=
stats
.
get_plugin
(
'memswap'
).
get_
curse
()
l
+=
self
.
get_
curse_width
(
stats_load
)
+
self
.
get_curse_width
(
stats_mem
)
+
self
.
get_curse
_width
(
stats_memswap
)
stats_cpu
=
stats
.
get_plugin
(
'cpu'
).
get_
stats_display
()
l
=
self
.
get_
stats_display
_width
(
stats_cpu
)
stats_load
=
stats
.
get_plugin
(
'load'
).
get_
stats_display
()
stats_mem
=
stats
.
get_plugin
(
'mem'
).
get_
stats_display
()
stats_memswap
=
stats
.
get_plugin
(
'memswap'
).
get_
stats_display
()
l
+=
self
.
get_
stats_display_width
(
stats_load
)
+
self
.
get_stats_display_width
(
stats_mem
)
+
self
.
get_stats_display
_width
(
stats_memswap
)
# Space between column
if
(
screen_x
>
(
3
*
self
.
space_between_column
+
l
)):
self
.
space_between_column
=
int
((
screen_x
-
l
)
/
3
)
...
...
@@ -311,23 +311,23 @@ class glancesCurses:
self
.
space_between_column
=
3
# Display left sidebar (NETWORK+DISKIO+FS+SENSORS)
self
.
display_plugin
(
stats
.
get_plugin
(
'network'
).
get_
curse
(
args
=
self
.
args
))
self
.
display_plugin
(
stats
.
get_plugin
(
'diskio'
).
get_
curse
(
args
=
self
.
args
))
self
.
display_plugin
(
stats
.
get_plugin
(
'fs'
).
get_
curse
(
args
=
self
.
args
))
self
.
display_plugin
(
stats
.
get_plugin
(
'sensors'
).
get_
curse
(
args
=
self
.
args
))
self
.
display_plugin
(
stats
.
get_plugin
(
'network'
).
get_
stats_display
(
args
=
self
.
args
))
self
.
display_plugin
(
stats
.
get_plugin
(
'diskio'
).
get_
stats_display
(
args
=
self
.
args
))
self
.
display_plugin
(
stats
.
get_plugin
(
'fs'
).
get_
stats_display
(
args
=
self
.
args
))
self
.
display_plugin
(
stats
.
get_plugin
(
'sensors'
).
get_
stats_display
(
args
=
self
.
args
))
# Display last line (currenttime)
self
.
display_plugin
(
stats
.
get_plugin
(
'now'
).
get_
curse
())
self
.
display_plugin
(
stats
.
get_plugin
(
'now'
).
get_
stats_display
())
# Display right sidebar (PROCESS_COUNT+MONITORED+PROCESS_LIST+ALERT)
if
(
screen_x
>
52
):
stats_processcount
=
stats
.
get_plugin
(
'processcount'
).
get_
curse
(
args
=
self
.
args
)
stats_processlist
=
stats
.
get_plugin
(
'processlist'
).
get_
curse
(
args
=
self
.
args
)
stats_alert
=
stats
.
get_plugin
(
'alert'
).
get_
curse
(
args
=
self
.
args
)
stats_monitor
=
stats
.
get_plugin
(
'monitor'
).
get_
curse
(
args
=
self
.
args
)
stats_processcount
=
stats
.
get_plugin
(
'processcount'
).
get_
stats_display
(
args
=
self
.
args
)
stats_processlist
=
stats
.
get_plugin
(
'processlist'
).
get_
stats_display
(
args
=
self
.
args
)
stats_alert
=
stats
.
get_plugin
(
'alert'
).
get_
stats_display
(
args
=
self
.
args
)
stats_monitor
=
stats
.
get_plugin
(
'monitor'
).
get_
stats_display
(
args
=
self
.
args
)
self
.
display_plugin
(
stats_processcount
)
self
.
display_plugin
(
stats_monitor
)
self
.
display_plugin
(
stats_processlist
,
max_y
=
(
screen_y
-
self
.
get_
curse
_height
(
stats_alert
)
-
3
))
max_y
=
(
screen_y
-
self
.
get_
stats_display
_height
(
stats_alert
)
-
3
))
self
.
display_plugin
(
stats_alert
)
return
True
...
...
@@ -359,14 +359,14 @@ class glancesCurses:
# Set the upper/left position of the message
if
(
plugin_stats
[
'column'
]
<
0
):
# Right align (last column)
display_x
=
screen_x
-
self
.
get_
curse
_width
(
plugin_stats
)
display_x
=
screen_x
-
self
.
get_
stats_display
_width
(
plugin_stats
)
else
:
if
(
plugin_stats
[
'column'
]
not
in
self
.
column_to_x
):
self
.
column_to_x
[
plugin_stats
[
'column'
]]
=
plugin_stats
[
'column'
]
display_x
=
self
.
column_to_x
[
plugin_stats
[
'column'
]]
if
(
plugin_stats
[
'line'
]
<
0
):
# Bottom (last line)
display_y
=
screen_y
-
self
.
get_
curse
_height
(
plugin_stats
)
display_y
=
screen_y
-
self
.
get_
stats_display
_height
(
plugin_stats
)
else
:
if
(
plugin_stats
[
'line'
]
not
in
self
.
line_to_y
):
self
.
line_to_y
[
plugin_stats
[
'line'
]]
=
plugin_stats
[
'line'
]
...
...
@@ -450,7 +450,7 @@ class glancesCurses:
# Wait 100ms...
curses
.
napms
(
100
)
def
get_
curse
_width
(
self
,
curse_msg
,
without_option
=
False
):
def
get_
stats_display
_width
(
self
,
curse_msg
,
without_option
=
False
):
# Return the width of the formated curses message
# The height is defined by the maximum line
...
...
@@ -468,7 +468,7 @@ class glancesCurses:
else
:
return
c
def
get_
curse
_height
(
self
,
curse_msg
):
def
get_
stats_display
_height
(
self
,
curse_msg
):
# Return the height of the formated curses message
# The height is defined by the number of '\n'
...
...
glances/plugins/glances_plugin.py
浏览文件 @
ba1757a2
...
...
@@ -185,7 +185,7 @@ class GlancesPlugin(object):
"""
return
[
self
.
curse_add_line
(
str
(
self
.
stats
))]
def
get_
curse
(
self
,
args
=
None
):
def
get_
stats_display
(
self
,
args
=
None
):
# Return a dict with all the information needed to display the stat
# key | description
#----------------------------
...
...
@@ -210,16 +210,6 @@ class GlancesPlugin(object):
'column'
:
column_curse
,
'line'
:
line_curse
}
def
get_bottle
(
self
,
args
=
None
):
# Return the HTML representation of the plugin
if
(
hasattr
(
self
,
'msg_bottle'
)):
msg_bottle
=
self
.
msg_bottle
(
args
)
else
:
msg_bottle
=
None
return
msg_bottle
def
curse_add_line
(
self
,
msg
,
decoration
=
"DEFAULT"
,
optional
=
False
,
splittable
=
False
):
"""
Return a dict with: { 'msg': msg, 'decoration': decoration, 'optional': False }
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录