Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
e0a8568f
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 搜索 >>
提交
e0a8568f
编写于
2月 05, 2017
作者:
N
nicolargo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove Py3sensors and replace it by PsUtil
上级
83d04ccf
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
27 addition
and
28 deletion
+27
-28
NEWS
NEWS
+4
-0
README.rst
README.rst
+1
-3
glances/plugins/glances_sensors.py
glances/plugins/glances_sensors.py
+22
-25
未找到文件。
NEWS
浏览文件 @
e0a8568f
...
...
@@ -5,6 +5,10 @@ Glances Version 2
Version 2.8.1
=============
Changes:
* Use new sensors-related APIs of Psutil 5.1.0 (issue #1018)
Bugs corrected:
* Autodiscover error while binding on IPv6 addresses (issue #1002)
...
...
README.rst
浏览文件 @
e0a8568f
...
...
@@ -64,7 +64,6 @@ Optional dependencies:
- ``nvidia-ml-py`` (for the GPU plugin)
- ``pika`` (for the RabbitMQ/ActiveMQ export module)
- ``potsdb`` (for the OpenTSDB export module)
- ``py3sensors`` (for hardware monitoring support) [Linux-only]
- ``py-cpuinfo`` (for the Quicklook CPU info module)
- ``pymdstat`` (for RAID support) [Linux-only]
- ``pysnmp`` (for SNMP support)
...
...
@@ -132,12 +131,11 @@ just install psutil from the binary installation file.
to install the *wireless-tools* package on your system.
You can also install the following libraries in order to use optional
features (like the Web interface, exports modules
, sensors
...):
features (like the Web interface, exports modules...):
.. code-block:: console
pip install glances[action,batinfo,browser,cpuinfo,chart,docker,export,folders,gpu,ip,raid,snmp,web,wifi]
pip install https://bitbucket.org/gleb_zhulik/py3sensors/get/tip.zip
To upgrade Glances to the latest version:
...
...
glances/plugins/glances_sensors.py
浏览文件 @
e0a8568f
...
...
@@ -19,14 +19,10 @@
"""Sensors plugin."""
# Sensors library (optional; Linux-only)
# Py3Sensors: https://bitbucket.org/gleb_zhulik/py3sensors
try
:
import
sensors
except
ImportError
:
pass
from
psutil
import
sensors_temperatures
from
glances.logger
import
logger
from
glances.compat
import
iteritems
from
glances.plugins.glances_batpercent
import
Plugin
as
BatPercentPlugin
from
glances.plugins.glances_hddtemp
import
Plugin
as
HddTempPlugin
from
glances.plugins.glances_plugin
import
GlancesPlugin
...
...
@@ -228,7 +224,7 @@ class GlancesGrabSensors(object):
def
__init__
(
self
):
"""Init sensors stats."""
try
:
sensors
.
init
()
sensors
_temperatures
()
except
Exception
:
self
.
initok
=
False
else
:
...
...
@@ -246,24 +242,25 @@ class GlancesGrabSensors(object):
# Reset the list
self
.
reset
()
if
self
.
initok
:
for
chip
in
sensors
.
iter_detected_chips
():
for
feature
in
chip
:
sensors_current
=
{}
if
feature
.
name
.
startswith
(
b
'temp'
):
# Temperature sensor
sensors_current
[
'unit'
]
=
SENSOR_TEMP_UNIT
elif
feature
.
name
.
startswith
(
b
'fan'
):
# Fan speed sensor
sensors_current
[
'unit'
]
=
SENSOR_FAN_UNIT
if
sensors_current
:
try
:
sensors_current
[
'label'
]
=
feature
.
label
sensors_current
[
'value'
]
=
int
(
feature
.
get_value
())
except
Exception
as
e
:
logger
.
debug
(
"Cannot grab sensor stat (%s)"
%
e
)
else
:
self
.
sensors_list
.
append
(
sensors_current
)
if
not
self
.
initok
:
return
self
.
sensors_list
# Temperature sensor
for
chipname
,
chip
in
iteritems
(
sensors_temperatures
()):
i
=
1
for
feature
in
chip
:
sensors_current
=
{}
# Sensor name
if
feature
.
label
==
''
:
sensors_current
[
'label'
]
=
chipname
+
' '
+
str
(
i
)
else
:
sensors_current
[
'label'
]
=
feature
.
label
# Temperature and unit
sensors_current
[
'value'
]
=
int
(
feature
.
current
)
sensors_current
[
'unit'
]
=
SENSOR_TEMP_UNIT
# Add sensor to the list
self
.
sensors_list
.
append
(
sensors_current
)
i
+=
1
return
self
.
sensors_list
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录