Skip to content

Commit

Permalink
Check if process exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
angelabad committed Dec 14, 2016
1 parent 074e0ef commit 45179d1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions check_pm2
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ class CLI < Thor
pm2_json = JSON.parse(http.body_str)
processes = pm2_json['processes'].select {|p| p['name'] == name }

if processes.nil? || processes.empty?
puts "Unknown process"
exit NAGIOS_CRITICAL
end

processes.each do |process|
case process['pm2_env']['status']
when 'online'
Expand Down

0 comments on commit 45179d1

Please sign in to comment.