Révision b0b39b01
Ruby plugins: apply style changes as suggested by "rubocop --fix-layout"
| plugins/http/mongrel_memory | ||
|---|---|---|
| 1 | 1 |
#!/usr/bin/env ruby |
| 2 |
# mongrel_memory - A munin plugin for OpenSolaris to monitor memory size of |
|
| 3 |
# each individual mongrel process |
|
| 4 |
# Copyright (C) 2009 Matthias Marschall - mm@agileweboperations.com |
|
| 5 |
# |
|
| 6 |
# Based on: |
|
| 7 |
# mongrel_process_memory - A munin plugin to monitor memory size of |
|
| 8 |
# each individual mongrel process |
|
| 9 |
# Copyright (C) 2007 Ben VandenBos and Avvo, Inc. |
|
| 10 |
# |
|
| 11 |
# This program is free software; you can redistribute it and/or modify |
|
| 12 |
# it under the terms of the GNU General Public License version 2 |
|
| 13 |
# as published by the Free Software Foundation. |
|
| 14 |
# |
|
| 15 |
# This program is distributed in the hope that it will be useful, |
|
| 16 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 17 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 18 |
# GNU General Public License for more details. |
|
| 19 |
# |
|
| 20 |
# You should have received a copy of the GNU General Public License along |
|
| 21 |
# with this program; if not, write to the Free Software Foundation, Inc., |
|
| 22 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|
| 23 |
# |
|
| 24 |
# Author: Ben VandenBos |
|
| 25 |
# Contributors: Adam Jacob (<adam@hjksolutions.com>) |
|
| 26 |
# Ryan Woodrum |
|
| 27 |
# Matthias Marschall (mm@agileweboperations.com) |
|
| 28 |
# |
|
| 2 |
|
|
| 3 |
=begin |
|
| 4 |
|
|
| 5 |
mongrel_memory - A munin plugin for OpenSolaris to monitor memory size of |
|
| 6 |
each individual mongrel process |
|
| 7 |
Copyright (C) 2009 Matthias Marschall - mm@agileweboperations.com |
|
| 8 |
|
|
| 9 |
Based on: |
|
| 10 |
mongrel_process_memory - A munin plugin to monitor memory size of |
|
| 11 |
each individual mongrel process |
|
| 12 |
Copyright (C) 2007 Ben VandenBos and Avvo, Inc. |
|
| 13 |
|
|
| 14 |
This program is free software; you can redistribute it and/or modify |
|
| 15 |
it under the terms of the GNU General Public License version 2 |
|
| 16 |
as published by the Free Software Foundation. |
|
| 17 |
|
|
| 18 |
This program is distributed in the hope that it will be useful, |
|
| 19 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 20 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 21 |
GNU General Public License for more details. |
|
| 22 |
|
|
| 23 |
You should have received a copy of the GNU General Public License along |
|
| 24 |
with this program; if not, write to the Free Software Foundation, Inc., |
|
| 25 |
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|
| 26 |
|
|
| 27 |
Author: Ben VandenBos |
|
| 28 |
Contributors: Adam Jacob (<adam@hjksolutions.com>) |
|
| 29 |
Ryan Woodrum |
|
| 30 |
Matthias Marschall (mm@agileweboperations.com) |
|
| 31 |
|
|
| 29 | 32 |
#%# family=auto |
| 30 | 33 |
#%# capabilities=autoconf |
| 31 | 34 |
|
| 35 |
=end |
|
| 36 |
|
|
| 37 |
|
|
| 32 | 38 |
module Munin |
| 33 | 39 |
class MongrelProcessMemory |
| 34 |
|
|
| 35 | 40 |
def run |
| 36 | 41 |
pid_port_map = get_pids() |
| 37 | 42 |
port_list = Hash.new |
| ... | ... | |
| 48 | 53 |
pids += `pgrep ruby`.split("\n")
|
| 49 | 54 |
pids.each { |pid|
|
| 50 | 55 |
l = `pargs -l #{pid}`
|
| 51 |
l =~ /-p (\d+)/
|
|
| 52 |
h[pid] = $1 if $1
|
|
| 56 |
l =~ /-p (\d+)/
|
|
| 57 |
h[pid] = $1 if $1
|
|
| 53 | 58 |
} |
| 54 | 59 |
h |
| 55 | 60 |
end |
| ... | ... | |
| 57 | 62 |
def autoconf |
| 58 | 63 |
get_pids().length > 0 |
| 59 | 64 |
end |
| 60 |
|
|
| 61 | 65 |
end |
| 62 | 66 |
end |
| 63 | 67 |
|
Formats disponibles : Unified diff