11-03-2008 06:50 AM
Expect references
I am starting to get into expect scripting for NCM but I keep running into roadblocks. The NCM documentation does not go into very good details on using expect scripts. It has good references to Java, Perl and SOAP but none to expect nor does it have a good reference to the NCM command line. I am not a Unix guru so I don't know much about expect. Does anyone know of a good reference for these?
11-09-2008 09:40 AM
I think Script Adapter (notifier) in NCM helps you. The Script Adapter (Notifier) allows you to automatically take an action when a notification is received. Upon receiving a notification, the Script Notifier invokes a custom script supplied by you that performs user-defined actions. For example, you can create a Script Notifier to send a page, using a paging service. Another Script Notifier might invoke an audible alarm when mission critical notifications are received.
Following URL helps you to configure script adapter:
11-11-2008 06:39 AM
I was looking more for a syntax of the except scripting language that NCM uses.
11-11-2008 07:06 AM
NCM uses the standard Tcl-based expect scripting language. A sample expect script can be found in the NCM user's guide in appendix C. I've included it here:
#
# Sample Script to set the banner only if
# it is not already set correctly
#
spawn telnet $tc_device_ip$
set banner "****Unauthorized Access Prohibited****"
expect {
$banner {
puts "\nBanner is already set correctly\n"
exit 0
} "word:"
}
send "$tc_device_password$\r"
expect ">"
send "en\r"
expect "word:"
send "$tc_device_enable_password$\r"
expect "\#"
send "config t\r"
expect "\#"
send "banner motd /$banner/\r"
expect "\#"
send "exit"
More on the expect language can be found at http://expect.nist.gov/ . Help on the Tcl scripting language can be found at http://www.tcl.tk/man/tcl8.4/ . The NCM user's guide can be found at http://tools.cisco.com/search/display?url=http%3A%2F%2Fwww.cisco.com%2Fen%2FUS%2Fdocs%2Fnet_mgmt%2Fciscoworks_network_compliance_manager%2F1_3_SP1%2Fuser_guide%2FUser_Guide.pdf&pos=1&strqueryid=3&websessionid=4ozdHO6hBKp-BWwCZYVlXIo .
11-11-2008 07:09 AM
Here's a brief expect tutorial link you may find useful:
11-11-2008 05:10 PM
I find the following sites extremely helpful in showing practical examples of Expect:
11-12-2008 07:11 AM
Thanks! I appriciate the help.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide