Hello,
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 ...im/kvm_probes.d/vm/monitor
(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:
#!/usr/bin/ruby
#
RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
GEMS_LOCATION = '/usr/share/one/gems'
if File.directory?(GEMS_LOCATION)
Gem.use_paths(GEMS_LOCATION)
end
$LOAD_PATH << RUBY_LIB_LOCATION
require 'ffi-rzmq'
require 'base64'
@context = ZMQ::Context.new(1)
@subscriber = @context.socket(ZMQ::SUB)
@subscriber.setsockopt(ZMQ::SUBSCRIBE, "EVENT")
@subscriber.connect("tcp://localhost:2101")
key = ''
content = ''
loop do
@subscriber.recv_string(key)
@subscriber.recv_string(content)
puts "Key: #{key}"
# puts "Key: #{key}\nContent: #{Base64.decode64(content)}"
puts "\n===================================================================\n"
end
What am I missing?
Best Regards,
Anton Todorov