Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
36c2f7d8
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 搜索 >>
提交
36c2f7d8
编写于
4月 07, 2015
作者:
K
Katyucha
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update for python3. Need package python3-pika
上级
26bea1ac
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
34 addition
and
3 deletion
+34
-3
docs/glances-doc.rst
docs/glances-doc.rst
+21
-0
glances/exports/glances_rabbitmq.py
glances/exports/glances_rabbitmq.py
+7
-3
man/glances.1
man/glances.1
+6
-0
未找到文件。
docs/glances-doc.rst
浏览文件 @
36c2f7d8
...
...
@@ -159,6 +159,8 @@ Command-Line Options
export stats to an InfluxDB server
--export-statsd
export stats to a Statsd server
--export-rabbitmq
export stats to a RabbitMQ server
-c CLIENT, --client CLIENT
connect to a Glances server by IPv4/IPv6 address or
hostname
...
...
@@ -824,6 +826,25 @@ Glances will generate stats as:
'glances.load.min1': 0.19,
...
*RabbitMQ*
You can export statistics to an RabbitMQ server (AMQP Broker). The connection should be defined in the Glances configuration file as following:
.. code-block::
[rabbitmq]
host=localhost
port=5672
user=glances
password=glances
queue=glances_queue
and run Glances with:
.. code-block:: console
$ glances --export-rabbitmq
APIs Documentations
===================
...
...
glances/exports/glances_rabbitmq.py
浏览文件 @
36c2f7d8
...
...
@@ -25,7 +25,10 @@ from numbers import Number
# Import Glances lib
from
glances.core.glances_logging
import
logger
from
configparser
import
NoSectionError
,
NoOptionError
try
:
from
configparser
import
NoOptionError
,
NoSectionError
except
ImportError
:
# Python 2
from
ConfigParser
import
NoOptionError
,
NoSectionError
from
glances.exports.glances_export
import
GlancesExport
# Import pika for RabbitMQ
...
...
@@ -78,13 +81,14 @@ class Export(GlancesExport):
"""Init the connection to the rabbitmq server"""
if
not
self
.
export_enable
:
return
None
sparameters
=
"amqp://"
+
self
.
rabbitmq_user
+
":"
+
self
.
rabbitmq_password
+
"@"
+
self
.
rabbitmq_host
+
":"
+
self
.
rabbitmq_port
+
"/"
try
:
parameters
=
pika
.
URLParameters
(
"amqp://"
+
self
.
rabbitmq_user
+
":"
+
self
.
rabbitmq_password
+
"@"
+
self
.
rabbitmq_host
+
":"
+
self
.
rabbitmq_port
+
"/"
)
parameters
=
pika
.
URLParameters
(
sparameters
)
connection
=
pika
.
BlockingConnection
(
parameters
)
channel
=
connection
.
channel
()
return
channel
except
Exception
as
e
:
logger
.
critical
(
"Connection to rabbitMQ failed : %s"
%
e
)
logger
.
critical
(
"Connection to rabbitMQ failed : %s
"
%
e
)
return
None
def
export
(
self
,
name
,
columns
,
points
):
...
...
man/glances.1
浏览文件 @
36c2f7d8
...
...
@@ -80,6 +80,9 @@ export stats to an InfluxDB server
.B \-\-export-statsd
export stats to a Statsd server
.TP
.B \-\-export-rabbitmq
export stats to a RabbitMQ server
.TP
.B \-s, \-\-server
run Glances in server mode
.TP
...
...
@@ -234,6 +237,9 @@ Monitor local machine and export stats to a CSV file (standalone mode):
Monitor local machine and export stats to a InfluxDB server with 5s refresh time (standalone mode):
.B $ glances -t 5 --export-influxdb
.PP
Monitor local machine and export stats to a RabbitMQ server with 5s refresh time (standalone mode):
.B $ glances -t 5 --export-rabbitmq
.PP
Start a Glances server (server mode):
.B $ glances -s
.PP
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录