Skip to content

Commit

Permalink
Imported from rancid-2.3.2a3.tar.gz.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tar Committer committed Aug 15, 2005
1 parent 96dc402 commit c048293
Show file tree
Hide file tree
Showing 26 changed files with 468 additions and 111 deletions.
8 changes: 8 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
2.3.2
add subversion support - mostly from Justin Grote

clogin: support rsh method - partly from James Stahr

collect show inventory raw on rancid and cat5rancid

add -ko to cvs diff commands - Michael Shields

Add a MAILHEADERS configuration variable for user-defined mail headers

rancid: match HSRP group numbers greater than 1 char wide - Ed Ravin
Expand Down
46 changes: 45 additions & 1 deletion FAQ
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Frequently Asked Questions about rancid - last updated 20040107.
Frequently Asked Questions about rancid - last updated 20050813.

This FAQ contains information that may not apply directly to versions of
rancid prior to 2.3. It also contains paths containing tags such as
Expand Down Expand Up @@ -235,6 +235,50 @@ A. Certainly, but rancid does not provide such a mechanism natively. Two
Obviously, the first option is the cleanest and most featureful, which is
why the script mention in the second option is not provided.

Q. For approximately X hosts (configs) what size server should we be
considering - speed and data storage?
A. On modern machines it is unlikely you will have issues with disk space or
memory - A heavily laden access router with a complex config won't consume
more than a few megabytes of disk space for its configs over several
years time (roughly 3 times the sum of all the config or */configs/* over
2 years is a decent approximation).

Rancid is typically CPU bound if you have adequate network bandwidth.
Experience shows rancid takes around 50 Mhz * minutes / device of processing
power. This means that a 1Ghz machine can poll:

1000 Mhz * 60 (min/hour) / 50(Mhz min / device) = 1200 devices/hour

That's obviously a ball park estimate which varies with many different
factors such as the CPU type and the types of devices on your network.


Q. How can I run rancid to make the most efficient use of resources (i.e.
run in the shortest amount of time)?

A. You can adjust PAR_COUNT in rancid.conf to achieve maximum efficiency
during polling. You can watch the output of the standard unix command
vmstat command during polling to determine whether or not the cpu is being
wholly utilized - there should be little idle time and no process blocking.

Another simpler method is to look at the time stamps on the rancid log
files, and adjust PAR_COUNT until the least amount of time is taken
during polling. Make sure all devices are being polled by rancid before
using this method - failing devices can extend the amount of time rancid
takes to finish by a *LONG* period and throw your times way off.

It may help to run rancid niced (man nice) if it will be sharing
resources with other processes, as it may eat whatever is available if
PAR_COUNT is set high. This is done by changing the crontab to be
something like:

5 * * * * nice -19 /usr/local/rancid/bin/rancid-run

If you _do_ share resources with other processes but want rancid to
run efficiently, probably the vmstat method above will work better -
rancid may take a little longer to run but you won't be stepping on
other people's toes.

Q. I'm still stuck on this problem. Where can I get more help?
A. A discussion list is available, rancid-discuss@shrubbery.net. You must
be a subscriber to post. Subscribe like this:
Expand Down
2 changes: 2 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,15 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
PERLV = @PERLV@
PERLV_PATH = @PERLV_PATH@
PING_PATH = @PING_PATH@
RCSSYS = @RCSSYS@
RSH = @RSH@
SENDMAIL = @SENDMAIL@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SORT = @SORT@
SSH = @SSH@
STRIP = @STRIP@
SVN = @SVN@
TAR = @TAR@
TELNET = @TELNET@
TOUCH = @TOUCH@
Expand Down
19 changes: 11 additions & 8 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ perl5 perl version 5 or greater available from www.cpan.org
expect http://expect.nist.gov/ We highly suggest that you stick to
expect 5.24.1 (or so). This seems to work best. Note that
you need to have the accompanying tcl &/ tk.
svn Code revision system, an alternative to cvs. Available from
http://subversion.tigris.org/tarballs/. Use the configure
option --enable-svn to configure for Subversion.
tcl Required by expect.

Bill Fenner (now maintained by others) has a cgi script for interacting
Expand All @@ -99,10 +102,10 @@ Quick Installation Guide (an example):
./configure --prefix=/home/rancid

Rancid uses autoconf's "localstatedir" as the location of it's logs,
CVS respository, and directories where it's groups are placed. The user
who will run rancid (from cron, etc) will need write access to these
directories. By default, this is <prefix>/var, or /home/rancid/var
following the example above.
CVS or Subversion respository, and directories where it's groups are
placed. The user who will run rancid (from cron, etc) will need write
access to these directories. By default, this is <prefix>/var, or
/home/rancid/var following the example above.

We realize that this is not optimal, but it follows the standards. We
suggest that this be altered to include the package name, like so:
Expand Down Expand Up @@ -160,10 +163,10 @@ Quick Installation Guide (an example):

7) Run rancid-cvs.
This creates all of the necessary directories and config files for
each of the groups in LIST_OF_GROUPS and imports them into CVS. This
will also be run each time a new group is added. Do not create the
directories or CVS repository manually, allow rancid-cvs do it. Also see
'man -M <basedir>/man rancid-cvs'.
each of the groups in LIST_OF_GROUPS and imports them into CVS (or
Subversion). This will also be run each time a new group is added. Do
not create the directories or CVS repository manually, allow rancid-cvs
do it. Also see 'man -M <basedir>/man rancid-cvs'.

8) For each "group", modify the router.db file in the group directory.
The file is of the form "router:mfg:state" where "router" is
Expand Down
1 change: 0 additions & 1 deletion Todo
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
this is clouded by the UI mess.
- rancid needs to treat the 3600s like the 7Ks and 12Ks...
Also, need to allow 12012s, and force 700s to not be treated like 7Ks.
- clogin rsh is munged
- LG should sort routers
- LG {requested} command additions
- show controllers T3 (data)
Expand Down
2 changes: 2 additions & 0 deletions bin/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,15 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
PERLV = @PERLV@
PERLV_PATH = @PERLV_PATH@
PING_PATH = @PING_PATH@
RCSSYS = @RCSSYS@
RSH = @RSH@
SENDMAIL = @SENDMAIL@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SORT = @SORT@
SSH = @SSH@
STRIP = @STRIP@
SVN = @SVN@
TAR = @TAR@
TELNET = @TELNET@
TOUCH = @TOUCH@
Expand Down
35 changes: 34 additions & 1 deletion bin/cat5rancid.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
## $Id: cat5rancid.in,v 1.43 2005/06/20 21:24:30 heas Exp $
## $Id: cat5rancid.in,v 1.44 2005/08/14 01:04:07 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
Expand Down Expand Up @@ -666,6 +666,38 @@ sub ShowDiag {
return(0);
}

# This routine parses "show inventory".
sub ShowInventory {
print STDERR " In ShowInventory: $_" if ($debug);

while (<INPUT>) {
tr/\015//d;
return if (/^\s*\^$/);
last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
return(-1) if (/command authorization failed/i);
# the pager can not be disabled per-session on the PIX
s/^<-+ More -+>\s*//;

chomp;

# split PID/VID line
if (/^(NAME: ".*,) (DESCR: .*)/) {
ProcessHistory("INVENTORY","","", sprintf("!%-30s%s\n", $1, $2));
next;
}
if (/^(PID: \w?) *, (VID: .*), (SN: .*)$/) {
ProcessHistory("INVENTORY","","", "!$1\n!$2\n!$3\n");
next;
}

ProcessHistory("INVENTORY","","","!$_");
}
ProcessHistory("INVENTORY","","","");

return(0);
}

# This routine parses "show module"
sub ShowModule {
my($slot);
Expand Down Expand Up @@ -1005,6 +1037,7 @@ sub DoNothing {print STDOUT;}
{'dir sup-bootflash:' => 'DirSlotN'},
{'dir sup-microcode:' => 'DirSlotN'},
{'show module' => 'ShowModule'},
{'show inventory raw' => 'ShowInventory'},
{'show port ifindex' => 'ShowPortIfindex'},
{'write term all' => 'WriteTerm'},
{'write term' => 'WriteTerm'},
Expand Down
74 changes: 69 additions & 5 deletions bin/clogin.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! @EXPECT_PATH@ --
##
## $Id: clogin.in,v 1.85 2005/06/14 20:20:43 heas Exp $
## $Id: clogin.in,v 1.89 2005/08/14 20:18:19 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
Expand Down Expand Up @@ -286,7 +286,7 @@ proc source_password_file { password_file } {
}

# Log into the router.
# returns: 0 on success, 1 on failure
# returns: 0 on success, 1 on failure, -1 if rsh was used successfully
proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
global spawn_id in_proc do_command do_script platform
global prompt u_prompt p_prompt e_prompt sshcmd
Expand Down Expand Up @@ -321,16 +321,79 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
return 1
}
} elseif ![string compare $prog "rsh"] {
global command

if { ! $do_command } {
if { [llength $cmethod] == 1 } {
send_user "\nError: rsh is an invalid method for -x and "
send_user "interactive logins\n"
}
if { $progs == 0 } {
return 1
}
continue;
}
if [ catch {spawn rsh -l $user $router} reason ] {
send_user "\nError: rsh failed: $reason\n"
return 1

set commands [split $command \;]
set num_commands [llength $commands]
set rshfail 0
for {set i 0} {$i < $num_commands && !$rshfail} { incr i} {
log_user 0
set retval [ catch {spawn rsh $user@$router [lindex $commands $i] } reason ]
if { $retval } {
send_user "\nError: rsh failed: $reason\n"
log_user 1; return 1
}
send_user "$router# [lindex $commands $i]\n"

# rcmd does not get a pager and no prompts, so we just have to
# look for failures & lines.
expect {
"Connection refused" { catch {close}; wait;
send_user "\nError: Connection\
Refused ($prog): $router\n"
set rshfail 1
}
-re "(Connection closed by|Connection to \[^\n\r]+ closed)" {
catch {close}; wait;
send_user "\nError: Connection\
closed ($prog): $router\n"
set rshfail 1
}
"Host is unreachable" { catch {close}; wait;
send_user "\nError: Host Unreachable:\
$router\n"
set rshfail 1
}
"No address associated with" {
catch {close}; wait;
send_user "\nError: Unknown host\
$router\n"
set rshfail 1
}
-re "\b+" { exp_continue }
-re "\[\n\r]+" { send_user -- "$expect_out(buffer)"
exp_continue
}
timeout { catch {close}; wait
send_user "\nError: TIMEOUT reached\n"
set rshfail 1
}
eof { catch {close}; wait }
}
log_user 1
}
if { $rshfail } {
if { !$progs } {
return 1
} else {
continue
}
}
# fake the end of the session for rancid.
send_user "$router# exit\n"
# return rsh "success"
return -1
} else {
send_user "\nError: unknown connection method: $prog\n"
return 1
Expand Down Expand Up @@ -731,6 +794,7 @@ foreach router [lrange $argv $i end] {

# Login to the router
if {[login $router $ruser $userpswd $passwd $enapasswd $cmethod $cyphertype]} {
# if login failed or rsh was successful, move on to the next device
continue
}
if { $enable } {
Expand Down
Loading

0 comments on commit c048293

Please sign in to comment.