David Nolan | 27 Jan 2006 21:08
Picon
Favicon

Re: Monitor works from the command-line but not from mon


--On Friday, January 27, 2006 14:54:40 -0500 Brian Landers 
<brian <at> bluecoat93.org> wrote:

> I have a tacacs+ monitoring script that successfully detects failures
> when run from the command-line but not from within mon.  I'm at a loss
> to troubleshoot this one and am hoping the list can help.  It seems to
> be printing the failure in the proper format and setting the exit code
> properly, but mon never sees the service as down.
>
> -bash-2.05b$  ./tacacs.monitor username password key server1 server2
> server1
>     server1: Attempt timed out!
>
> -bash-2.05b$ echo $?
> 1
>

The most common source of problems on this sort is a diffence in the 
environment of your shell vs Mon.  Typically when the script calls an 
external program without specifying the full path, but other possibilities 
exist.

When mon runs the test what output does it see, and what exit code?

You might try adding debugging code to output the contents of %ENV 
(assuming this is perl), and some debug statements tracing your scripts 
execution.  (i.e. "testing server XXX", "server XXX failed", "returning 
failure code (1)", etc...)

-David

David Nolan                    <*>                    vitroth+ <at> cmu.edu
curses: May you be forced to grep the termcap of an unclean yacc while
      a herd of rogue emacs fsck your troff and vgrind your pathalias!

Gmane