Monit leaves zombie (defunct) processes when using "check program"
Example config to reproduce the issue:
Monit rule:
check program cpu_temp with path "/usr/local/etc/monit/scripts/cpu_temp.sh"
if status > 70 then alert
if status < 15 then alert
Script cpu_temp.sh
:
#!/bin/sh
RET=`sensors -Au 2> /dev/null | sed -n 's/_input//p' | sed 's/.\+:\s\+\([0-9]\+\).\+/\1/' | sort -n | tail -1`
exit $RET
This results in zombie (defunct) process every monitoring cycle:
$ ps aux | grep Z
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 4515 0.0 0.0 0 0 ? Zs 20:38 0:00 [cpu_temp.sh] <defunct>
The problem seem to persist with any script.
Monit installed on Ubuntu Server 18.04.2 LTS from repositories.
Monit package version: 5.25.1-1build1
I am willing to debug this issue if anyone can provide directions.
Comments (5)
-
-
Account Deleted Thank you for clarification, @Lutz Mader . I was alerted by the default Ubuntu MOTD showing warning about presence of zombie processes.
Good to hear there are plans to address this issue.
-
Hello Oleg
Good to hear there are plans to address this issue.
The unwanted zombies are available as long as I use monit and this is a easy and safe way so start additional programs or scripts and get the reponse back to monit.
With regards,
Lutz -
Account Deleted I understand that. My point was that even if Monit handles zombie processes safely, in general, presence of zombie processes may indicate a problem and/or resource leak, which is why some monitoring system warns user about zombie processes. So it would be nice to have no zombie processes in the system at all.
-
Hello Oleg,
you are right, zombie processes are bad in general, but not all the time. Thanks for your explanation.With regards,
Lutz - Log in to comment
Hello,
this is not a bug, but confuse me sometimes too,
see https://mmonit.com/monit/documentation/monit.html
With regards,
Lutz