How to receive VM monitoring data via ZeroMQ?


I’ve asked the question when the Hook Manager was introduced on last OpenNebula Conf and left with the understanding that the VM monitoring data is published on the ZeroMQ.

I am looking for an interface to listen for the VM monitoring updates. I can see that I could drop a monitoring probe in (testing on 5.12-beta but it is same on 5.10) and could see the monitoring data in the oned.log file.

Reading the hooks docs it is not clear should I register a hook in the hook manager to start receiving the VM monitoring data? Couldn’t find pair of STATE/LCM_STATE that define the update of the monitoring data too.

Tried subscribing to the ZeroMQ but there I could see the VM API events but no the monitoring updates.

I believe that the following script is hooking to the HookManagerEvents and that the hook manager is just a “service” that subscribes to ZeroMQ itself.

I am using the following ZeroMQ example script to monitor all events:


RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
GEMS_LOCATION     = '/usr/share/one/gems'



require 'ffi-rzmq'
require 'base64'

@context    =
@subscriber = @context.socket(ZMQ::SUB)

@subscriber.setsockopt(ZMQ::SUBSCRIBE, "EVENT")

key = ''
content = ''

loop do
    puts "Key: #{key}"
#    puts "Key: #{key}\nContent: #{Base64.decode64(content)}"
    puts "\n===================================================================\n"

What am I missing?

Best Regards,
Anton Todorov

Hello @atodorov_storpool,

Maybe there was a misunderstood during the OpenNebula Conf, currently you can use ZeroMQ to subscribes either API calls or VM/HOST state changes, the monitoring update does not trigger any of those so there’s no way for you to directly subscribe to monitoring changes.

Regarding your question:

it is not clear should I register a hook in the hook manager to start receiving the VM monitoring data?

As you said the Hook Execution Manager (HEM) is just a service which subscribes to the needed events via ZeroMQ, you can set a Hook for execute some script when the event arrives or you can also just subscribe yourself to ZeroMQ events ant process the data by your own. But as I said above currently there is no event generated for monitoring updates.

If you just want to retrieve the monitoring information maybe you can periodically retrieve the information via API ( Note that you know the frequency of the monitoring updates as this can be configured.