diff options
author | Tar Committer <tar@ocjtech.us> | 2000-08-23 20:13:31 +0000 |
---|---|---|
committer | Tar Committer <tar@ocjtech.us> | 2000-08-23 20:13:31 +0000 |
commit | a505626101e262be2cd5a8c74c44d3616c299519 (patch) | |
tree | faa740207faec239fa2af636b194c924eaf3573f /bin/jrancid | |
parent | b24aa5051db5d4bf9757efe7df06cb1892898382 (diff) | |
download | rancid-a505626101e262be2cd5a8c74c44d3616c299519.tar.gz rancid-a505626101e262be2cd5a8c74c44d3616c299519.tar.xz rancid-a505626101e262be2cd5a8c74c44d3616c299519.zip |
Imported from rancid-1.5.tar.gz.rancid-1.5
Diffstat (limited to 'bin/jrancid')
-rwxr-xr-x | bin/jrancid | 104 |
1 files changed, 90 insertions, 14 deletions
diff --git a/bin/jrancid b/bin/jrancid index c879737..efc8465 100755 --- a/bin/jrancid +++ b/bin/jrancid @@ -146,6 +146,11 @@ sub ShowChassisClocks { last if(/^$prompt/); /error: the chassis subsystem is not running/ && return; + /Couldn\'t initiate connection/ && return; + /Unrecognized command/ && return; + /command is not valid/ && return; + /^\s+\^/ && return; + /syntax error/ && return; ProcessHistory("","","","# $_"); } return; @@ -163,7 +168,11 @@ sub ShowChassisEnvironment { /error: the chassis subsystem is not running/ && return; /Couldn\'t initiate connection/ && return; - / backplane temperature/ && return; + /Unrecognized command/ && return; + /command is not valid/ && return; + /^\s+\^/ && return; + /syntax error/ && return; + / backplane temperature/ && next; /(\s*Power supply.*), temperature/ && ProcessHistory("","","","# $1\n") && next; /(\s*.+) +\d+ degrees C.*$/ && @@ -184,6 +193,11 @@ sub ShowChassisFirmware { last if(/^$prompt/); /error: the chassis subsystem is not running/ && return; + /Couldn\'t initiate connection/ && return; + /Unrecognized command/ && return; + /command is not valid/ && return; + /^\s+\^/ && return; + /syntax error/ && return; ProcessHistory("","","","# $_"); } return; @@ -200,9 +214,14 @@ sub ShowChassisFpcDetail { last if(/^$prompt/); /error: the chassis subsystem is not running/ && return; - / Temperature:/ && next; - / Start time:/ && next; - / Uptime:/ && next; + /Couldn\'t initiate connection/ && return; + /Unrecognized command/ && return; + /command is not valid/ && return; + /^\s+\^/ && return; + /syntax error/ && return; + / Temperature/ && next; + / Start time/ && next; + / Uptime/ && next; ProcessHistory("","","","# $_"); } return; @@ -219,12 +238,18 @@ sub ShowChassisHardware { last if(/^$prompt/); /error: the chassis subsystem is not running/ && return; + /Couldn\'t initiate connection/ && return; + /Unrecognized command/ && return; + /command is not valid/ && return; + /^\s+\^/ && return; + /syntax error/ && return; ProcessHistory("","","","# $_"); } return; } # This routine parses "show chassis routing-engine" +# Most output is ignored. sub ShowChassisRoutingEngine { print STDERR " In ShowChassisRoutingEngine: $_" if ($debug); @@ -234,14 +259,26 @@ sub ShowChassisRoutingEngine { tr/\015//d; last if(/^$prompt/); + /error: the chassis subsystem is not running/ && return; + /Couldn\'t initiate connection/ && return; + /Unrecognized command/ && return; + /command is not valid/ && return; + /^\s+\^/ && return; + /syntax error/ && return; /^Routing Engine status:/ && ProcessHistory("","","","# $_") && next; - / DRAM:/ && ProcessHistory("","","","# $_") && next; + / Slot / && ProcessHistory("","","","# $_") && next; + / Current state/ && ProcessHistory("","","","# $_") && next; + / Election priority/ && ProcessHistory("","","","# $_") && next; + / DRAM/ && ProcessHistory("","","","# $_") && next; + / Serial ID/ && ProcessHistory("","","","# $_") && next; /^\s*$/ && ProcessHistory("","","","# $_") && next; } return; } -# This routine parses "show chassis scb" +# This routine parses "show chassis scb", "show chassis ssb", and +# "show chassis feb". +# Only do this routine once. sub ShowChassisSCB { print STDERR " In ShowChassisSCB: $_" if ($debug); @@ -251,20 +288,50 @@ sub ShowChassisSCB { tr/\015//d; last if(/^$prompt/); + return if ($ShowChassisSCB); /error: the chassis subsystem is not running/ && return; - / Temperature:/ && next; - / utilization:/ && next; - /time:/ && next; + /Couldn\'t initiate connection/ && return; + /Unrecognized command/ && return; + /command is not valid/ && return; + /^\s+\^/ && return; + /syntax error/ && return; + / Temperature/ && next; + / utilization/ && next; + / Start time/ && next; + / Uptime/ && next; / (IP|MLPS) routes:/ && next; / used:/ && next; ProcessHistory("","","","# $_"); } + $ShowChassisSCB = 1; + return; +} + +# This routine parses "show system boot-messages" +sub ShowSystemBootMessages { + print STDERR " In ShowSystemBootMessages: $_" if ($debug); + + s/^[a-z]+@//; + ProcessHistory("","","","# $_"); + while (<INPUT>) { + tr/\015//d; + last if(/^$prompt/); + + /Unrecognized command/ && return; + /^\s+\^/ && return; + /syntax error/ && return; + /^JUNOS / && <INPUT> && next; + /^real memory / && next; + /^avail memory / && next; + /^\/dev\// && next; + ProcessHistory("","","","# $_"); + } return; } # This routine parses "show version" sub ShowVersion { - print STDERR " In ShowVersionAndBlame: $_" if ($debug); + print STDERR " In ShowVersion: $_" if ($debug); s/^[a-z]+@//; ProcessHistory("","","","# $_"); @@ -272,7 +339,7 @@ sub ShowVersion { tr/\015//d; last if(/^$prompt/); - /^Juniper Networks is:/ && ProcessHistory("","","","\n$_") && return; + /^Juniper Networks is:/ && ProcessHistory("","","","# \n# $_") && next; ProcessHistory("","","","# $_"); } return; @@ -290,8 +357,10 @@ sub ShowConfiguration { next if (/^\s*$/); /^database header mismatch: / && return(-1); + /^version .*;\d+$/ && return(-1); s/(\s*authentication-key ).*$/#$1<removed>;/; s/^(.*\ssecret \")\$9\$.*(\".*)$/#$1<removed>$2/; + s/ # SECRET-DATA$//; ProcessHistory("","","","$_"); } return; @@ -313,6 +382,9 @@ sub DoNothing {print STDOUT;} "show chassis hardware" => "ShowChassisHardware", "show chassis routing-engine" => "ShowChassisRoutingEngine", "show chassis scb" => "ShowChassisSCB", + "show chassis ssb" => "ShowChassisSCB", + "show chassis feb" => "ShowChassisSCB", + "show system boot-messages" => "ShowSystemBootMessages", "show version" => "ShowVersion", "show configuration" => "ShowConfiguration" ); @@ -324,6 +396,9 @@ sub DoNothing {print STDOUT;} "show chassis hardware", "show chassis routing-engine", "show chassis scb", + "show chassis ssb", + "show chassis feb", + "show system boot-messages", "show version", "show configuration" ); @@ -352,7 +427,8 @@ if ($file) { } } -while(<INPUT>) { + +TOP: while(<INPUT>) { tr/\015//d; if (/^Error:/) { s/^.*Error:/Error:/; @@ -374,13 +450,13 @@ while(<INPUT>) { if (! defined($commands{$cmd})) { print STDERR "found unexpected command - \"$cmd\"\n"; $clean_run = 0; - last; + last TOP; } $rval = &{$commands{$cmd}}; delete($commands{$cmd}); if ($rval == -1) { $clean_run = 0; - last; + last TOP; } } if (/>\s*quit/) { |