diff --git a/bin/ceilometer-nova-compute b/bin/ceilometer-nova-compute new file mode 100755 index 000000000..328524c97 --- /dev/null +++ b/bin/ceilometer-nova-compute @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- encoding: utf-8 -*- +# +# Copyright © 2012 eNovance +# +# Author: Julien Danjou +# +# 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 . +# + + +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() diff --git a/ceilometer/__init__.py b/ceilometer/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/ceilometer/rpc/__init__.py b/ceilometer/rpc/__init__.py new file mode 100644 index 000000000..cd9e841e5 --- /dev/null +++ b/ceilometer/rpc/__init__.py @@ -0,0 +1,33 @@ +# -*- encoding: utf-8 -*- +# +# Copyright © 2012 eNovance +# +# Author: Julien Danjou +# +# 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 . +# + +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)