According to Monit link :
No environment variables are used by Monit. However, when Monit executes a start/stop/restart program or an exec action, it will set several environment variables which can be utilised by the executable to get information about the event, which triggered the action.
Is it possible to use those variables on custom actions?
For example, for notification I don't use mail service, then rather custom script which should receive that ENV monit variable and provide output. This is a basic example to test env variables.
check process dhcp with pidfile "/var/run/dhcpd.pid" start = "/etc/init.d/isc-dhcp-server start" stop = "/etc/init.d/isc-dhcp-server stop" if does not exist program then exec "/bin/echo $MONIT_EVENT > /tmp/monittest" depends on lan
And when I intentionally make the program fail, like
check process dhcp with pidfile "/var/run/unexisting.pid"
I get no output in
/tmp/monittest. Am I doing something wrong?