cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
549
Views
0
Helpful
3
Replies

socket inspect from script on CSS

jirka.novak
Level 1
Level 1

Hi,

I have script (only skelet):

socket connect host ...

socket send ...

socket inspect ...

When I do this commands from console, I see that socket inspect prints some output.

But when I play this script with script play, I see nothing.

Should I do something special when I want to see inspect output from script?

3 Replies 3

jfoerster
Level 4
Level 4

Hi,

I think you have to use echo commands for output to the conline when doing a play script. Btw what kind of output are you awaiting when playing a script? Normaly you set exit messges when something with the socket fails. This is how scriped keepalives are working from my experience.

Cheers,

Joerg

Hi,

but how to "catch" output from socket inspect to variable for doing echo?

On console I do socket inspect and output is on console. So I imaging that i will use something like

socket inspect ... | grep ...

But as I wrote, I get no output on script. On console it works.

I can't use socket waitfor.

Hi,

I did it like this:

set EXIT_MSG "Waitfor Password: Failed port 23"

! The Username seems to be unknown.

socket waitfor ${SOCKET} "Password" 2000

socket inspect ${SOCKET} pretty

The result is the following:

If the phrase Password is not received an Errormessage is displayed and the script exits. This causes that the probed real will change to probe failed if the retry limit is reached. For explanation before waiting for a password prompt I opened a socket with another exitmessage and sent a username after the CSS was "prompted" to send the username. If the login is successfull I disconnect the socket and clear the exit message. In this way you can probe several ports in a row.

Btw a good reference for writing CSS Scripts is

the scripts directory on your CSS. The scripts presented there are quite good documented and maybe you get an idea of what you are missing.

Kind Regards,

Joerg

Review Cisco Networking for a $25 gift card