[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Monit remote servers custom process
From: |
Martin Pala |
Subject: |
Re: Monit remote servers custom process |
Date: |
Mon, 4 Aug 2014 14:41:59 +0200 |
Hi,
Monit <= 5.7 purges the environment variables and sets only spartan
PATH="/bin:/usr/bin:/sbin:/usr/sbin" + set of MONIT_* variables (documented in
the manual) ... this was done to run the program in a sandbox and not pass any
extra informations from parent process environment to child, but caused
problems in some cases, where the script depends on environment settings.
=> Monit upgrade to 5.8 or later should fix it ... alternatively you can load
the environment in the script or define required environment variables and/or
use absolute path.
Regards,
Martin
On 31 Jul 2014, at 10:43, Gokulnath Arjunan <address@hidden> wrote:
> Hi,
>
> I have setup monit with check_program. I am running monit on local server and
> monit check the program at regular intervel. it is stopping the tomcat server
> if thread count is more than my threshold but not starting the tomcat server
> back. Getting below log in monit.log. Please suggest what I am missing here.
>
> [UTC Jul 31 08:14:59] error : 'ThreadCount' '/data/scripts/jmx.sh' failed
> with exit status (35) -- no output from program
> [UTC Jul 31 08:14:59] info : 'ThreadCount' trying to restart
> [UTC Jul 31 08:14:59] info : 'ThreadCount' stop:
> /opt/tomcat-9620/bin/shutdown.sh
> [UTC Jul 31 08:14:59] info : 'ThreadCount' start:
> /opt/tomcat-9620/bin/startup.sh
>
> Monit configuration:
>
> check program ThreadCount with path "/data/scripts/jmx.sh"
> start program = "/opt/tomcat/bin/startup.sh"
> stop program = "/opt/tomcat/bin/shutdown.sh"
> if status > 35 then restart
>
>
> jmx.sh
>
> #!/bin/bash
> TC=`/usr/local/nagios/libexec/check_jmx -U
> service:jmx:rmi:///jndi/rmi://localhost:9652/jmxrmi -O
> java.lang:type=Threading -A ThreadCount | cut -d '=' -f2 | cut -d '|' -f1`
> if [ $TC -gt 35 ]
> then
> exit $TC
> else
> exit $TC
> fi
>
> Thanks
> Gokul
>
>
> From: address@hidden [mailto:address@hidden On Behalf Of Hearns, John
> Sent: Friday, May 23, 2014 7:25 PM
> To: This is the general mailing list for monit
> Subject: RE: Monit remote servers custom process
>
>
>
> Hi,
>
> I am planning to use monit for below purpose. Can I achieve below cases by
> using monit? I installed monit and trying to find the right configuration.
> But I am unable to get the configuration for remote server monitor.
>
> Monitor remote server custom process without pid file from monit server.
> Restart remote server custom process from monit server based on
> error/exception.
> Alert remote server custom process if it is down.
>
>
> Yes, you can do this.
>
> Use a 'check program'
>
>
> check program remote-service with path "/usr/local/bin/remote-service"
>
>
> The script in /usr/local/bin will ssh into the remote system and perform the
> checks you want,
> Perhaps by running the 'pgrep' command.
> If the script sees that the remote service is OK
> exit0
>
> If the remote service is down
> exit 1
>
>
> The contents of this e-mail are confidential and for the exclusive use of the
> intended recipient. If you are not the intended recipient you should not
> read, copy, retransmit or disclose its contents. If you have received this
> email in error please delete it from your system immediately and notify us
> either by email or telephone. The views expressed in this communication may
> not necessarily be the views held by McLaren Racing Limited.
> McLaren Racing Limited | McLaren Technology Centre | Chertsey Road | Woking |
> Surrey | GU21 4YH | UK | Company Number: 01517478
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Monit remote servers custom process,
Martin Pala <=