Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
9221cf1d
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 搜索 >>
提交
9221cf1d
编写于
1月 19, 2014
作者:
A
Alessio Sergi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Closing issue #318
上级
73418ead
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
16 addition
and
40 deletion
+16
-40
glances/glances.py
glances/glances.py
+16
-40
未找到文件。
glances/glances.py
浏览文件 @
9221cf1d
...
...
@@ -4438,6 +4438,9 @@ class GlancesClient():
def
client_init
(
self
):
try
:
client_version
=
self
.
client
.
init
()
except
socket
.
error
as
err
:
print
(
_
(
"Couldn't create socket: %s"
)
%
err
)
sys
.
exit
(
-
1
)
except
ProtocolError
as
err
:
if
str
(
err
).
find
(
" 401 "
)
>
0
:
print
(
_
(
"Error: Connection to server failed. Bad password."
))
...
...
@@ -4610,32 +4613,18 @@ def main():
username
=
"glances"
password
=
""
# Manage
arg
s
# Manage
options/argument
s
try
:
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
"B:bdeymnho:f:t:vsc:p:C:P:zr1"
,
[
"bind"
,
"bytepersec"
,
"diskio"
,
"mount"
,
"sensors"
,
"hddtemp"
,
"netrate"
,
"help"
,
"output"
,
"
file"
,
"time"
,
"version"
,
"server
"
,
"
client"
,
"port"
,
"config"
,
"password
"
,
"nobold"
,
"noproc"
,
"percpu"
])
"sensors"
,
"hddtemp"
,
"netrate"
,
"help"
,
"
output"
,
"file"
,
"time"
,
"version
"
,
"
server"
,
"client"
,
"port"
,
"config
"
,
"
password"
,
"
nobold"
,
"noproc"
,
"percpu"
])
except
getopt
.
GetoptError
as
err
:
# Print help information and exit:
if
(
err
.
opt
==
'P'
)
and
(
'requires argument'
in
err
.
msg
):
print
(
_
(
"Error: -P flag need an argument (password)"
))
elif
(
err
.
opt
==
'B'
)
and
(
'requires argument'
in
err
.
msg
):
print
(
_
(
"Error: -B flag need an argument (bind IP address)"
))
elif
(
err
.
opt
==
'c'
)
and
(
'requires argument'
in
err
.
msg
):
print
(
_
(
"Error: -c flag need an argument (server IP address/name)"
))
elif
(
err
.
opt
==
'p'
)
and
(
'requires argument'
in
err
.
msg
):
print
(
_
(
"Error: -p flag need an argument (port number)"
))
elif
(
err
.
opt
==
'o'
)
and
(
'requires argument'
in
err
.
msg
):
print
(
_
(
"Error: -o flag need an argument (HTML or CSV)"
))
elif
(
err
.
opt
==
't'
)
and
(
'requires argument'
in
err
.
msg
):
print
(
_
(
"Error: -t flag need an argument (refresh time)"
))
else
:
print
(
str
(
err
))
print
printSyntax
()
# Print help information and exit
print
(
str
(
err
))
print
(
_
(
"Try 'glances -h' for more information."
))
sys
.
exit
(
2
)
for
opt
,
arg
in
opts
:
if
opt
in
(
"-v"
,
"--version"
):
...
...
@@ -4661,32 +4650,20 @@ def main():
elif
arg
.
lower
()
==
"csv"
:
csv_tag
=
True
else
:
print
(
_
(
"Error: Unknown output %s"
%
arg
)
)
print
(
_
(
"Error: Unknown output %s"
)
%
arg
)
sys
.
exit
(
2
)
elif
opt
in
(
"-e"
,
"--sensors"
):
if
is_Linux
:
if
not
sensors_lib_tag
:
print
(
_
(
"Error: PySensors library not found"
))
sys
.
exit
(
2
)
else
:
sensors_tag
=
True
else
:
print
(
_
(
"Error: Sensors module is only available on Linux"
))
sys
.
exit
(
2
)
sensors_tag
=
True
elif
opt
in
(
"-y"
,
"--hddtemp"
):
hddtemp_tag
=
True
elif
opt
in
(
"-f"
,
"--file"
):
output_file
=
arg
output_folder
=
arg
elif
opt
in
(
"-t"
,
"--time"
):
try
:
refresh_time
=
int
(
arg
)
except
:
print
(
"Error: Invalid refresh time (%s)"
%
arg
)
sys
.
exit
(
2
)
if
(
refresh_time
<
1
):
if
not
(
arg
.
isdigit
()
and
int
(
arg
)
>
0
):
print
(
_
(
"Error: Refresh time should be a positive integer"
))
sys
.
exit
(
2
)
refresh_time
=
int
(
arg
)
elif
opt
in
(
"-d"
,
"--diskio"
):
diskio_tag
=
False
elif
opt
in
(
"-m"
,
"--mount"
):
...
...
@@ -4729,7 +4706,7 @@ def main():
sys
.
exit
(
2
)
if
conf_file_tag
:
print
(
_
(
"Error: Cannot use both -c and -C flag"
))
print
(
_
(
"
Limits are set based on the server ones"
))
print
(
_
(
"Limits are set based on the server ones"
))
sys
.
exit
(
2
)
if
password_prompt
:
password
=
get_password
(
description
=
_
(
"Enter the Glances server password"
),
confirm
=
False
)
...
...
@@ -4737,7 +4714,6 @@ def main():
if
html_tag
:
if
not
html_lib_tag
:
print
(
_
(
"Error: Need Jinja2 library to export into HTML"
))
print
(
_
(
"Try to install the python-jinja2 package"
))
sys
.
exit
(
2
)
try
:
output_folder
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录