Forum Discussion

PeteW's avatar
Icon for Nimbostratus rankNimbostratus
Jun 13, 2012

Custom expect script to Oracle app server

Afternoon chaps,



I have an Oracle application that listens on 10 specific ports to allow remote devices to access an Oracle app cluster.


The application running on the app servers is notoriously flaky and doesnt like broken connections or crashed logins or users that have not exitted gracefully. A basic monitor polling the TCP port listener flags up errors in the Oracle app server so I have been trying to develop a custom expect script to "gracefully" telnet to the device on the listener ports, change to a different menu, login and logout gracefully.


I have been able to perform the tasks from the SSH session on the LTM to the server but need to have it crafted into a script.



This particular task doesnt have any adverse affect to the app. Here is what I have so far so any pointers would be greatly received and appreciated.



2 Pool members listen on a 10.x.x.1 & .2 address and on a range of 10 ports each.


I simply need to login on each server/port and verify I can successfully login and logout.



script I had in mind:



telnet 10.x.x.x 10306


set telnet $spawn_id


expect -nocase "1"


send a carriage return


send "\r"


expect the User Name: field as the active prompt


expect -nocase "User Name: "


send "testuser\r"


expect -nocase "Password : "


send "testpassword\r"



expect -nocase "1"


send "1\r"


expect -nocase "1"


send "3\r"


Wait for the prompt this takes us back to the login


now we send a "ctrl ]" to break out of the telnet session and exit gracefully


send '^]'


send "quit\r"






As this is a production unit I need to at least have the script in a semi-working state before I raise the change to start testing.


Is there anything I may need alongside the above? Anything you think I am missing?



I'll be installing it as an expect script monitor so will need to also get "expect" on the LTM as it doesnt appear to have it in the location I was expecting.


It's a 6800 LTM unit pair.




Any guidance appreciated.