2016-09-06 15:40:49 -04:00
|
|
|
module SidekiqHelper
|
2016-09-08 09:30:16 -04:00
|
|
|
SIDEKIQ_PS_REGEXP = /\A
|
2016-09-08 13:41:25 -04:00
|
|
|
(?<pid>\d+)\s+
|
|
|
|
(?<cpu>[\d\.,]+)\s+
|
|
|
|
(?<mem>[\d\.,]+)\s+
|
|
|
|
(?<state>[DRSTWXZNLsl\+<]+)\s+
|
|
|
|
(?<start>.+)\s+
|
|
|
|
(?<command>sidekiq.*\])\s+
|
|
|
|
\z/x
|
2016-09-08 09:30:16 -04:00
|
|
|
|
2016-09-06 15:40:49 -04:00
|
|
|
def parse_sidekiq_ps(line)
|
|
|
|
match = line.match(SIDEKIQ_PS_REGEXP)
|
|
|
|
if match
|
|
|
|
match[1..6]
|
|
|
|
else
|
2016-09-07 15:59:29 -04:00
|
|
|
%w[? ? ? ? ? ?]
|
2016-09-06 15:40:49 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|