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
|
@ -36,20 +36,18 @@ You should have received a copy of the GNU General Public License along
|
|||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
=end
|
||||
|
||||
|
||||
module Munin
|
||||
class ThinThreads
|
||||
def run
|
||||
instances = get_pids()
|
||||
instances = get_pids
|
||||
instances.each do |instance|
|
||||
pid, port = instance.split("|")
|
||||
rss = (get_threads(pid).to_i)
|
||||
pid, port = instance.split('|')
|
||||
rss = get_threads(pid).to_i
|
||||
puts "thin_#{port}.value #{rss}"
|
||||
end
|
||||
end
|
||||
|
@ -60,11 +58,11 @@ module Munin
|
|||
# TODO: make this work on OSX and Solaris,
|
||||
# so the whole unix gang is happy ;)
|
||||
def get_threads(pid)
|
||||
res = `grep "Threads" /proc/#{pid}/status | cut -d ":" -f2`.gsub(/\s+/, "")
|
||||
if res.match("cannot access")
|
||||
return nil
|
||||
res = `grep "Threads" /proc/#{pid}/status | cut -d ":" -f2`.gsub(/\s+/, '')
|
||||
if res.match('cannot access')
|
||||
nil
|
||||
else
|
||||
return res
|
||||
res
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -74,7 +72,7 @@ module Munin
|
|||
end
|
||||
|
||||
def autoconf
|
||||
get_pids().length > 0
|
||||
get_pids.length > 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -82,26 +80,26 @@ end
|
|||
mpm = Munin::ThinThreads.new
|
||||
|
||||
case ARGV[0]
|
||||
when "config"
|
||||
puts "graph_title Thin Threads"
|
||||
puts "graph_vlabel Threads"
|
||||
puts "graph_category webserver"
|
||||
puts "graph_args -l 0"
|
||||
puts "graph_scale yes"
|
||||
puts "graph_info Tracks how many threads per thin processes"
|
||||
when 'config'
|
||||
puts 'graph_title Thin Threads'
|
||||
puts 'graph_vlabel Threads'
|
||||
puts 'graph_category webserver'
|
||||
puts 'graph_args -l 0'
|
||||
puts 'graph_scale yes'
|
||||
puts 'graph_info Tracks how many threads per thin processes'
|
||||
mpm.get_pids.each do |instance|
|
||||
pid, port = instance.split("|")
|
||||
pid, port = instance.split('|')
|
||||
puts "thin_#{port}.label thin_#{port}"
|
||||
puts "thin_#{port}.info Threads per Thin process"
|
||||
puts "thin_#{port}.type GAUGE"
|
||||
puts "thin_#{port}.min 0"
|
||||
end
|
||||
when "autoconf"
|
||||
when 'autoconf'
|
||||
if mpm.autoconf
|
||||
puts "yes"
|
||||
puts 'yes'
|
||||
exit 0
|
||||
end
|
||||
puts "no"
|
||||
puts 'no'
|
||||
exit 0
|
||||
else
|
||||
mpm.run
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue