Import ceilometer-nova-compute
This script is used to grab notifications from existing hosts Change-Id: I45826fd6941d7bd93464bf945903b6b41223745c Signed-off-by: Julien Danjou <julien.danjou@enovance.com>
This commit is contained in:
parent
bca0ead8d2
commit
85beac0fa8
42
bin/ceilometer-nova-compute
Executable file
42
bin/ceilometer-nova-compute
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# Copyright © 2012 eNovance <licensing@enovance.com>
|
||||||
|
#
|
||||||
|
# Author: Julien Danjou <julien@danjou.info>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
def consumer(msg):
|
||||||
|
# XXX This should resend message to some bus for data collection
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import sys
|
||||||
|
from nova import flags
|
||||||
|
# Import rabbit_notifier to register notification_topics flag
|
||||||
|
import nova.notifier.rabbit_notifier
|
||||||
|
|
||||||
|
flags.FLAGS(sys.argv)
|
||||||
|
|
||||||
|
from ceilometer.rpc import Connection
|
||||||
|
|
||||||
|
connection = Connection(flags.FLAGS)
|
||||||
|
connection.create_consumer("%s.info" % flags.FLAGS.notification_topics[0],
|
||||||
|
consumer, fanout=False)
|
||||||
|
while True:
|
||||||
|
connection.consume()
|
0
ceilometer/__init__.py
Normal file
0
ceilometer/__init__.py
Normal file
33
ceilometer/rpc/__init__.py
Normal file
33
ceilometer/rpc/__init__.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# Copyright © 2012 eNovance <licensing@enovance.com>
|
||||||
|
#
|
||||||
|
# Author: Julien Danjou <julien@danjou.info>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
from nova.rpc import impl_kombu
|
||||||
|
|
||||||
|
|
||||||
|
class Connection(impl_kombu.Connection):
|
||||||
|
"""A Kombu connection that does not use the AMQP Proxy class when
|
||||||
|
creating a consumer, so we can decode the message ourself."""
|
||||||
|
|
||||||
|
def create_consumer(self, topic, proxy, fanout=False):
|
||||||
|
"""Create a consumer without using ProxyCallback."""
|
||||||
|
if fanout:
|
||||||
|
self.declare_fanout_consumer(topic, proxy)
|
||||||
|
else:
|
||||||
|
self.declare_topic_consumer(topic, proxy)
|
Loading…
x
Reference in New Issue
Block a user