Expect script to show cisco configs


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Expect script to show cisco configs
# 1  
Old 05-20-2013
Expect script to show cisco configs

I know there are better ways to do this.

I prefer snmp. I do not have the proper perl modules loaded on the platorm. Snmp isnt loaded on the platform. Telnet is not an option. I need to write an expect script to pull cisco equipment configs.

The following code is executed once I gain access.
the running config is large.


I need to capture the show run output to a file.

Code:
expect $prompt 
send "term len 0\r"
expect $prompt 
set timeout 60 
send "show running\r"
sleep 20
expect $prompt 
send "term len 25\r"
expect -re "end*\#"
send "exit\r"

any help would be greatly appreciated.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cisco, 2 ssh logins for expect /bash

HI all i need to connect to about 900 cisco routers and switch to do some configs changes. the issue i am having is that half the devices have one set of username and password and the other half have another username and password. From expect or bash script i can ssh into a device and make... (0 Replies)
Discussion started by: quintin
0 Replies

2. Shell Programming and Scripting

Can someone please show me a very simple "expect" script to change password in Solaris please?

Ladies & Gents, Can one of you gurus please show me a very simple "expect" script to change the password in Solaris in a script, please? Nothing fancy, no error checking, no nothing. Just to change the password of a new user, it's all. Many thanks in advance. U guys have honestly earned my... (1 Reply)
Discussion started by: Hiroshi
1 Replies

3. Shell Programming and Scripting

Bash script failed with expect on cisco routers

Hi all, I use a bash script which use expect to connect throught ssh and run command on a cisco router. The ssh connection with expect work fine, but the first command on the cisco router failed, I try to run the command in error by hand and it work fine... :( the first part of the script... (2 Replies)
Discussion started by: bedomon
2 Replies

4. IP Networking

How to show Cisco Router Running Configuration in Third Party Application

Hey everyone, I have a few question. 1. Is it possible to display cisco 'show run' output command to the application ?? 2. And is there any ways to log in to the router instead of using telnet from telnet application??? Thanks in advance (0 Replies)
Discussion started by: franzramadhan
0 Replies

5. Shell Programming and Scripting

Expect/telnet/testing tacacs on a cisco

At times I find the need to test that the tacacs port 49 is open. The code below works but is painfully slow because I have to wait on the timeouts. Examples of possible responds router1#telnet 10.11.20.14 49 Trying 206.112.204.140, 49 ... Open route1#telnet 10.11.19.14 49 Trying... (1 Reply)
Discussion started by: popeye
1 Replies

6. Infrastructure Monitoring

Script to sort Cisco configs

Hi everyone :), I need sort Cisco configs to report but i cannot do the script to made this: #### INPUT ##### config-register 0x2102 version 12.2 ! hostname Router ! interface Ethernet0 description Red LAN ip address 192.168.1.1 255.255.255.0 no cdp enable ! interface Serial0... (6 Replies)
Discussion started by: azrael75
6 Replies

7. Shell Programming and Scripting

Need help with Expect script for Cisco IPS Sensors, Expect sleep and quoting

This Expect script provides expect with a list of IP addresses to Cisco IPS sensors and commands to configure Cisco IPS sensors. The user, password, IP addresses, prompt regex, etc. have been anonymized. In general this script will log into the sensors and send commands successfully but there are... (1 Reply)
Discussion started by: genewolfe
1 Replies
Login or Register to Ask a Question
MODSTAT(8)						    BSD System Manager's Manual 						MODSTAT(8)

NAME
modstat -- display status of loaded kernel modules SYNOPSIS
modstat [-n] [name] DESCRIPTION
The modstat utility displays the status of any kernel modules present in the kernel. The options are as follows: -n name Display the status of only the module with this name. Please note that -n is optional. In addition to listing the currently loaded modules' name, the information reported by modstat includes: CLASS Module class, such as "vfs", "driver", "exec", "misc" or "secmodel". SOURCE Where the module was loaded from. "builtin" indicates that the module was built into the running kernel. "boot" indicates that the module was loaded during system bootstrap. "filesys" indicates that the module was loaded from the file system. SIZE Size of the module in bytes. REFS Number of references held on the module. Disabled builtin modules will show a count of -1 here. REQUIRES Additional modules that must be present. EXIT STATUS
The modstat utility exits with a status of 0 on success and with a nonzero status if an error occurs. SEE ALSO
module(7), modload(8), modunload(8) HISTORY
The modstat command was designed to be similar in functionality to the corresponding command in SunOS 4.1.3. BSD
August 2, 2011 BSD