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 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

@ -24,44 +24,43 @@ Magic markers
=end
#
# Initialize vars
#
$logfile = ENV['logfile'] || "/var/log/moblock.log"
$logfile = ENV['logfile'] || '/var/log/moblock.log'
#
# Configure generated graph
#
def config
puts "graph_args --base 1000 -r --lower-limit 0"
puts "graph_title Moblock"
puts "graph_vlabel Blocked Connections"
puts "graph_category fw"
puts "graph_info This graph shows the number of connections blocked by Moblock"
puts 'graph_args --base 1000 -r --lower-limit 0'
puts 'graph_title Moblock'
puts 'graph_vlabel Blocked Connections'
puts 'graph_category fw'
puts 'graph_info This graph shows the number of connections blocked by Moblock'
puts "blocked_in.label Blocked In"
puts "blocked_in.draw LINE1"
puts "blocked_in.info Number of blocked incoming connections"
puts "blocked_in.type GAUGE"
puts 'blocked_in.label Blocked In'
puts 'blocked_in.draw LINE1'
puts 'blocked_in.info Number of blocked incoming connections'
puts 'blocked_in.type GAUGE'
puts "blocked_out.label Blocked Out"
puts "blocked_out.draw LINE1"
puts "blocked_out.info Number of blocked outgoing connections"
puts "blocked_out.type GAUGE"
puts 'blocked_out.label Blocked Out'
puts 'blocked_out.draw LINE1'
puts 'blocked_out.info Number of blocked outgoing connections'
puts 'blocked_out.type GAUGE'
puts "blocked_total.label Total Blocked"
puts "blocked_total.draw LINE1"
puts "blocked_total.info Total Number of blocked connections"
puts "blocked_total.type GAUGE"
puts 'blocked_total.label Total Blocked'
puts 'blocked_total.draw LINE1'
puts 'blocked_total.info Total Number of blocked connections'
puts 'blocked_total.type GAUGE'
end
#
# Grep moblock logs for stats
#
def fetch(debug = false)
num_in = %x{cat #{$logfile} | grep --extended-regexp 'IN: ' | wc -l}
num_out = %x{cat #{$logfile} | grep --extended-regexp 'OUT: ' | wc -l}
def fetch(_debug = false)
num_in = `cat #{$logfile} | grep --extended-regexp 'IN: ' | wc -l`
num_out = `cat #{$logfile} | grep --extended-regexp 'OUT: ' | wc -l`
num_total = num_in.to_i + num_out.to_i
puts "blocked_in.value #{num_in}"
@ -73,11 +72,11 @@ end
# If moblock executable on path then allow autoconfiguration
#
def autoconf
moblock_path = %x{which moblock}
moblock_path = `which moblock`
if moblock_path.index('moblock')
puts "yes"
puts 'yes'
else
puts "no"
puts 'no'
end
end