[rancid] Re: Searching for Half-duplex Interfaces

Pabon, Nestor NPabon at archstonesmith.com
Sat Jan 12 00:37:52 UTC 2008


Worked like a charm.

Thank you.

Regards,
Nestor

 

-----Original Message-----
From: Chris Moody [mailto:cmoody at qualcomm.com] 
Sent: Friday, January 11, 2008 4:57 PM
To: Pabon, Nestor
Cc: Ed Ravin; rancid-discuss at shrubbery.net
Subject: Re: [rancid] Re: Searching for Half-duplex Interfaces

Bash shell scripting 101. [ http://tldp.org/LDP/abs/html/ ]
Edit 3 lines of the code.

Insert this after the "read COMMANDSFILE" line:
---
echo "Please enter the name of the file you want to store this data in:"
read OUTPUTFILE
---



and then edit this line:
---
$CLOGINPATH -f $CREDENTIALS -x $COMMANDSFILEPATH/$COMMANDSFILE $i
---

to look like this:
---
$CLOGINPATH -f $CREDENTIALS -x $COMMANDSFILEPATH/$COMMANDSFILE $i >> 
$OUTPUTFILE
---

For anyone else wondering what I'm referring to, I wrote a shell wrapper

routine for Nestor a few weeks back.  It's only like a 30-second quick 
rough draft...

[ http://www.siliconhotrod.com/files/rancid-config-apply.sh ]

Cheers,
-Chris

Pabon, Nestor wrote:
> Hi Chris;
> 
> I'm trying to incorporate your script, and it is working. The part I'm
> lost in is how end up with a file containing the output.
> 
> Regards,
> Nestor
> 
> -----Original Message-----
> From: Chris Moody [mailto:cmoody at qualcomm.com] 
> Sent: Friday, January 11, 2008 4:43 PM
> To: Pabon, Nestor
> Cc: Ed Ravin; rancid-discuss at shrubbery.net
> Subject: Re: [rancid] Re: Searching for Half-duplex Interfaces
> 
> You can use the shell routine I gave you.
> 
> ./rancid-config-apply.sh
> 
> Put the commands you want to issue to the device into the location 
> defined in the COMMANDSFILEPATH variable...and then just answer the
> prompts.
> 
> ex>
> rancid at fittipaldi ~ $ cat command-scripts/interface-duplex
> show interfaces | inc (line protocol|duplex|speed)
> 
> #####
> rancid at fittipaldi ~ $ ./scripts/bash/rancid-config-apply.sh
> =====[ Rancid Config Apply Script ]=====
> 
> Please enter the nodegroup:
> mpls-routers
> Please enter name of commands-file:
> interface-duplex
> ...
> #####
> 
> and the routine will take off from there...only logging into devices 
> that are flagged as "up" in rancid.
> 
> Cheers,
> -Chris
> 
> 
> Pabon, Nestor wrote:
>> So the list of routers is in:
>>
>> /opt/rancid/data/mpls-routers
>>
>> Does this mean that 
>>
>> "for rtr in ...list..."
>>
>> Becomes
>>
>> "for rtr in /opt/rancid/data/mpls-routers/router.db"
>>
>> Regards,
>> Nestor
>>
>>  
>>
>> -----Original Message-----
>> From: Ed Ravin [mailto:eravin at panix.com] 
>> Sent: Friday, January 11, 2008 3:29 PM
>> To: Pabon, Nestor
>> Cc: rancid-discuss at shrubbery.net
>> Subject: Re: [rancid] Re: Searching for Half-duplex Interfaces
>>
>> On Fri, Jan 11, 2008 at 02:33:32PM -0700, Pabon, Nestor wrote:
>>> I'm not sure I conveyed my goal correctly.
>>>
>>> If I use clogin or log directly into the router I know I can query
>>> issuing the following:
>>>
>>> "sh interface | i Half-duplex"
>>>
>>> But this will only return something like:
>>>
>>> "Half-duplex, 10Mb/s, 100BaseTX/FX"
>> But if you followed John's instructions (repeated below, with slight
>> edits
>> for clarity), you would get something much better than that.  Note
the
>> regexp which will match things like:
>>
>>      FastEthernet0/0/0 is up, line protocol is up
>>
>> So you'll see the interface names, and then their duplex settings if
>> they are Ethernet-based.
>>
>> --------
>>
>>    for rtr in ...list...
>>    do
>>        clogin -c 'show interfaces | inc (line protocol|duplex|speed)'
>> $rtr >>output.file 2>&1
>>    done
>>
>>
>> _______________________________________________
>> Rancid-discuss mailing list
>> Rancid-discuss at shrubbery.net
>> http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
>>
>>
> 
> 


More information about the Rancid-discuss mailing list