1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Ruby plugins: apply style changes as suggested by "rubocop --fix-layout"

This commit is contained in:
Lars Kruse 2020-08-25 16:52:39 +02:00
parent 26c29daa2b
commit b0b39b018e
30 changed files with 1447 additions and 1384 deletions

View file

@ -31,7 +31,7 @@ user = ENV['user'] || 'user'
pwd = ENV['password'] || 'password'
url = ENV['url'] || 'http://127.0.0.1/control.php'
if ARGV[0]=="config"
if ARGV[0] == "config"
print "EAccelerator Monitoring\n"
print "graph_title PHP Eaccelerator\n"
print "graph_category webserver\n"
@ -47,58 +47,56 @@ if ARGV[0]=="config"
exit
end
one_liners=0
three_liners=0
key=""
one_liners = 0
three_liners = 0
key = ""
open(url, :http_basic_authentication=>[user, pwd]) do |f|
open(url, :http_basic_authentication => [user, pwd]) do |f|
f.each do |line|
if three_liners>0
three_liners=three_liners+1
if three_liners > 0
three_liners = three_liners + 1
if three_liners==2
if three_liners == 2
print "Memoryusagepercentage.value "
end
if three_liners==3
if three_liners == 3
print "Memoryusage.value "
end
if three_liners==4
if three_liners == 4
print "Memorymax.value "
end
print line.gsub!(/[^0-9.]/s,"")
print line.gsub!(/[^0-9.]/s, "")
print "\n"
end
if one_liners>0
one_liners=one_liners+1
if one_liners > 0
one_liners = one_liners + 1
print "#{key}.value "
print line.gsub!(/[^0-9.]/s,"")
print line.gsub!(/[^0-9.]/s, "")
print "\n"
end
if one_liners>1
line=""
one_liners=0
if one_liners > 1
line = ""
one_liners = 0
end
if three_liners>3
line=""
three_liners=0
if three_liners > 3
line = ""
three_liners = 0
end
if line =~ /Memory usage/
key=line.gsub!(/(<[^>]*>)|\n|\t| /s,"")
three_liners=three_liners+1
key = line.gsub!(/(<[^>]*>)|\n|\t| /s, "")
three_liners = three_liners + 1
end
if line =~ /<td class="e">Free memory/ || line =~ /<td class="e">Cached scripts/ || line =~ /<td class="e">Removed scripts/ || line =~ /<td class="e">Cached keys/
key=line.gsub!(/(<[^>]*>)|\n|\t| /s,"")
one_liners=one_liners+1
if line =~ /<td class="e">Free memory/ || line =~ /<td class="e">Cached scripts/ || line =~ /<td class="e">Removed scripts/ || line =~ /<td class="e">Cached keys/
key = line.gsub!(/(<[^>]*>)|\n|\t| /s, "")
one_liners = one_liners + 1
end
end
end