Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
5f52c03f
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,发现更多精彩内容 >>
提交
5f52c03f
编写于
1月 28, 2018
作者:
N
nicolargo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Display debug message if dep lib is not found #1224
上级
5fdedbf8
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
63 addition
and
58 deletion
+63
-58
NEWS
NEWS
+1
-0
glances/amps_list.py
glances/amps_list.py
+2
-2
glances/plugins/glances_cloud.py
glances/plugins/glances_cloud.py
+14
-11
glances/plugins/glances_docker.py
glances/plugins/glances_docker.py
+6
-7
glances/plugins/glances_fs.py
glances/plugins/glances_fs.py
+0
-1
glances/plugins/glances_gpu.py
glances/plugins/glances_gpu.py
+5
-5
glances/plugins/glances_ip.py
glances/plugins/glances_ip.py
+8
-12
glances/plugins/glances_ports.py
glances/plugins/glances_ports.py
+7
-6
glances/plugins/glances_quicklook.py
glances/plugins/glances_quicklook.py
+5
-5
glances/plugins/glances_raid.py
glances/plugins/glances_raid.py
+9
-3
glances/plugins/glances_wifi.py
glances/plugins/glances_wifi.py
+6
-6
未找到文件。
NEWS
浏览文件 @
5f52c03f
...
...
@@ -19,6 +19,7 @@ Enhancements and new features:
* Context switches bottleneck identification #1212
* Take advantage of the PSUtil issue #1025 (Add process_iter(attrs, ad_value)) #1105
* Nice Process Priority Configuration #1218
* Display debug message if dep lib is not found #1224
Bugs corrected:
...
...
glances/amps_list.py
浏览文件 @
5f52c03f
...
...
@@ -74,9 +74,9 @@ class AmpsList(object):
try
:
amp
=
__import__
(
os
.
path
.
basename
(
amp_script
)[:
-
3
])
except
ImportError
as
e
:
logger
.
warning
(
"
Cannot load {}, you need to install an external Python package ({})"
.
format
(
os
.
path
.
basename
(
amp_script
),
e
))
logger
.
warning
(
"
Missing Python Lib ({}), cannot load {} AMP"
.
format
(
e
,
amp_conf_nam
e
))
except
Exception
as
e
:
logger
.
warning
(
"Cannot load {}
({})"
.
format
(
os
.
path
.
basename
(
amp_script
)
,
e
))
logger
.
warning
(
"Cannot load {}
AMP ({})"
.
format
(
amp_conf_name
,
e
))
else
:
# Add the AMP to the dictionary
# The key is the AMP name
...
...
glances/plugins/glances_cloud.py
浏览文件 @
5f52c03f
...
...
@@ -23,19 +23,22 @@ Supported Cloud API:
- AWS EC2 (class ThreadAwsEc2Grabber, see bellow)
"""
try
:
import
requests
except
ImportError
:
cloud_tag
=
False
else
:
cloud_tag
=
True
import
threading
from
glances.compat
import
iteritems
,
to_ascii
from
glances.plugins.glances_plugin
import
GlancesPlugin
from
glances.logger
import
logger
# Import plugin specific dependency
try
:
import
requests
except
ImportError
as
e
:
import_error_tag
=
True
# Display debu message if import KeyError
logger
.
warning
(
"Missing Python Lib ({}), Cloud plugin is disable"
.
format
(
e
))
else
:
import_error_tag
=
False
class
Plugin
(
GlancesPlugin
):
"""Glances' cloud plugin.
...
...
@@ -85,16 +88,17 @@ class Plugin(GlancesPlugin):
self
.
reset
()
# Requests lib is needed to get stats from the Cloud API
if
not
cloud
_tag
:
if
import_error
_tag
:
return
self
.
stats
# Update the stats
if
self
.
input_method
==
'local'
:
self
.
stats
=
self
.
aws_ec2
.
stats
# Example:
# self.stats = {'ami-id': 'ami-id',
# 'instance-id': 'instance-id',
# 'instance-type': 'instance-type',
# 'region': 'placement/availability-zone'}
self
.
stats
=
self
.
aws_ec2
.
stats
return
self
.
stats
...
...
@@ -149,8 +153,7 @@ class ThreadAwsEc2Grabber(threading.Thread):
Infinite loop, should be stopped by calling the stop() method
"""
if
not
cloud_tag
:
logger
.
debug
(
"cloud plugin - Requests lib is not installed"
)
if
import_error_tag
:
self
.
stop
()
return
False
...
...
glances/plugins/glances_docker.py
浏览文件 @
5f52c03f
...
...
@@ -33,10 +33,11 @@ from glances.plugins.glances_plugin import GlancesPlugin
try
:
import
docker
except
ImportError
as
e
:
logger
.
debug
(
"Docker library not found (%s). Glances cannot grab Docker info."
%
e
)
docker_tag
=
False
import_error_tag
=
True
# Display debu message if import KeyError
logger
.
warning
(
"Missing Python Lib ({}), Docker plugin is disable"
.
format
(
e
))
else
:
docker_tag
=
Tru
e
import_error_tag
=
Fals
e
class
Plugin
(
GlancesPlugin
):
...
...
@@ -92,9 +93,7 @@ class Plugin(GlancesPlugin):
def
connect
(
self
):
"""Connect to the Docker server."""
global
docker_tag
if
not
docker_tag
:
if
import_error_tag
:
return
None
return
docker
.
from_env
()
...
...
@@ -124,7 +123,7 @@ class Plugin(GlancesPlugin):
self
.
reset
()
# The Docker-py lib is mandatory
if
not
docke
r_tag
:
if
import_erro
r_tag
:
return
self
.
stats
if
self
.
input_method
==
'local'
:
...
...
glances/plugins/glances_fs.py
浏览文件 @
5f52c03f
...
...
@@ -26,7 +26,6 @@ from glances.plugins.glances_plugin import GlancesPlugin
import
psutil
# SNMP OID
# The snmpd.conf needs to be edited.
# Add the following to enable it on all disk
...
...
glances/plugins/glances_gpu.py
浏览文件 @
5f52c03f
...
...
@@ -26,11 +26,11 @@ from glances.plugins.glances_plugin import GlancesPlugin
try
:
import
pynvml
except
Exception
as
e
:
logger
.
error
(
"Could not import pynvml. NVIDIA stats will not be collected."
)
logger
.
debug
(
"pynvml error: {}"
.
format
(
e
))
gpu_nvidia_tag
=
False
import_error_tag
=
True
# Display debu message if import KeyError
logger
.
warning
(
"Missing Python Lib ({}), Nvidia GPU plugin is disable"
.
format
(
e
))
else
:
gpu_nvidia_tag
=
Tru
e
import_error_tag
=
Fals
e
class
Plugin
(
GlancesPlugin
):
...
...
@@ -58,7 +58,7 @@ class Plugin(GlancesPlugin):
def
init_nvidia
(
self
):
"""Init the NVIDIA API."""
if
not
gpu_nvidia
_tag
:
if
import_error
_tag
:
self
.
nvml_ready
=
False
try
:
...
...
glances/plugins/glances_ip.py
浏览文件 @
5f52c03f
...
...
@@ -23,22 +23,18 @@ import threading
from
json
import
loads
from
glances.compat
import
iterkeys
,
urlopen
,
queue
from
glances.globals
import
BSD
from
glances.logger
import
logger
from
glances.timer
import
Timer
from
glances.plugins.glances_plugin
import
GlancesPlugin
# XXX *BSDs: Segmentation fault (core dumped)
# -- https://bitbucket.org/al45tair/netifaces/issues/15
# Also used in the ports_list script
if
not
BSD
:
try
:
import
netifaces
netifaces_tag
=
True
except
ImportError
:
netifaces_tag
=
False
# Import plugin specific dependency
try
:
import
netifaces
except
ImportError
as
e
:
import_error_tag
=
True
logger
.
warning
(
"Missing Python Lib ({}), IP plugin is disable"
.
format
(
e
))
else
:
netifaces
_tag
=
False
import_error
_tag
=
False
# List of online services to retreive public IP address
# List of tuple (url, json, key)
...
...
@@ -85,7 +81,7 @@ class Plugin(GlancesPlugin):
# Reset stats
self
.
reset
()
if
self
.
input_method
==
'local'
and
n
etifaces
_tag
:
if
self
.
input_method
==
'local'
and
n
ot
import_error
_tag
:
# Update stats using the netifaces lib
try
:
default_gw
=
netifaces
.
gateways
()[
'default'
][
netifaces
.
AF_INET
]
...
...
glances/plugins/glances_ports.py
浏览文件 @
5f52c03f
...
...
@@ -26,12 +26,6 @@ import socket
import
time
import
numbers
try
:
import
requests
requests_tag
=
True
except
ImportError
:
requests_tag
=
False
from
glances.globals
import
WINDOWS
,
MACOS
,
BSD
from
glances.ports_list
import
GlancesPortsList
from
glances.web_list
import
GlancesWebList
...
...
@@ -40,6 +34,13 @@ from glances.compat import bool_type
from
glances.logger
import
logger
from
glances.plugins.glances_plugin
import
GlancesPlugin
try
:
import
requests
requests_tag
=
True
except
ImportError
as
e
:
requests_tag
=
False
logger
.
warning
(
"Missing Python Lib ({}), Ports plugin is limited to port scanning"
.
format
(
e
))
class
Plugin
(
GlancesPlugin
):
"""Glances ports scanner plugin."""
...
...
glances/plugins/glances_quicklook.py
浏览文件 @
5f52c03f
...
...
@@ -20,18 +20,18 @@
"""Quicklook plugin."""
from
glances.cpu_percent
import
cpu_percent
from
glances.logger
import
logger
from
glances.outputs.glances_bars
import
Bar
from
glances.plugins.glances_plugin
import
GlancesPlugin
import
psutil
cpuinfo_tag
=
False
# Import plugin specific dependency
try
:
from
cpuinfo
import
cpuinfo
except
ImportError
:
# Correct issue #754
# Waiting for a correction on the upstream Cpuinfo lib
pass
except
ImportError
as
e
:
cpuinfo_tag
=
False
logger
.
warning
(
"Missing Python Lib ({}), Quicklook plugin will not display CPU info"
.
format
(
e
))
else
:
cpuinfo_tag
=
True
...
...
glances/plugins/glances_raid.py
浏览文件 @
5f52c03f
...
...
@@ -23,11 +23,14 @@ from glances.compat import iterkeys
from
glances.logger
import
logger
from
glances.plugins.glances_plugin
import
GlancesPlugin
#
pymdstat only available on GNU/Linux OS
#
Import plugin specific dependency
try
:
from
pymdstat
import
MdStat
except
ImportError
:
logger
.
debug
(
"pymdstat library not found. Glances cannot grab RAID info."
)
except
ImportError
as
e
:
import_error_tag
=
True
logger
.
warning
(
"Missing Python Lib ({}), Raid plugin is disable"
.
format
(
e
))
else
:
import_error_tag
=
False
class
Plugin
(
GlancesPlugin
):
...
...
@@ -57,6 +60,9 @@ class Plugin(GlancesPlugin):
# Reset stats
self
.
reset
()
if
import_error_tag
:
return
self
.
stats
if
self
.
input_method
==
'local'
:
# Update stats using the PyMDstat lib (https://github.com/nicolargo/pymdstat)
try
:
...
...
glances/plugins/glances_wifi.py
浏览文件 @
5f52c03f
...
...
@@ -31,11 +31,11 @@ import psutil
try
:
from
wifi.scan
import
Cell
from
wifi.exceptions
import
InterfaceError
except
ImportError
:
logger
.
debug
(
"Wifi library not found. Glances cannot grab Wifi info."
)
wifi_tag
=
False
except
ImportError
as
e
:
import_error_tag
=
True
logger
.
warning
(
"Missing Python Lib ({}), Wifi plugin is disable"
.
format
(
e
))
else
:
wifi_tag
=
Tru
e
import_error_tag
=
Fals
e
class
Plugin
(
GlancesPlugin
):
...
...
@@ -81,7 +81,7 @@ class Plugin(GlancesPlugin):
self
.
reset
()
# Exist if we can not grab the stats
if
not
wifi
_tag
:
if
import_error
_tag
:
return
self
.
stats
if
self
.
input_method
==
'local'
:
...
...
@@ -167,7 +167,7 @@ class Plugin(GlancesPlugin):
ret
=
[]
# Only process if stats exist and display plugin enable...
if
not
self
.
stats
or
not
wifi
_tag
or
self
.
is_disable
():
if
not
self
.
stats
or
import_error
_tag
or
self
.
is_disable
():
return
ret
# Max size for the interface name
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录