monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [monit] Executing external script with monit


From: ChetanK
Subject: Re: [monit] Executing external script with monit
Date: Mon, 8 Mar 2010 16:00:09 -0800 (PST)

HI,

I am facing the same problem as first reported. After trying everything, I
finally specified the actual command in the "exec" block. Here is what I
have in the monitrc file (send a SNMP trap when memory usage exceeds 21%):

  check system myUbuntusystem
#    if loadavg (1min) > 4 then alert
#    if loadavg (5min) > 2 then alert
    if memory usage > 21% then exec "/usr/bin/snmptrap -v 1 -c public
localhost TRAP-TEST-MIB::demotraps 10.9.225.57 2 0 rr IF-MIB::ifIndex i 1"

Here I am specifying the "path" to the snmptrap program. The same command
when issued verbatim in a terminal window or a bash script (when invoked
manually) works just fine.

Any help will be really useful. If I do need to setup env variables, which
ones should I be setting? Also, if I specify this command in a script, do I
need to do anything special in the script?

Regards,
Chetan


Jan-Henrik Haukeland wrote:
> 
> Monit purges the environment and only sets a spartan PATH when it  
> execute a script/program. The program therefor, most likely are  
> missing some environment variables when executed from monit, which you  
> have available when run manually. See also this thread from two days  
> back,
> 
> http://lists.gnu.org/archive/html/monit-general/2008-01/msg00035.html
> 
> On 23. jan.. 2008, at 12.33, Arturo Díaz Almagro wrote:
> 
>> Hello all,
>>
>> I am using 'monit' to test a mysql port to detect possible failures  
>> and exec an script when the failure happens. The script runs  
>> properly except the invocation of the command snmptrap (it also  
>> occurred with nsupdate command), so the trap to inform is not sent.
>>
>> If I run the script manually it sends the trap properly. I gave the  
>> script SUID permissions just in case it is the problem, but nothing  
>> to do... does anybody know why this happens?
>>
>> Thanks.
>>
>> -- 
>> Arturo Díaz
>>
>> Contact me on
>> FWD: 870436
>> Skype: arturo.diaz.almagro --
>> To unsubscribe:
>> http://lists.nongnu.org/mailman/listinfo/monit-general
> 
> 
> 
> --
> To unsubscribe:
> http://lists.nongnu.org/mailman/listinfo/monit-general
> 
> 

-- 
View this message in context: 
http://old.nabble.com/-monit--Executing-external-script-with-monit-tp15039866p27829257.html
Sent from the monit-general mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]