mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Ruby plugins: apply code changes as suggested by "rubocop --auto-correct"
This commit is contained in:
parent
b0b39b018e
commit
809639ab65
33 changed files with 904 additions and 910 deletions
|
@ -6,39 +6,37 @@
|
|||
require 'rubygems'
|
||||
require 'jmx4r'
|
||||
|
||||
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
# %# family=auto
|
||||
# %# capabilities=autoconf
|
||||
|
||||
# friendly name => result of listPerfStatsKeys via JMX
|
||||
keys = {
|
||||
"Throughput" => { "vlabel" => "rate",
|
||||
"type" => "ABSOLUTE",
|
||||
"values" => ["all_operation_throughput","delete_throughput", "get_all_throughput", "get_throughput", "put_throughput"]
|
||||
},
|
||||
"Number of Calls" => { "vlabel" => "counts",
|
||||
"type" => "COUNTER",
|
||||
"values" => ["number_of_calls_to_delete","number_of_calls_to_get", "number_of_calls_to_get_all",
|
||||
"number_of_calls_to_put", "number_of_exceptions"]
|
||||
}
|
||||
'Throughput' => { 'vlabel' => 'rate',
|
||||
'type' => 'ABSOLUTE',
|
||||
'values' => %w[all_operation_throughput delete_throughput get_all_throughput get_throughput put_throughput] },
|
||||
'Number of Calls' => { 'vlabel' => 'counts',
|
||||
'type' => 'COUNTER',
|
||||
'values' => %w[number_of_calls_to_delete number_of_calls_to_get number_of_calls_to_get_all
|
||||
number_of_calls_to_put number_of_exceptions] }
|
||||
}
|
||||
|
||||
if ARGV[0] == "config"
|
||||
case ARGV[0]
|
||||
when 'config'
|
||||
keys.each_key do |key|
|
||||
puts "multigraph voldemort_#{key.gsub(" ", "_")}"
|
||||
puts "multigraph voldemort_#{key.gsub(' ', '_')}"
|
||||
puts "graph_title #{key}"
|
||||
puts "graph_scale no"
|
||||
puts "graph_category search"
|
||||
puts 'graph_scale no'
|
||||
puts 'graph_category search'
|
||||
puts "graph_vlabel #{keys[key]['vlabel']}"
|
||||
for data in keys[key]['values'] do
|
||||
keys[key]['values'].each do |data|
|
||||
puts "#{data}.type #{keys[key]['type']}"
|
||||
puts "#{data}.label #{data.gsub("_", " ")}"
|
||||
puts "#{data}.label #{data.gsub('_', ' ')}"
|
||||
end
|
||||
puts
|
||||
end
|
||||
exit 0
|
||||
elsif ARGV[0] == "autoconf"
|
||||
puts "yes"
|
||||
when 'autoconf'
|
||||
puts 'yes'
|
||||
exit 0
|
||||
else
|
||||
|
||||
|
@ -49,16 +47,18 @@ else
|
|||
# Make the platform MBean server able to work with JBossAS MBeans
|
||||
# JAVA_OPTS="$JAVA_OPTS -Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl"
|
||||
# JBOSS_CLASSPATH="/opt/webtrends/jboss/bin/mbean"
|
||||
JMX::MBean.establish_connection :port => 5400
|
||||
vs = JMX::MBean.find_by_name "voldemort.store.stats.aggregate:type=aggregate-perf"
|
||||
JMX::MBean.establish_connection port: 5400
|
||||
vs = JMX::MBean.find_by_name 'voldemort.store.stats.aggregate:type=aggregate-perf'
|
||||
|
||||
keys.each_key do |key|
|
||||
puts "multigraph voldemort_#{key.gsub(" ", "_")}"
|
||||
puts "multigraph voldemort_#{key.gsub(' ', '_')}"
|
||||
for data in keys[key]['values'] do
|
||||
puts "#{data}.value #{begin vs.send("#{data}") rescue 0 end}"
|
||||
puts "#{data}.value #{begin begin
|
||||
vs.send(data.to_s)
|
||||
rescue StandardError
|
||||
0
|
||||
end end}"
|
||||
end
|
||||
puts
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue