Hi,

monit executes the "exec" argument directly - it doesn't execute it via shell, 
so the shell-like syntax (pipe, etc.) doesn't work.

If you want to use shell, just wrap the exec command like this:
--8<--
if changed pid then exec "/bin/bash -c '/bin/echo logger | /usr/bin/wall'"
--8<--

Regards,
Martin


On Mar 22, 2012, at 8:05 PM, Tom H wrote:

> On 03/22/2012 06:52 PM, Tom H wrote:
>> 
>> Hi, 
>> 
>> I am using monit on CentOs 6.2 instances, but I cannot get it to broadcast a 
>> message when a service is restarted. 
>> 
>> Any suggestions on what am I doing wrong here... 
>> 
> 
> The line for the pid check is a bit odd from the httpd page;
> 
> Pid       "If changed 1 times within 1 cycle(s) then alertexec '/bin/echo 
> logger | /usr/bin/wall' timeout 0 cycle(s)"
> 
> 
> and the log file shows that monit sees the pid change...
> 
> [PDT Mar 22 11:59:58] info     : Reinitializing monit - Control file 
> '/etc/monit.conf'
> [PDT Mar 22 11:59:58] info     : Shutting down monit HTTP server
> [PDT Mar 22 11:59:58] info     : monit HTTP server stopped
> [PDT Mar 22 11:59:58] info     : Starting monit HTTP server at 
> [localhost:2812]
> [PDT Mar 22 11:59:58] info     : monit HTTP server started
> [PDT Mar 22 11:59:58] info     : 'server-64634.novalocal' Monit reloaded
> [PDT Mar 22 12:00:38] error    : 'munin-node' process PID changed to 548
> [PDT Mar 22 12:00:38] info     : 'munin-node' exec: /bin/echo
> [PDT Mar 22 12:00:58] info     : 'munin-node' process PID has not changed 
> since last cycle
> [root@server-64634 ~]# 
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to