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

  
3
=begin
4

  
5
thin_peak_memory -
6
    A munin plugin for Linux to monitor the maximum memory size
7
    that an each individual thin process has reached
8

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

  
13
Author:
14
  Frederico de Souza Araujo - fred.the.master@gmail.com
15
  http://www.frederico-araujo.com
16

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

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

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

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

  
36

  
34 37
#%# family=auto
35 38
#%# capabilities=autoconf
36 39

  
40
=end
41

  
42

  
37 43
module Munin
38 44
  class ThinPeakMemory
39

  
40 45
    def run
41 46
      instances = get_pids()
42 47
      instances.each do |instance|
43 48
        pid, port = instance.split("|")
44
        hwm = (pid_hwm(pid).to_i)/1024
49
        hwm = (pid_hwm(pid).to_i) / 1024
45 50
        puts "thin_#{port}.value #{hwm}"
46 51
      end
47 52
    end
......
69 74
    def autoconf
70 75
      get_pids().length > 0
71 76
    end
72

  
73 77
  end
74 78
end
75 79

  

Formats disponibles : Unified diff