Xymon Mailing List Archive search

Ext script help needed.

4 messages in this thread

list Thomas Pedersen · Fri, 21 Oct 2005 09:02:52 +0200 ·
Hi All,

Please help me with this little problem I have, as it is bothring be a lot.

I have writte an ext script which logs into a FTP server does a dir command and then excits. All FTP commands are specified in a input file and the output is saved in a temp file used for the status message to Hobbit.

Henrik kindly advised me to use a bbhostgrep to search the FTP server details from the bb-hosts file and this works as expected. In order to speed up the testing I have created a "subscript" which I call with som paramaters from the "master script" and this way have some parrallel run of the test. Its like this:

$BBHOME/ext/ftp-test.sh $HOST $USER $PASSWD &

This also works fine.

The problem starts when a FTP connection fails or is slow. Then my subscript is not terminated and the master script hangs. This in turn leads to purple alarms for all hosts. I have tried to implement in my master script a check using ps for a previously running subscribt for the individual hosts, but this is not work as expected.

So my question is how can I have my "sub script" really fork from the master script ? I do not need it to return to the master script because the subscript sends the status to Hobbit.

Any help is greatly appreciated.

Regards, Thomas
list Dirk Kastens · Fri, 21 Oct 2005 09:42:14 +0200 ·
Hi Thomas,
quoted from Thomas Pedersen
So my question is how can I have my "sub script" really fork from the
master script ? I do not need it to return to the master script because 
the subscript sends the status to Hobbit.
Try something like expect: http://expect.nist.gov/

Regards,
Dirk
list Figaro Nicolas · Fri, 21 Oct 2005 09:52:19 +0200 ·
-----Message d'origine-----
De : Thomas [mailto:user-97316fb2dd2a@xymon.invalid] Envoyé : vendredi 21 octobre 2005 09:03
À : hobbit
Objet : [hobbit] Ext script help needed.


Hi All,
Hi, 
quoted from Thomas Pedersen
Please help me with this little problem I have, as it is bothring be a lot.

I have writte an ext script which logs into a FTP server does a dir command and then excits. All FTP commands are specified in a input file and the output is saved in a temp file used for the status message to Hobbit.

Henrik kindly advised me to use a bbhostgrep to search the FTP server details from the bb-hosts file and this works as expected. In order to speed up the testing I have created a "subscript" which I call with som paramaters from the "master script" and this way have some parrallel run of the test. Its like this:

$BBHOME/ext/ftp-test.sh $HOST $USER $PASSWD &

This also works fine.

The problem starts when a FTP connection fails or is slow. Then my subscript is not terminated and the master script hangs. This in turn leads to purple alarms for all hosts. I have tried to implement in my master script a check using ps for a previously running subscribt for the individual hosts, but this is not work as expected.

So my question is how can I have my "sub script" really fork from the master script ? I do not need it to return to the master script because the subscript sends the status to Hobbit.
Just a suggestion : You can write your sub script with perl and use Net::FTP module. This module includes a timeout option for ftp. If the connection is to slow or fails, the perl script can generate a specific message, and you'll send a red message to hobbit.
I don't know if there is a timeout option to the standard ftp command. 
Nicolas Figaro 
Any help is greatly appreciated.

Regards, Thomas

list Henrik Størner · Fri, 21 Oct 2005 11:07:47 +0200 ·
quoted from Figaro Nicolas
On Fri, Oct 21, 2005 at 09:02:52AM +0200, Thomas wrote:
The problem starts when a FTP connection fails or is slow. Then my subscript is not terminated and the master script hangs. This in turn leads to purple alarms for all hosts.
Use "ncftpls" from the ncftp toolkit. "ncftpls -t 10 ftp://ftp.foo.com/"
will timeout after 10 seconds.


Henrik