Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
20ca58d5
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 搜索 >>
提交
20ca58d5
编写于
3月 31, 2019
作者:
N
nicolargo
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into issue1446
上级
2853f54e
f9ae1eb7
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
46 addition
and
51 deletion
+46
-51
NEWS
NEWS
+2
-0
conf/glances.conf
conf/glances.conf
+1
-0
glances/exports/glances_mqtt.py
glances/exports/glances_mqtt.py
+8
-5
glances/plugins/glances_alert.py
glances/plugins/glances_alert.py
+35
-46
未找到文件。
NEWS
浏览文件 @
20ca58d5
...
...
@@ -15,6 +15,8 @@ Bugs corrected:
* Fix Cassandra table name export #1402
* 500 Internal Server Error /api/3/network/interface_name #1401
* Connection to MQTT server failed : getaddrinfo() argument 2 must be integer or string #1450
* `l` keypress (hide alert log) not working after some time #1449
Others:
...
...
conf/glances.conf
浏览文件 @
20ca58d5
...
...
@@ -413,6 +413,7 @@ port=8883
user
=
guest
password
=
guest
topic
=
glances
tls
=
true
[
couchdb
]
# Configuration for the --export couchdb option
...
...
glances/exports/glances_mqtt.py
浏览文件 @
20ca58d5
...
...
@@ -42,20 +42,22 @@ class Export(GlancesExport):
self
.
user
=
None
self
.
password
=
None
self
.
topic
=
None
self
.
tls
=
'true'
# Load the MQTT configuration file
self
.
export_enable
=
self
.
load_conf
(
'mqtt'
,
mandatories
=
[
'host'
,
'password'
],
options
=
[
'port'
,
'user'
,
'topic'
])
options
=
[
'port'
,
'user'
,
'topic'
,
'tls'
])
if
not
self
.
export_enable
:
exit
(
'Missing MQTT config'
)
# Get the current hostname
self
.
hostname
=
socket
.
gethostname
()
self
.
port
=
self
.
port
or
8883
self
.
port
=
int
(
self
.
port
)
or
8883
self
.
topic
=
self
.
topic
or
'glances'
self
.
user
=
self
.
user
or
'glances'
self
.
tls
=
(
self
.
tls
.
lower
()
==
'true'
)
# Init the MQTT client
self
.
client
=
self
.
init
()
...
...
@@ -69,6 +71,7 @@ class Export(GlancesExport):
clean_session
=
False
)
client
.
username_pw_set
(
username
=
self
.
user
,
password
=
self
.
password
)
if
self
.
tls
:
client
.
tls_set
(
certs
.
where
())
client
.
connect
(
host
=
self
.
host
,
port
=
self
.
port
)
...
...
@@ -81,8 +84,8 @@ class Export(GlancesExport):
def
export
(
self
,
name
,
columns
,
points
):
"""Write the points in MQTT."""
WHITELIST
=
'_-'
+
string
.
ascii_letters
+
string
.
digits
SUBSTITUTE
=
'_'
WHITELIST
=
'_-'
+
string
.
ascii_letters
+
string
.
digits
SUBSTITUTE
=
'_'
def
whitelisted
(
s
,
whitelist
=
WHITELIST
,
...
...
glances/plugins/glances_alert.py
浏览文件 @
20ca58d5
...
...
@@ -114,22 +114,12 @@ class Plugin(GlancesPlugin):
ret
=
[]
# Only process if display plugin enable...
if
not
self
.
stats
and
self
.
is_disable
():
if
not
self
.
stats
or
self
.
is_disable
():
return
ret
# Build the string message
# Header
ret
.
append
(
self
.
curse_add_line
(
global_message
(),
"TITLE"
))
if
self
.
stats
:
# Header
# msg = 'Warning or critical alerts'
# ret.append(self.curse_add_line(msg, "TITLE"))
# logs_len = glances_events.len()
# if logs_len > 1:
# msg = ' (last {} entries)'.format(logs_len)
# else:
# msg = ' (one entry)'
# ret.append(self.curse_add_line(msg, "TITLE"))
# Loop over alerts
for
alert
in
self
.
stats
:
# New line
...
...
@@ -166,7 +156,6 @@ class Plugin(GlancesPlugin):
if
top_process
!=
''
:
msg
=
': {}'
.
format
(
top_process
)
ret
.
append
(
self
.
curse_add_line
(
msg
))
# logger.info(alert)
return
ret
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录