Projet

Général

Profil

Révision 17f78427

ID17f784270ae966ee9a13e9f5104a5b8f925b639e
Parent ef851f0c
Enfant d4320aea, 5b2396a9

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

Whitespace cleanup

  • remove trailing whitespace
  • remove empty lines at the end of files

Voir les différences:

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

  
37 37
module Munin
38 38
  class ThinPeakMemory
39
    
39

  
40 40
    def run
41 41
      instances = get_pids()
42 42
      instances.each do |instance|
......
45 45
        puts "thin_#{port}.value #{hwm}"
46 46
      end
47 47
    end
48
    
48

  
49 49
    # only get VmHWM count for each pid
50 50
    #  (Virtual Memory High Water Mark)
51 51
    # Using Proc filesystem
......
60 60
        return res
61 61
      end
62 62
    end
63
    
63

  
64 64
    # fetch all pids that match thin
65 65
    def get_pids
66 66
      pids = `pgrep -f 'thin' -l | awk -F " " '{ if (substr( $4, 10, 4)>=1) print $1"|"substr( $4, 10, 4)}' | sort -t'|' -nk 2`.split(/\r?\n/)
......
69 69
    def autoconf
70 70
      get_pids().length > 0
71 71
    end
72
    
72

  
73 73
  end
74 74
end
75 75

  
......
84 84
  puts "graph_scale yes"
85 85
  puts "graph_info Tracks the peak memory of thin processes, aka High Water Mark."
86 86
  mpm.get_pids.each do |instance|
87
    pid, port = instance.split("|")    
87
    pid, port = instance.split("|")
88 88
    puts "thin_#{port}.label thin_#{port}"
89 89
    puts "thin_#{port}.info Peak Memory"
90 90
    puts "thin_#{port}.type GAUGE"

Formats disponibles : Unified diff