Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
06c4347a
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 搜索 >>
提交
06c4347a
编写于
4月 06, 2014
作者:
N
Nicolas Hennion
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Default for CSS Bottle web interface
上级
d53b4538
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
44 addition
and
127 deletion
+44
-127
glances/outputs/bottle/header.tpl
glances/outputs/bottle/header.tpl
+1
-95
glances/outputs/glances_bottle.py
glances/outputs/glances_bottle.py
+18
-12
glances/plugins/glances_load.py
glances/plugins/glances_load.py
+2
-2
glances/plugins/glances_mem.py
glances/plugins/glances_mem.py
+13
-12
glances/plugins/glances_memswap.py
glances/plugins/glances_memswap.py
+5
-5
glances/plugins/glances_processcount.py
glances/plugins/glances_processcount.py
+1
-1
glances/plugins/glances_processlist.py
glances/plugins/glances_processlist.py
+4
-0
未找到文件。
glances/outputs/bottle/header.tpl
浏览文件 @
06c4347a
...
...
@@ -3,100 +3,6 @@
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
/>
<title>
Glances
</title>
<style>
body
{
background
:
black
;
color
:
white
;
font-family
:
"Lucida Sans Typewriter"
,
"Lucida Console"
,
Monaco
,
"Bitstream Vera Sans Mono"
,
monospace
;
}
header
,
footer
,
article
,
section
,
hgroup
,
nav
,
figure
,
div
,
aside
{
display
:
block
;
}
section
{
text-align
:
justify
;
}
section
>
article
{
display
:
inline-block
;
vertical-align
:
top
;
*
display
:
inline
;
zoom
:
1
;
}
section
:after
{
content
:
""
;
width
:
100%
;
display
:
inline-block
;
}
aside
{
float
:
left
;
margin-right
:
2em
}
div
#newline
{
clear
:
both
;
height
:
1em
;
}
#underline
{
text-decoration
:
underline
}
#bold
{
font-weight
:
bold
;
}
#title
{
font-weight
:
bold
;
}
#table
{
display
:
table
;
}
.row
{
display
:
table-row
;
}
.cell
{
display
:
table-cell
;
}
#ok
{
color
:
green
;
}
#ok_log
{
background-color
:
green
;
color
:
white
;
}
#careful
{
color
:
blueviolet
;
}
#careful_log
{
background-color
:
blueviolet
;
color
:
white
;
}
#warning
{
color
:
orange
;
}
#warning_log
{
background-color
:
orange
;
color
:
white
;
}
#critical
{
color
:
red
;
}
#critical_log
{
background-color
:
red
;
color
:
white
;
}
#system
{
float
:
left
;
}
#uptime
{
float
:
right
;
}
#cpu
{
}
#load
{
}
#mem
{
}
#memswap
{
}
</style>
<link
type=
"text/css"
href=
"style.css"
rel=
"stylesheet"
>
</head>
<body>
glances/outputs/glances_bottle.py
浏览文件 @
06c4347a
...
...
@@ -55,6 +55,9 @@ class glancesBottle:
# Update the template path (glances/outputs/bottle)
TEMPLATE_PATH
.
append
(
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
'bottle'
))
# Path where the statics files are stored
self
.
STATIC_PATH
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
'static'
)
# Define the style (CSS) list (hash table) for stats
self
.
__style_list
=
{
'DEFAULT'
:
''
,
...
...
@@ -77,6 +80,7 @@ class glancesBottle:
Define route
"""
self
.
_app
.
route
(
'/'
,
method
=
"GET"
,
callback
=
self
.
_index
)
self
.
_app
.
route
(
'/<filename:re:.*\.css>'
,
method
=
"GET"
,
callback
=
self
.
_css
)
def
start
(
self
,
stats
):
# Init stats
...
...
@@ -90,29 +94,27 @@ class glancesBottle:
pass
def
_index
(
self
):
"""
Bottle callback for index.html (/) file
"""
# Update the stat
self
.
stats
.
update
()
# Display
return
self
.
display
(
self
.
stats
)
def
_css
(
self
,
filename
):
"""
Bottle callback for *.css files
"""
# Return the static file
return
static_file
(
filename
,
root
=
os
.
path
.
join
(
self
.
STATIC_PATH
,
'css'
))
def
display
(
self
,
stats
):
"""
Display stats on the Webpage
stats: Stats database to display
"""
# html = template('header')
# html += "<header>"
# html += template(self.stats.get_plugin('system').get_bottle(self.args),
# **self.stats.get_plugin('system').get_raw())
# html += template(self.stats.get_plugin('uptime').get_bottle(self.args))
# html += "</header>"
# html += template('newline')
# html += "<section>"
# html += template(self.stats.get_plugin('cpu').get_bottle(self.args),
# **self.stats.get_plugin('cpu').get_raw())
# html += "</section>"
# html += template('footer')
html
=
template
(
'header'
)
html
+=
"<header>"
...
...
@@ -139,6 +141,10 @@ class glancesBottle:
html
+=
"</aside>"
html
+=
"<aside>"
html
+=
self
.
display_plugin
(
'processcount'
,
self
.
stats
.
get_plugin
(
'processcount'
).
get_curse
(
args
=
self
.
args
))
html
+=
template
(
'newline'
)
html
+=
self
.
display_plugin
(
'monitor'
,
self
.
stats
.
get_plugin
(
'monitor'
).
get_curse
(
args
=
self
.
args
))
html
+=
template
(
'newline'
)
html
+=
self
.
display_plugin
(
'processlist'
,
self
.
stats
.
get_plugin
(
'processlist'
).
get_curse
(
args
=
self
.
args
))
html
+=
"</aside>"
html
+=
"</section>"
html
+=
template
(
'footer'
)
...
...
glances/plugins/glances_load.py
浏览文件 @
06c4347a
...
...
@@ -85,10 +85,10 @@ class Plugin(GlancesPlugin):
# Build the string message
# Header
msg
=
"{0:
4
}"
.
format
(
_
(
"LOAD"
))
msg
=
"{0:
8
}"
.
format
(
_
(
"LOAD"
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
"TITLE"
))
# Core number
msg
=
"{0:>
10}"
.
format
(
str
(
self
.
core_plugin
.
update
()[
"log"
])
+
_
(
"-
core"
))
msg
=
"{0:>
6}"
.
format
(
str
(
self
.
core_plugin
.
update
()[
"log"
])
+
_
(
"
core"
))
ret
.
append
(
self
.
curse_add_line
(
msg
))
# New line
ret
.
append
(
self
.
curse_new_line
())
...
...
glances/plugins/glances_mem.py
浏览文件 @
06c4347a
...
...
@@ -107,53 +107,54 @@ class Plugin(GlancesPlugin):
msg
=
"{0:5} "
.
format
(
_
(
"MEM"
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
"TITLE"
))
# Percent memory usage
msg
=
"{0
}"
.
format
(
format
(
self
.
stats
[
'percent'
]
/
100
,
'>6.1%
'
))
msg
=
"{0
:>6}%"
.
format
(
format
(
self
.
stats
[
'percent'
]
/
100
,
'.1
'
))
ret
.
append
(
self
.
curse_add_line
(
msg
))
# Active memory usage
if
(
'active'
in
self
.
stats
):
msg
=
" {0:8}"
.
format
(
_
(
"actif:"
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
True
))
msg
=
"{0
}"
.
format
(
format
(
self
.
auto_unit
(
self
.
stats
[
'active'
]),
'>6'
))
msg
=
"{0
:>7}"
.
format
(
self
.
auto_unit
(
self
.
stats
[
'active'
]
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
True
))
# New line
ret
.
append
(
self
.
curse_new_line
())
# Total memory usage
msg
=
"{0:
8
}"
.
format
(
_
(
"total:"
))
msg
=
"{0:
6
}"
.
format
(
_
(
"total:"
))
ret
.
append
(
self
.
curse_add_line
(
msg
))
msg
=
"{0
}"
.
format
(
format
(
self
.
auto_unit
(
self
.
stats
[
'total'
],
'>6'
)
))
msg
=
"{0
:>7}"
.
format
(
self
.
auto_unit
(
format
(
self
.
stats
[
'total'
]),
'.1%'
))
ret
.
append
(
self
.
curse_add_line
(
msg
))
# Inactive memory usage
if
(
'inactive'
in
self
.
stats
):
msg
=
" {0:8}"
.
format
(
_
(
"inactif:"
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
True
))
msg
=
"{0
}"
.
format
(
format
(
self
.
auto_unit
(
self
.
stats
[
'inactive'
]),
'>6'
))
msg
=
"{0
:>7}"
.
format
(
self
.
auto_unit
(
self
.
stats
[
'inactive'
]
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
True
))
# New line
ret
.
append
(
self
.
curse_new_line
())
# Used memory usage
msg
=
"{0:
8
}"
.
format
(
_
(
"used:"
))
msg
=
"{0:
6
}"
.
format
(
_
(
"used:"
))
ret
.
append
(
self
.
curse_add_line
(
msg
))
msg
=
"{0
}"
.
format
(
format
(
self
.
auto_unit
(
self
.
stats
[
'used'
],
'>6'
)
))
msg
=
"{0
:>7}"
.
format
(
self
.
auto_unit
(
self
.
stats
[
'used'
]
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
self
.
get_alert_log
(
self
.
stats
[
'used'
],
max
=
self
.
stats
[
'total'
])))
msg
,
self
.
get_alert_log
(
self
.
stats
[
'used'
],
max
=
self
.
stats
[
'total'
])))
# Buffers memory usage
if
(
'buffers'
in
self
.
stats
):
msg
=
" {0:8}"
.
format
(
_
(
"buffers:"
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
True
))
msg
=
"{0
}"
.
format
(
format
(
self
.
auto_unit
(
self
.
stats
[
'buffers'
]),
'>6'
))
msg
=
"{0
:>7}"
.
format
(
self
.
auto_unit
(
self
.
stats
[
'buffers'
]
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
True
))
# New line
ret
.
append
(
self
.
curse_new_line
())
# Free memory usage
msg
=
"{0:
8
}"
.
format
(
_
(
"free:"
))
msg
=
"{0:
6
}"
.
format
(
_
(
"free:"
))
ret
.
append
(
self
.
curse_add_line
(
msg
))
msg
=
"{0
}"
.
format
(
format
(
self
.
auto_unit
(
self
.
stats
[
'free'
],
'>6'
)
))
msg
=
"{0
:>7}"
.
format
(
self
.
auto_unit
(
self
.
stats
[
'free'
]
))
ret
.
append
(
self
.
curse_add_line
(
msg
))
# Cached memory usage
if
(
'cached'
in
self
.
stats
):
msg
=
" {0:8}"
.
format
(
_
(
"cached:"
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
True
))
msg
=
"{0
}"
.
format
(
format
(
self
.
auto_unit
(
self
.
stats
[
'cached'
]),
'>6'
))
msg
=
"{0
:>7}"
.
format
(
self
.
auto_unit
(
self
.
stats
[
'cached'
]
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
True
))
return
ret
glances/plugins/glances_memswap.py
浏览文件 @
06c4347a
...
...
@@ -87,24 +87,24 @@ class Plugin(GlancesPlugin):
# Build the string message
# Header
msg
=
"{0:
5
} "
.
format
(
_
(
"SWAP"
))
msg
=
"{0:
7
} "
.
format
(
_
(
"SWAP"
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
"TITLE"
))
# Percent memory usage
msg
=
"{0
}"
.
format
(
format
(
self
.
stats
[
'percent'
]
/
100
,
'>6.1%
'
))
msg
=
"{0
:>5}%"
.
format
(
format
(
self
.
stats
[
'percent'
]
/
100
,
'.1
'
))
ret
.
append
(
self
.
curse_add_line
(
msg
))
# New line
ret
.
append
(
self
.
curse_new_line
())
# Total memory usage
msg
=
"{0:8}"
.
format
(
_
(
"total:"
))
ret
.
append
(
self
.
curse_add_line
(
msg
))
msg
=
"{0
}"
.
format
(
format
(
self
.
auto_unit
(
self
.
stats
[
'total'
],
'>6'
)
))
msg
=
"{0
:>6}"
.
format
(
self
.
auto_unit
(
self
.
stats
[
'total'
]
))
ret
.
append
(
self
.
curse_add_line
(
msg
))
# New line
ret
.
append
(
self
.
curse_new_line
())
# Used memory usage
msg
=
"{0:8}"
.
format
(
_
(
"used:"
))
ret
.
append
(
self
.
curse_add_line
(
msg
))
msg
=
"{0
}"
.
format
(
format
(
self
.
auto_unit
(
self
.
stats
[
'used'
],
'>6'
)
))
msg
=
"{0
:>6}"
.
format
(
self
.
auto_unit
(
self
.
stats
[
'used'
]
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
self
.
get_alert_log
(
self
.
stats
[
'used'
],
max
=
self
.
stats
[
'total'
])))
...
...
@@ -113,7 +113,7 @@ class Plugin(GlancesPlugin):
# Free memory usage
msg
=
"{0:8}"
.
format
(
_
(
"free:"
))
ret
.
append
(
self
.
curse_add_line
(
msg
))
msg
=
"{0
}"
.
format
(
format
(
self
.
auto_unit
(
self
.
stats
[
'free'
],
'>6'
)
))
msg
=
"{0
:>6}"
.
format
(
self
.
auto_unit
(
self
.
stats
[
'free'
]
))
ret
.
append
(
self
.
curse_add_line
(
msg
))
return
ret
glances/plugins/glances_processcount.py
浏览文件 @
06c4347a
...
...
@@ -107,7 +107,7 @@ class Plugin(GlancesPlugin):
try
:
args
.
process_sorted_by
except
AttributeError
:
args
.
process_sorted_by
=
'cpu'
args
.
process_sorted_by
=
'cpu
_percent
'
if
(
args
.
process_sorted_by
==
'auto'
):
msg
=
"{0}"
.
format
(
_
(
"sorted automatically"
))
ret
.
append
(
self
.
curse_add_line
(
msg
))
...
...
glances/plugins/glances_processlist.py
浏览文件 @
06c4347a
...
...
@@ -72,6 +72,10 @@ class Plugin(GlancesPlugin):
return
ret
# Compute the sort key
try
:
args
.
process_sorted_by
except
AttributeError
:
args
.
process_sorted_by
=
'cpu_percent'
if
(
args
.
process_sorted_by
==
'auto'
):
process_sort_key
=
glances_processes
.
getsortkey
()
else
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录