[rancid] Can't connect to Enterasys via SSH

Alan McKinnon alan.mckinnon at gmail.com
Fri Oct 18 12:35:10 UTC 2013


Victor,

"b5b1.XXXX: missed cmd(s): show config"

is a very general error. It's probably the most common error reported
here, and it actually tells you nothing much. What it means is that
"something went wrong", and you do not know what.

There are many possibilities. To understand what is going on, you have
to understand how a script like rivrancid must work: It gets a lot of
text from the device and reads it line by line, and everything is driven
by regular expressions.

The first thing it must do is determine what your device's prompt looks
like. This is the only way the script can know when one command output
ends and the next one starts (so it can feed the text to the correct sub
defined in @commandtable). The prompt is defined by the device vendor,
and a regex must be written that matches it. If your prompt is very
different from what Cisco uses, then copying the IOS script is not going
to work. You really do have to look at what is on your login prompt and
check against the script that it will work correctly.

Once the script properly detects the prompt, it feeds all lines of text
till the next prompt into the correct sub. That sub must read each line
and based on a regex decide what to do with it (store it, discard it,
maybe change it and then store it). When it hits the prompt, the sub
returns and the process continues till there is no more text.

When this whole process completes successfully, the script writes it's
data to disk and that goes into CVS/SVN. If it does not complete
successfully, you get "missed cmds" errors.

Do you see that no-one can really answer the question you asked exactly?

I'm not familiar with Enterasys at all but I do see that rivrancid is
missing some debugging code. The IOS parser has this main loop:

    while (/[>#]\s*($cmds_regexp)\s*$/) {
        $cmd = $1;
        if (!defined($prompt)) {
            $prompt = ($_ =~ /^([^#>]+[#>])/)[0];
            $prompt =~ s/([][}{)(\\])/\\$1/g;
            print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
        }
        ....

First thing I would do is put that print statement in your new script
and run it in debug mode to see if the prompt is matched. There are no
"HIT COMMAND" lines in your output, so I think that will be the first
thing to tackle.

Or maybe you are lucky and someone else has already solved this problem
and has a script already you can use :-)



On 18/10/2013 13:57, Victor Ruiz wrote:
> Hi, Thank for the reply;
> 
> When I try to do login with rivlogin the follow error appear:
> 
> rancid at monrancid1:~/bin$ /usr/local/rancid/bin/rivlogin -f /usr/local/rancid/.cloginrc b5b1.XXXX
> Trying 10.XX.XX.XX...
> telnet: Unable to connect to remote host: Connection refused
> 
> ERROR: device closed telnet connection during login
> rancid at monrancid1:~/bin$
> 
> But if I run the command: "/usr/local/rancid/bin/clogin -c "show config" b5b1.XXXX" run properly:             
> 
>  rancid at monrancid1:~/bin$ /usr/local/rancid/bin/clogin -c "show config" b5b1.XXXX             b5b1.XXXX
> spawn ssh -c 3des -x -l admin b5b1.XXXX
> admin at b5b1.infojobs's password:
> 
> 
> Enterasys B5
> Command Line Interface
> 
> Enterasys Networks, Inc.
> 9 Northeastern Boulevard
> Salem, NH 03079 U.S.A.
> 
> Phone: +1 603 952 5000
> E-mail: support at enterasys.com
> WWW: http://www.enterasys.com
> 
> (c) Copyright Enterasys Networks, Inc. 2013
> ....
> ....
> ....
> #webview
> !
> 
> #width
> !
> end
> 
> I suppose that this is because the rivlogin haven't option to connect via SSH.
> 
> I copy the clogin to entlogin and rivrancid to entranced and I include the entlogin inside racid-fe as new device, with this configuration I can login in the Enterasys device but in the logfile the message appear:
> 
> Trying to get all of the configs.
> b5b1.XXXX: missed cmd(s): show config
> b5b1.XXXX: End of run not found
> !
> =====================================
> Getting missed routers: round 1.
> b5b1.XXXX: missed cmd(s): show config
> b5b1.XXXX: End of run not found
> !
> =====================================
> Getting missed routers: round 2.
> b5b1.XXXX: missed cmd(s): show config
> b5b1.XXXX: End of run not found
> !
> =====================================
> Getting missed routers: round 3.
> b5b1.XXXX: missed cmd(s): show config
> b5b1.XXXX: End of run not found
> !
> =====================================
> Getting missed routers: round 4.
> b5b1.XXXX: missed cmd(s): show config
> b5b1.XXXX: End of run not found
> !
> 
> Any idea?
> 
> Many thanks.
> Victor
> 
> -----Mensaje original-----
> De: rancid-discuss-bounces at shrubbery.net [mailto:rancid-discuss-bounces at shrubbery.net] En nombre de Alan McKinnon
> Enviado el: viernes, 18 de octubre de 2013 13:28
> Para: rancid-discuss at shrubbery.net
> Asunto: Re: [rancid] Can't connect to Enterasys via SSH
> 
> I think you are starting your debugging in the wrong place. You first need to verify that the correct data is being passed to rivrancid for processing.
> 
> Are you using rivlogin to do the login and fetch data step?
> 
> Does this part work correctly when you run it manually?
> 
> 
> 
> On 18/10/2013 12:25, Victor Ruiz wrote:
>> Hi group;
>>
>>  
>>
>>   I'm new on Rancid software, I need get the configuration of several 
>> Enterasys boxes. I was use the rivlogin and rivrancid in order to get 
>> this configuration but I've a problem because in the rivlogin I only 
>> can connect via telnet. I'm making a new script coping the clogin with 
>> a different name for connect with Enterasys via SSH and work properly 
>> but when I try get the unique command that I need I have an error with text:
>> "missed cmd(s): show config".
>>
>>  
>>
>> My commnadtable is:
>>
>>  
>>
>> @commandtable = (
>>
>> #       {'show system'          => 'ShowUptime'},
>>
>> #       {'show version'         => 'ShowVersion'},
>>
>> #       {'show system hardware' => 'ShowHardware'},
>>
>> #       {'set length 0'         => 'ShowActive'},
>>
>>         {'show config'          => 'ShowActive'}
>>
>> );
>>
>>  
>>
>> And the routine for Show config is:
>>
>>  
>>
>> # This routine processes a "system show active"
>>
>> sub ShowActive {
>>
>>     print STDERR "    In ShowActive: $_" if ($debug);
>>
>>  
>>
>>     while (<INPUT>) {
>>
>>         tr/\015//d;
>>
>>  
>>
>>         # Remove leading whitespace and/or line numbers
>>
>>         s/^\s*(\d+\D: )*//;
>>
>>  
>>
>>         # Riverstone/Cabletron doesn't have an "end" line, so
>>
>>         # we need to set $clean_run here
>>
>>         if (/^$prompt/) {
>>
>>             $clean_run = 1;
>>
>>             last;
>>
>>         }
>>
>>  
>>
>>         next if (/Running system configuration/);
>>
>>  
>>
>>         # filter out any RCS/CVS tags to avoid confusing local CVS 
>> storage
>>
>>         s/\$(Revision|Id):/ $1:/;
>>
>>  
>>
>>         if (/^(.*hashed-password \S+)/ && $filter_pwds == 2) {
>>
>>             ProcessHistory("","","","!\n");
>>
>>             next;
>>
>>         }
>>
>>  
>>
>>         if (/^(snmp set community )\S+/ && $filter_commstr) {
>>
>>             ProcessHistory("","","","end\n");
>>
>>             next;
>>
>>         }
>>
>>  
>>
>>         ProcessHistory("","","","$_");
>>
>>     }
>>
>>     return;
>>
>> }
>>
>>  
>>
>> Can anybody help me with this issue or have anybody a Rancid scripts 
>> to connect with Enterasys system via SSH.
>>
>>  
>>
>> Thanks very much for you time and support
>>
>>  
>>
>> Bes Regards
>>
>> Victor
>>
>>  
>>
>>
>>
>> _______________________________________________
>> Rancid-discuss mailing list
>> Rancid-discuss at shrubbery.net
>> http://www.shrubbery.net/mailman/listinfo/rancid-discuss
>>
> 
> 
> --
> Alan McKinnon
> alan.mckinnon at gmail.com
> 
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo/rancid-discuss
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo/rancid-discuss
> 


-- 
Alan McKinnon
alan.mckinnon at gmail.com



More information about the Rancid-discuss mailing list