Cisco Cisco MGX Service Resource Module Enhanced [SRM-E] 백서

다운로드
페이지 32
 
 
Technical Overview 
© 2011 Cisco Systems, Inc. All rights reserved. This document is Cisco Public Information. 
Page 25 of 3 
</exec_command> 
</response_xml> 
 
 
TCL Script Examples: 
 
The following is an example TCL script that will connect to the ACE Admin 
context via the management interface, get a list of all contexts, and get running-
configuration for each context and write that output to a file called <context>.cfg.  
This script uses HTTP.  If you need secure transfer, you can use HTTPS instead.  
You will need to create a user with a role of Network-monitor to use for logging 
in via the XML interface.   
 
Keep in mind that the management policy must allow either HTTP or HTTPS 
protocols: 
 
class-map type management match-any remote-access 
  match protocol http any 
  match protocol https any 
 
The Resource and SSL XML scripts do not actually do anything if an error 
condition occurs other than printing a message.  You might want to add some 
code to fire off an email.   
 
I.  XML Script Example (show conn count) 
#!/usr/bin/tclsh 
 
# Global login credentials 
set user "username" 
set pass "password" 
  
# Global mgmt IP address of Admin context 
set mgmt_ip "xx.xx.xx.xx" 
 
# this procedure will execute a curl command to send the XML 
# command to ACE.  If the command fails to execute properly, 
# the script will exit with and error. 
# If the command executes with no problem, then the output 
# of the XML command is returned 
proc issue_command { cmd } { 
 
    global user pass mgmt_ip