Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
7e1ec7c3
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,发现更多精彩内容 >>
提交
7e1ec7c3
编写于
10月 23, 2016
作者:
N
nicolargo
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'issue718' into develop
上级
f77553c4
708bdc48
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
71 addition
and
10 deletion
+71
-10
NEWS
NEWS
+1
-0
conf/glances.conf
conf/glances.conf
+10
-1
docs/aoa/network.rst
docs/aoa/network.rst
+30
-5
glances/config.py
glances/config.py
+10
-0
glances/plugins/glances_network.py
glances/plugins/glances_network.py
+20
-4
未找到文件。
NEWS
浏览文件 @
7e1ec7c3
...
...
@@ -10,6 +10,7 @@ Enhancements and news features:
* Add ZeroMQ exporter (issue #939)
* Add CouchDB exporter (issue #928)
* Add hotspot Wifi informations (issue #937)
* Add default interface speed and automatic rate thresolds (issue #718)
* Highlight max stats in the processes list (issue #878)
* Docker alerts and actions (issue #875)
* Glances API returns the processes PPID (issue #926)
...
...
conf/glances.conf
浏览文件 @
7e1ec7c3
...
...
@@ -96,11 +96,20 @@ careful=50
warning
=
70
critical
=
90
#[network]
[
network
]
# Default bitrate thresholds in % of the network interface speed
# Default values if not defined: 70/80/90
rx_careful
=
70
rx_warning
=
80
rx_critical
=
90
tx_careful
=
70
tx_warning
=
80
tx_critical
=
90
# Define the list of hidden network interfaces (comma-separated regexp)
#hide=docker.*,lo
# WLAN 0 alias
#wlan0_alias=Wireless IF
# It is possible to overwrite the bitrate thresholds per interface
# WLAN 0 Default limits (in bits per second aka bps) for interface bitrate
#wlan0_rx_careful=4000000
#wlan0_rx_warning=5000000
...
...
docs/aoa/network.rst
浏览文件 @
7e1ec7c3
...
...
@@ -8,16 +8,20 @@ Network
Glances displays the network interface bit rate. The unit is adapted
dynamically (bit/s, kbit/s, Mbit/s, etc).
Alerts are only set if the maximum speed per network interface is
available (see sample in the configuration file).
If the interface speed is detected (not on all systems), the defaults
thresholds are applied (70% for careful, 80% warning and 90% critical).
It is possible to define this percents thresholds form the configuration
file. It is also possible to define per interface bit rate thresholds.
In this case thresholds values are define in bps.
It's also possible to
define:
Additionally, you can
define:
- a list of network interfaces to hide
- per-interface limit values
- aliases for interface name
in the ``[network]`` section of the configuration file.
The configuration should be done in the ``[network]`` section of the
Glances configuration file.
For example, if you want to hide the loopback interface (lo) and all the
virtual docker interface (docker0, docker1, ...):
...
...
@@ -25,4 +29,25 @@ virtual docker interface (docker0, docker1, ...):
.. code-block:: ini
[network]
hide=lo,docker.*
# Default bitrate thresholds in % of the network interface speed
# Default values if not defined: 70/80/90
rx_careful=70
rx_warning=80
rx_critical=90
tx_careful=70
tx_warning=80
tx_critical=90
# Define the list of hidden network interfaces (comma-separated regexp)
hide=docker.*,lo
# WLAN 0 alias
wlan0_alias=Wireless IF
# It is possible to overwrite the bitrate thresholds per interface
# WLAN 0 Default limits (in bits per second aka bps) for interface bitrate
wlan0_rx_careful=4000000
wlan0_rx_warning=5000000
wlan0_rx_critical=6000000
wlan0_rx_log=True
wlan0_tx_careful=700000
wlan0_tx_warning=900000
wlan0_tx_critical=1000000
wlan0_tx_log=True
glances/config.py
浏览文件 @
7e1ec7c3
...
...
@@ -172,6 +172,16 @@ class Config(object):
self
.
set_default
(
'memswap'
,
'warning'
,
'70'
)
self
.
set_default
(
'memswap'
,
'critical'
,
'90'
)
# NETWORK
if
not
self
.
parser
.
has_section
(
'network'
):
self
.
parser
.
add_section
(
'network'
)
self
.
set_default
(
'network'
,
'rx_careful'
,
'70'
)
self
.
set_default
(
'network'
,
'rx_warning'
,
'80'
)
self
.
set_default
(
'network'
,
'rx_critical'
,
'90'
)
self
.
set_default
(
'network'
,
'tx_careful'
,
'70'
)
self
.
set_default
(
'network'
,
'tx_warning'
,
'80'
)
self
.
set_default
(
'network'
,
'tx_critical'
,
'90'
)
# FS
if
not
self
.
parser
.
has_section
(
'fs'
):
self
.
parser
.
add_section
(
'fs'
)
...
...
glances/plugins/glances_network.py
浏览文件 @
7e1ec7c3
...
...
@@ -22,6 +22,7 @@
import
base64
import
operator
from
glances.logger
import
logger
from
glances.timer
import
getTimeSinceLastUpdate
from
glances.plugins.glances_plugin
import
GlancesPlugin
...
...
@@ -240,10 +241,25 @@ class Plugin(GlancesPlugin):
# Alert
for
i
in
self
.
stats
:
ifrealname
=
i
[
'interface_name'
].
split
(
':'
)[
0
]
self
.
views
[
i
[
self
.
get_key
()]][
'rx'
][
'decoration'
]
=
self
.
get_alert
(
int
(
i
[
'rx'
]
//
i
[
'time_since_update'
]
*
8
),
header
=
ifrealname
+
'_rx'
)
self
.
views
[
i
[
self
.
get_key
()]][
'tx'
][
'decoration'
]
=
self
.
get_alert
(
int
(
i
[
'tx'
]
//
i
[
'time_since_update'
]
*
8
),
header
=
ifrealname
+
'_tx'
)
# Convert rate in bps ( to be able to compare to interface speed)
bps_rx
=
int
(
i
[
'rx'
]
//
i
[
'time_since_update'
]
*
8
)
bps_tx
=
int
(
i
[
'tx'
]
//
i
[
'time_since_update'
]
*
8
)
# Decorate the bitrate with the configuration file thresolds
alert_rx
=
self
.
get_alert
(
bps_rx
,
header
=
ifrealname
+
'_rx'
)
alert_tx
=
self
.
get_alert
(
bps_tx
,
header
=
ifrealname
+
'_tx'
)
# If nothing is define in the configuration file...
# ... then use the interface speed (not available on all systems)
if
alert_rx
==
'DEFAULT'
and
'speed'
in
i
and
i
[
'speed'
]
!=
0
:
alert_rx
=
self
.
get_alert
(
current
=
bps_rx
,
maximum
=
i
[
'speed'
],
header
=
'rx'
)
if
alert_tx
==
'DEFAULT'
and
'speed'
in
i
and
i
[
'speed'
]
!=
0
:
alert_tx
=
self
.
get_alert
(
current
=
bps_tx
,
maximum
=
i
[
'speed'
],
header
=
'tx'
)
# then decorates
self
.
views
[
i
[
self
.
get_key
()]][
'rx'
][
'decoration'
]
=
alert_rx
self
.
views
[
i
[
self
.
get_key
()]][
'tx'
][
'decoration'
]
=
alert_tx
def
msg_curse
(
self
,
args
=
None
,
max_width
=
None
):
"""Return the dict to display in the curse interface."""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录