Projet

Général

Profil

Révision b0b39b01

IDb0b39b018e200cd0b771675fd0a6489f6ee9f045
Parent 26c29daa
Enfant 809639ab

Ajouté par Lars Kruse il y a plus de 5 ans

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

Voir les différences:

plugins/thin/thin_memory
1 1
#!/usr/bin/env ruby
2
# thin_memory - A munin plugin for Linux to monitor memory size of each individual thin process
3
#
4
# For Linux ONLY !
5
# DOES NOT WORK on OSX, Solaris or BSD.
6
# only linux, because this script relies on proc filesystem
7
#
8
# Original author:
9
#   Frederico de Souza Araujo - fred.the.master@gmail.com
10
#   http://www.frederico-araujo.com
11
#
12
# Usurper:
13
#   Adam Michel - elfurbe@furbism.com
14
#   http://www.furbism.com
15
#
16
# Originally based on:
17
#   thin_process_memory -
18
#       A munin plugin to monitor memory size of
19
#       each individual thin process
20
#   by Ben VandenBos and Avvo, Inc.
21
#
22
# This program is free software; you can redistribute it and/or modify
23
# it under the terms of the GNU General Public License version 2
24
# as published by the Free Software Foundation.
25
#
26
# This program is distributed in the hope that it will be useful,
27
# but WITHOUT ANY WARRANTY; without even the implied warranty of
28
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29
# GNU General Public License for more details.
30
#
31
# You should have received a copy of the GNU General Public License along
32
# with this program; if not, write to the Free Software Foundation, Inc.,
33
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
34
#
35
#
2

  
3
=begin
4

  
5
thin_memory - A munin plugin for Linux to monitor memory size of each individual thin process
6

  
7
For Linux ONLY !
8
DOES NOT WORK on OSX, Solaris or BSD.
9
only linux, because this script relies on proc filesystem
10

  
11
Original author:
12
  Frederico de Souza Araujo - fred.the.master@gmail.com
13
  http://www.frederico-araujo.com
14

  
15
Usurper:
16
  Adam Michel - elfurbe@furbism.com
17
  http://www.furbism.com
18

  
19
Originally based on:
20
  thin_process_memory -
21
      A munin plugin to monitor memory size of
22
      each individual thin process
23
  by Ben VandenBos and Avvo, Inc.
24

  
25
This program is free software; you can redistribute it and/or modify
26
it under the terms of the GNU General Public License version 2
27
as published by the Free Software Foundation.
28

  
29
This program is distributed in the hope that it will be useful,
30
but WITHOUT ANY WARRANTY; without even the implied warranty of
31
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
32
GNU General Public License for more details.
33

  
34
You should have received a copy of the GNU General Public License along
35
with this program; if not, write to the Free Software Foundation, Inc.,
36
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
37

  
38

  
36 39
#%# family=auto
37 40
#%# capabilities=autoconf
38 41

  
42
=end
43

  
44

  
39 45
module Munin
40 46
  class ThinProcessMemory
41

  
42 47
    # run main method
43 48
    def run
44 49
      instances = get_pids()
45 50
      instances.each do |instance|
46 51
        pid, port = instance.split("|")
47
        rss = (pid_rss(pid).to_i)/1024
52
        rss = (pid_rss(pid).to_i) / 1024
48 53
        puts "thin_#{port}.value #{rss}"
49 54
      end
50 55
    end
......
67 72
    def autoconf
68 73
      get_pids().length > 0
69 74
    end
70

  
71 75
  end
72 76
end
73 77

  

Formats disponibles : Unified diff