I want to try to monitor postfix queue with monit. I have taken a example from people of Stackoverflow. My version of monit is the latest
This is Monit version 5.10
In /etc/monit.d
I have postfixlocal
with
check program postfixcola with path "/usr/local/bin/postfixcola.sh"
#if status != 0 then alert
if status > 1 then alert
and then in /usr/local/bin/
I have postfixcola.sh
with
#!/bin/sh
QUEUE=`/usr/sbin/postqueue -p | tail -n1 | awk '{print $5}'`
exit $QUEUE
But Monit complaints every time about the output of the script. I have made a test, setting and echo before exit
and in the moment of test it returned a 1 (because the queue of postfix was 1)
But the error remains: [CET Dec 9 11:10:07] error : 'postfixcola' '/usr/local/bin/postfixcola.sh' failed with exit status (2) -- no output
I really don't know what is the problem here, any thoughts?