1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 10:39:53 +00:00

Ruby plugins: apply code changes as suggested by "rubocop --auto-correct"

This commit is contained in:
Lars Kruse 2020-08-25 17:06:15 +02:00
parent b0b39b018e
commit 809639ab65
33 changed files with 904 additions and 910 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"
@ -49,54 +49,48 @@ end
one_liners = 0
three_liners = 0
key = ""
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
three_liners += 1
if three_liners == 2
print "Memoryusagepercentage.value "
end
print 'Memoryusagepercentage.value ' if three_liners == 2
if three_liners == 3
print "Memoryusage.value "
end
print 'Memoryusage.value ' if three_liners == 3
if three_liners == 4
print "Memorymax.value "
end
print 'Memorymax.value ' if three_liners == 4
print line.gsub!(/[^0-9.]/s, "")
print line.gsub!(/[^0-9.]/s, '')
print "\n"
end
if one_liners > 0
one_liners = one_liners + 1
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 = ""
line = ''
one_liners = 0
end
if three_liners > 3
line = ""
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 += 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
key = line.gsub!(/(<[^>]*>)|\n|\t| /s, '')
one_liners += 1
end
end
end