sensu-plugins / sensu-plugins-process-checks

This plugin provides native process instrumentation for monitoring and metrics collection, including: process status, uptime, thread count, and others.
http://sensu-plugins.io
MIT License
20 stars 55 forks source link

check-process.rb: wrong behaviour if desired process count = 0 #22

Open vlinevych opened 8 years ago

vlinevych commented 8 years ago

I am trying to detect zombie processes and found out that check doesn't work for me:

./check-process.rb -s Z -c 1
CheckProcess CRITICAL: Found 0 matching processes; state Z

The problem is in condition at line 289. Since crit_under has default value of 1, check returns CRITICAL.

Workaround is to re-define default values of crit_under, warn_under

./check-process.rb -s Z -c 0 -C -1 -W -1
CheckProcess OK: Found 0 matching processes; state Z
brettswift commented 8 years ago

Same behaviour here, except I'm not checking for zombies

Uchiwa dashboard shows: image

Yet locally on the server if I run the same thing:

[root@devcorepptl918 bin]# check-process.rb --pattern 'puppetserver' --critical-under 1
CheckProcess OK: Found 1 matching processes; cmd /puppetserver/
tgagor commented 7 years ago

Same problem - checking for zombies and D-state processes.

majormoses commented 7 years ago

@vlinevich This check has a lot of different things you can check and the defaults wont be good for all of them, I am thinking that the best thing to do is to put some documentation to help people who have run into the same thing.

majormoses commented 7 years ago

Anyone up for documenting this gotcha with the defaults? If not I would accept a pr with a conditional for 0.

gerard76 commented 4 years ago

Thanks for your report. I had the same problem and used your workaround.