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 |
Formats disponibles : Unified diff