52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/sensu-plugins-rabbitmq/rabbitmq.rb', line 52
def acquire_rabbitmq_info(property = nil)
begin
if config[:ini]
ini = IniFile.load(config[:ini])
section = ini['auth']
username = section['username']
password = section['password']
else
username = config[:username]
password = config[:password]
end
rabbitmq_info = CarrotTop.new(
host: config[:host],
port: config[:port],
user: username,
password: password,
ssl: config[:ssl]
)
rescue StandardError
warning 'could not get rabbitmq info'
end
result_info = rabbitmq_info
unless property.nil?
result_info = rabbitmq_info.send property
if config[:vhost] != ''
result_info.select! { |x| x['vhost'].match(config[:vhost]) }
end
end
result_info
end
|