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

  
40 40
module Munin
41 41
  class ThinThreads
42
    
42

  
43 43
    def run
44 44
      instances = get_pids()
45 45
      instances.each do |instance|
......
48 48
        puts "thin_#{port}.value #{rss}"
49 49
      end
50 50
    end
51
    
51

  
52 52
    # only get threads count for each pid
53 53
    # Using Proc filesystem
54 54
    # ONLY LINUX! because relies on proc filesystem
......
62 62
        return res
63 63
      end
64 64
    end
65
        
65

  
66 66
    # fetch all pids that match thin
67 67
    def get_pids
68 68
      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/)
......
71 71
    def autoconf
72 72
      get_pids().length > 0
73 73
    end
74
    
74

  
75 75
  end
76 76
end
77 77

  
......
86 86
  puts "graph_scale yes"
87 87
  puts "graph_info Tracks how many threads per thin processes"
88 88
  mpm.get_pids.each do |instance|
89
    pid, port = instance.split("|")    
89
    pid, port = instance.split("|")
90 90
    puts "thin_#{port}.label thin_#{port}"
91 91
    puts "thin_#{port}.info Threads per Thin process"
92 92
    puts "thin_#{port}.type GAUGE"

Formats disponibles : Unified diff