sensu/sensu-community-plugins — pull request #460 by maoe (2014-02-04 04:24:21+00:00)
Title: check-procs.rb: Reasonable matching conditions

The current `check-procs.rb` behavior is quite confusing. Suppose we have 9 ssh processes running and any processes don't mach to 'foo', then we get the following results:

```
% ./plugins/processes/check-procs.rb -p ssh # Why not OK?
CheckProcs CRITICAL: Found 9 matching processes; cmd /ssh/
% ./plugins/processes/check-procs.rb -p ssh -w 5 -c 10
CheckProcs WARNING: Found 9 matching processes; cmd /ssh/
% ./plugins/processes/check-procs.rb -p foo # Why not CRITICAL?
CheckProcs OK: Found 0 matching processes; cmd /foo/
% ./plugins/processes/check-procs.rb -p foo -C 0 # Why not WARNING?
CheckProcs OK: Found 0 matching processes; cmd /foo/
% ./plugins/processes/check-procs.rb -p foo -W 0 -C 0
CheckProcs OK: Found 0 matching processes; cmd /foo/
```

I think `check-procs.rb` should check if any matching processes exist when no thresholds are specified. With this patch, we'll get this:

```
% ./plugins/processes/check-procs.rb -p ssh
CheckProcs OK: Found 9 matching processes; cmd /ssh/
% ./plugins/processes/check-procs.rb -p ssh -w 5 -c 10
CheckProcs WARNING: Found 9 matching processes; cmd /ssh/
% ./plugins/processes/check-procs.rb -p foo
CheckProcs CRITICAL: Found 0 matching processes; cmd /foo/
% ./plugins/processes/check-procs.rb -p foo -C 0
CheckProcs WARNING: Found 0 matching processes; cmd /foo/
% ./plugins/processes/check-procs.rb -p foo -W 0 -C 0
CheckProcs OK: Found 0 matching processes; cmd /foo/
```