• 0
Sign in to follow this  
Jean-Michel Toussaint

FTP check with Groovy script

Question

I am trying to use groovy to verify the connectivity of an FTP server following the FAQ (http://help.logicmonitor.com/using/da...)

Here is the exact script used:

import com.santaba.agent.groovyapi.expect.Expect

cli = Expect.open(\'\'x.x.x.x\'\', 21, 5)

cli.expect(\'\'220 \'\')

cli.send( \'\'user anonymous

\'\' )

cli.expect(\'\'331 \'\')

cli.send(\'\'pass meme

\'\')

cli.expect( \'\'230 \'\')

cli.send( \'\'quit

\'\' )

Unfortunately, the groovy debugger wither comes back with a timeout, or the following:

>> !groovy

End of stream reached, no match found

My FTP server, in turn, see the connection coming from the agent, but never receives the \'\'USER anonymous\'\' command.

Any Help welcome

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

In the coming release, in a week or two, there will be direct access to all properties of a host.n

nRight now you can use HOSTNAME and WILDVALUE (quoted) in scripts.n

nYou can also pass in any property as a parameter to your groovy script, and then access positionally:n

ne.g.n

nhost = this.args[0]n

nso youd use HOSTNAME as the parameters to your script in the datasource screen.n

nThere is currently a risk that WILDVALUE, when substituted, could break the script syntax (if the WILDVALUE object contains a quote, say). That risk will go away in the coming release.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this