Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
e3f8635b
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,发现更多精彩内容 >>
提交
e3f8635b
编写于
1月 11, 2015
作者:
N
Nicolargo
提交者:
Alessio Sergi
1月 12, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
User can force log/alert using the configuration file (issue #437)
上级
af7eeb6d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
68 addition
and
8 deletion
+68
-8
NEWS
NEWS
+1
-0
conf/glances-test.conf
conf/glances-test.conf
+6
-1
conf/glances.conf
conf/glances.conf
+6
-0
docs/glances-doc.rst
docs/glances-doc.rst
+28
-0
glances/plugins/glances_cpu.py
glances/plugins/glances_cpu.py
+1
-1
glances/plugins/glances_plugin.py
glances/plugins/glances_plugin.py
+26
-6
未找到文件。
NEWS
浏览文件 @
e3f8635b
...
...
@@ -14,6 +14,7 @@ Enhancements and news features:
* The Web inteface is now based on BootStarp / RWD grid (issue #417, #366 and #461) Thanks to Nicolas Hart @nclsHart
* Add the RAID plugin (issue #447)
* Add the Docker plugin (issue #440)
* It is possible to define (through teh configuration file) if an alarm should be logged or not (using the _log option) (issue #437)
Bugs corrected:
...
...
conf/glances-test.conf
浏览文件 @
e3f8635b
...
...
@@ -3,6 +3,7 @@
user_careful
=
50
user_warning
=
70
user_critical
=
90
#user_log=False
user_critical_action
=
echo
{{
user
}} {{
value
}} {{
max
}} > /
tmp
/
cpu
.
alert
iowait_careful
=
50
iowait_warning
=
70
...
...
@@ -13,6 +14,7 @@ system_critical=90
steal_careful
=
50
steal_warning
=
70
steal_critical
=
90
#steal_log=True
[
percpu
]
# Default values if not defined: 50/70/90
...
...
@@ -34,6 +36,7 @@ system_critical=90
careful
=
0
.
7
warning
=
1
.
0
critical
=
5
.
0
#log=False
[
mem
]
# Default limits for free RAM memory in %
...
...
@@ -53,14 +56,16 @@ critical=90
# Define the list of hidden network interfaces (comma separeted)
hide
=
lo
# WLAN0 alias name
wlan0_alias
=
Wireless
#
wlan0_alias=Wireless
# WLAN0 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
[
diskio
]
# Define the list of hidden disks (comma separeted)
...
...
conf/glances.conf
浏览文件 @
e3f8635b
...
...
@@ -3,6 +3,8 @@
user_careful
=
50
user_warning
=
70
user_critical
=
90
#user_log=False
#user_critical_action=echo {{user}} {{value}} {{max}} > /tmp/cpu.alert
iowait_careful
=
50
iowait_warning
=
70
iowait_critical
=
90
...
...
@@ -12,6 +14,7 @@ system_critical=90
steal_careful
=
50
steal_warning
=
70
steal_critical
=
90
#steal_log=True
[
percpu
]
# Default values if not defined: 50/70/90
...
...
@@ -33,6 +36,7 @@ system_critical=90
careful
=
0
.
7
warning
=
1
.
0
critical
=
5
.
0
#log=False
[
mem
]
# Default limits for free RAM memory in %
...
...
@@ -57,9 +61,11 @@ critical=90
#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
#[diskio]
# Define the list of hidden disks (comma separeted)
...
...
docs/glances-doc.rst
浏览文件 @
e3f8635b
...
...
@@ -320,6 +320,34 @@ e.g., on Linux:
On OS X, you should copy the configuration file to
``~/Library/Application Support/glances/``.
*Configuration file description*
Each plugin and export module can have a section.
Example for the CPU plugin:
.. code-block::
[cpu]
user_careful=50
user_warning=70
user_critical=90
iowait_careful=50
iowait_warning=70
iowait_critical=90
system_careful=50
system_warning=70
system_critical=90
steal_careful=50
steal_warning=70
steal_critical=90
By default Steal CPU time alerts aren't logged. If you want to enable log/alert, just add:
.. code-block::
steal_log=True
Logs and debug mode
===================
...
...
glances/plugins/glances_cpu.py
浏览文件 @
e3f8635b
...
...
@@ -131,7 +131,7 @@ class Plugin(GlancesPlugin):
return
self
.
stats
def
msg_curse
(
self
,
args
=
None
):
"""Return the list to display in the
curse interface.
"""
"""Return the list to display in the
UI
"""
# Init the return message
ret
=
[]
...
...
glances/plugins/glances_plugin.py
浏览文件 @
e3f8635b
...
...
@@ -292,7 +292,9 @@ class GlancesPlugin(object):
If defined 'header' is added between the plugin name and the status.
Only useful for stats with several alert status.
If log=True than return the logged status.
If log=True than add log if necessary
elif log=False than do not log
elig log=None than apply the config given in the conf file
"""
# Compute the %
try
:
...
...
@@ -324,7 +326,7 @@ class GlancesPlugin(object):
# Manage log
log_str
=
""
if
log
:
if
self
.
__get_limit_log
(
stat_name
=
stat_name
,
default_action
=
log
)
:
# Add _LOG to the return string
# So stats will be highlited with a specific color
log_str
=
"_LOG"
...
...
@@ -376,17 +378,35 @@ class GlancesPlugin(object):
def
__get_limit_action
(
self
,
criticity
,
stat_name
=
""
):
"""Return the action for the alert"""
# Get the
limit
for stat + header
# Get the
action
for stat + header
# Exemple: network_wlan0_rx_careful_action
try
:
action
=
self
.
limits
[
stat_name
+
'_'
+
criticity
+
'_action'
]
ret
=
self
.
limits
[
stat_name
+
'_'
+
criticity
+
'_action'
]
except
KeyError
:
# Try fallback to plugin default limit
# Exemple: network_careful_action
action
=
self
.
limits
[
self
.
plugin_name
+
'_'
+
criticity
+
'_action'
]
ret
=
self
.
limits
[
self
.
plugin_name
+
'_'
+
criticity
+
'_action'
]
# Return the action list
return
ret
def
__get_limit_log
(
self
,
stat_name
,
default_action
=
False
):
"""Return the log tag for the alert"""
# Get the log tag for stat + header
# Exemple: network_wlan0_rx_log
try
:
log_tag
=
self
.
limits
[
stat_name
+
'_log'
]
except
KeyError
:
# Try fallback to plugin default log
# Exemple: network_log
try
:
log_tag
=
self
.
limits
[
self
.
plugin_name
+
'_log'
]
except
KeyError
:
# By defaukt, log are disabled
return
default_action
# Return the action list
return
action
return
log_tag
[
0
].
lower
()
==
'true'
def
get_conf_value
(
self
,
value
,
header
=
""
,
plugin_name
=
None
):
"""Return the configuration (header_) value for the current plugin (or the one given by the plugin_name var)"""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录