Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
3f1b1356
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,发现更多精彩内容 >>
提交
3f1b1356
编写于
5月 13, 2016
作者:
N
nicolargo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update doc / Finalyse for Python 2 but do not work for Python 3
上级
67fab37d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
53 addition
and
14 deletion
+53
-14
NEWS
NEWS
+1
-0
docs/config.rst
docs/config.rst
+39
-2
glances/main.py
glances/main.py
+4
-2
glances/outdated.py
glances/outdated.py
+9
-10
未找到文件。
NEWS
浏览文件 @
3f1b1356
...
...
@@ -13,6 +13,7 @@ Enhancements and new features:
* [Folders] Differentiate permission issue and non-existence of a directory (issue #828)
* [Web UI] Add cpu name in quicklook plugin (issue #825)
* Allow theme to be set in configuration file (issue #862)
* Display a warning message when Glances is outdated (issue #865)
Bugs corrected:
...
...
docs/config.rst
浏览文件 @
3f1b1356
...
...
@@ -39,8 +39,18 @@ Syntax
Glances reads configuration files in the *ini* syntax.
Each plugin and export module can have a section. Below an example for
the CPU plugin:
A first section (called global) is available:
.. code-block:: ini
[global]
# Does Glances should check if a newer version is available on Pypi ?
check_update=true
Each plugin, export module and application monitoring process (AMP) can have a
section. Below an example for the CPU plugin:
.. code-block:: ini
...
...
@@ -58,6 +68,33 @@ the CPU plugin:
steal_warning=70
steal_critical=90
an InfluxDB export module:
.. code-block:: ini
[influxdb]
# Configuration for the --export-influxdb option
# https://influxdb.com/
host=localhost
port=8086
user=root
password=root
db=glances
prefix=localhost
#tags=foo:bar,spam:eggs
or a NGinx AMP:
.. code-block:: ini
[amp_nginx]
# Nginx status page should be enable (https://easyengine.io/tutorials/nginx/status-page/)
enable=true
regex=\/usr\/sbin\/nginx
refresh=60
one_line=false
status_url=http://localhost/nginx_status
Logging
-------
...
...
glances/main.py
浏览文件 @
3f1b1356
...
...
@@ -208,7 +208,7 @@ Start the client browser (browser mode):\n\
parser
.
add_argument
(
'--process-short-name'
,
action
=
'store_true'
,
default
=
False
,
dest
=
'process_short_name'
,
help
=
'force short name for processes name'
)
parser
.
add_argument
(
'-0'
,
'--disable-irix'
,
action
=
'store_true'
,
default
=
False
,
dest
=
'disable_irix'
,
help
=
'
T
ask
\'
s cpu usage will be divided by the total number of CPUs'
)
dest
=
'disable_irix'
,
help
=
'
t
ask
\'
s cpu usage will be divided by the total number of CPUs'
)
if
not
WINDOWS
:
parser
.
add_argument
(
'--hide-kernel-threads'
,
action
=
'store_true'
,
default
=
False
,
dest
=
'no_kernel_threads'
,
help
=
'hide kernel threads in process list'
)
...
...
@@ -229,7 +229,9 @@ Start the client browser (browser mode):\n\
dest
=
'fs_free_space'
,
help
=
'display FS free space instead of used'
)
parser
.
add_argument
(
'--theme-white'
,
action
=
'store_true'
,
default
=
False
,
dest
=
'theme_white'
,
help
=
'optimize display colors for white background'
)
# Globals options
parser
.
add_argument
(
'--disable-check-update'
,
action
=
'store_true'
,
default
=
False
,
dest
=
'disable_check_update'
,
help
=
'disable online Glances version ckeck'
)
return
parser
def
parse_args
(
self
):
...
...
glances/outdated.py
浏览文件 @
3f1b1356
...
...
@@ -53,14 +53,14 @@ class Outdated(object):
self
.
config
=
config
# Set default value...
self
.
outdated_config_tag
=
True
self
.
data
=
{
'installed_version'
:
__version__
,
'latest_version'
:
'0.0'
,
'refresh_date'
:
datetime
.
now
()
u
'installed_version'
:
__version__
,
u
'latest_version'
:
'0.0'
,
u
'refresh_date'
:
datetime
.
now
()
}
# Read the configuration file
self
.
load_config
(
config
)
logger
.
debug
(
"Check Glances version up-to-date: {0}"
.
format
(
not
self
.
args
.
disable_check_update
))
# And update !
self
.
get_pypi_version
()
...
...
@@ -71,8 +71,7 @@ class Outdated(object):
global_section
=
'global'
if
(
hasattr
(
config
,
'has_section'
)
and
config
.
has_section
(
global_section
)):
self
.
outdated_config_tag
=
config
.
get_value
(
global_section
,
'check_update'
).
lower
()
==
'true'
logger
.
debug
(
"Check Glances version up-to-date: {0}"
.
format
(
self
.
outdated_config_tag
))
self
.
args
.
disable_check_update
=
config
.
get_value
(
global_section
,
'check_update'
).
lower
()
==
'false'
else
:
logger
.
debug
(
"Can not find section {0} in the configuration file"
.
format
(
global_section
))
return
False
...
...
@@ -93,7 +92,7 @@ class Outdated(object):
The data are stored in a cached file
Only update online once a week
"""
if
not
outdated_tag
or
not
self
.
outdated_config_tag
:
if
not
outdated_tag
or
self
.
args
.
disable_check_update
:
return
# If the cached file exist, read-it
...
...
@@ -111,7 +110,7 @@ class Outdated(object):
def
is_outdated
(
self
):
"""Return True if a new version is available"""
if
not
self
.
self
.
outdated_config_tag
:
if
self
.
args
.
disable_check_update
:
# Check is disabled by configuration
return
False
...
...
@@ -169,7 +168,7 @@ class Outdated(object):
logger
.
debug
(
"Get latest Glances version from the Pypi Restfull API ({0})"
.
format
(
self
.
PYPI_API_URL
))
# Update the current time
self
.
data
[
'refresh_date'
]
=
datetime
.
now
()
self
.
data
[
u
'refresh_date'
]
=
datetime
.
now
()
try
:
res
=
requests
.
get
(
self
.
PYPI_API_URL
)
...
...
@@ -178,7 +177,7 @@ class Outdated(object):
else
:
if
res
.
ok
:
# Update data
self
.
data
[
'latest_version'
]
=
json
.
loads
(
res
.
text
)[
'info'
][
'version'
]
self
.
data
[
u
'latest_version'
]
=
json
.
loads
(
res
.
text
)[
'info'
][
'version'
]
logger
.
debug
(
"Save Glances version to the cache file"
)
else
:
logger
.
debug
(
"Can not get the Glances version from the Pypi Restfull API ({0})"
.
format
(
res
.
reason
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录