Révision c39b74e1
Changed label from pid to instance port
| plugins/thin/thin_threads | ||
|---|---|---|
| 41 | 41 |
class ThinThreads |
| 42 | 42 |
|
| 43 | 43 |
def run |
| 44 |
pids = get_pids() |
|
| 45 |
pids.sort.each do |pid| |
|
| 46 |
res = (get_threads(pid).to_i) |
|
| 47 |
puts "thin_#{pid}.value #{res}"
|
|
| 44 |
instances = get_pids() |
|
| 45 |
instances.each do |instance| |
|
| 46 |
pid, port = instance.split("|")
|
|
| 47 |
rss = (get_threads(pid).to_i)/1024 |
|
| 48 |
puts "thin_#{port}.value #{rss}"
|
|
| 48 | 49 |
end |
| 49 | 50 |
end |
| 50 | 51 |
|
| ... | ... | |
| 61 | 62 |
return res |
| 62 | 63 |
end |
| 63 | 64 |
end |
| 64 |
|
|
| 65 |
|
|
| 66 |
# Get pis using lsof (list open files) |
|
| 67 |
# look for listening tcp applications |
|
| 68 |
# that match the name thin |
|
| 65 |
|
|
| 66 |
# fetch all pids that match thin |
|
| 69 | 67 |
def get_pids |
| 70 |
pids = `pgrep thin`.split
|
|
| 68 |
pids = `pgrep -f 'thin' -l | awk -F " " '{ if (substr( $4, 10, 4)>=1) print $1"|"substr( $4, 10, 4)}'`.split(/\r?\n/)
|
|
| 71 | 69 |
end |
| 72 | 70 |
|
| 73 | 71 |
def autoconf |
| plugins/thin/thins_peak_memory | ||
|---|---|---|
| 38 | 38 |
class ThinPeakMemory |
| 39 | 39 |
|
| 40 | 40 |
def run |
| 41 |
pids = get_pids()
|
|
| 42 |
port_list = Hash.new
|
|
| 43 |
pids.sort.each do |pid, port|
|
|
| 41 |
instances = get_pids()
|
|
| 42 |
instances.each do |instance|
|
|
| 43 |
pid, port = instance.split("|")
|
|
| 44 | 44 |
hwm = (pid_hwm(pid).to_i)/1024 |
| 45 | 45 |
puts "thin_#{port}.value #{hwm}"
|
| 46 | 46 |
end |
| ... | ... | |
| 61 | 61 |
end |
| 62 | 62 |
end |
| 63 | 63 |
|
| 64 |
# Get pis using lsof (list open files) |
|
| 65 |
# look for listening tcp applications |
|
| 66 |
# that match the name thin |
|
| 64 |
# fetch all pids that match thin |
|
| 67 | 65 |
def get_pids |
| 68 |
pids_ports = [] |
|
| 69 |
pids = `pgrep thin`.split |
|
| 70 |
pids.each do |t| |
|
| 71 |
port = `lsof -p #{t} | grep LISTEN`.split[8]
|
|
| 72 |
port = port.split(":")[1]
|
|
| 73 |
pids_ports << [t,port] |
|
| 74 |
end |
|
| 75 |
pids_ports |
|
| 66 |
pids = `pgrep -f 'thin' -l | awk -F " " '{ if (substr( $4, 10, 4)>=1) print $1"|"substr( $4, 10, 4)}'`.split(/\r?\n/)
|
|
| 76 | 67 |
end |
| 77 | 68 |
|
| 78 | 69 |
def autoconf |
Formats disponibles : Unified diff