From emarkiewicz at cricketcommunications.com Fri Jun 1 18:17:48 2012 From: emarkiewicz at cricketcommunications.com (Edward Markiewicz) Date: Fri, 1 Jun 2012 12:17:48 -0600 Subject: [rancid] Rancid access through a console server Message-ID: <883CF9B19F557243965069AFB509256148E39315@denex3.cricketcommunications.com> Does anyone know of a technique to access a Juniper device through a console server? ~Ed -------------- next part -------------- An HTML attachment was scrubbed... URL: From denyipanyany at gmail.com Sat Jun 2 17:02:36 2012 From: denyipanyany at gmail.com (Deny IP Any Any) Date: Sat, 2 Jun 2012 13:02:36 -0400 Subject: [rancid] Cisco Nexus crashing due bug triggered by rancid Message-ID: Cisco Nexus 5.0.3 or later has a bug where if you run 'show version' 10,240 times, the Nexus will crash. Rancid includes 'show version' as part of its info gathering; today one of my production 5596UPs crashed due to this bug (CSCts72635). "If callhome is configured and sending alerts (like temperature alarms), the bios_daemon can be triggered in this process. The problem is that bios_daemon opens a file descriptor and it does not close. "show version" is another way to trigger this. The problem will occur after 10240 callhome alerts or instances of running "show version" 5.0(2) does not have this problem. " FYI. -- deny ip any any (4393649193 matches) -------------- next part -------------- An HTML attachment was scrubbed... URL: From istong at costar.com Mon Jun 4 12:08:23 2012 From: istong at costar.com (Ian Stong) Date: Mon, 4 Jun 2012 12:08:23 +0000 Subject: [rancid] Rancid access through a console server In-Reply-To: <883CF9B19F557243965069AFB509256148E39315@denex3.cricketcommunications.com> References: <883CF9B19F557243965069AFB509256148E39315@denex3.cricketcommunications.com> Message-ID: <6ED7B4C44A4C234FA7427C0BFDF35A32160D4659@DCMBXPRD100.us.costar.local> Same as most any other device in that if the Juniper has a console port then it's just a matter of getting the right connectors and pinouts. I have connected Juniper netscreens to a lantronix as an example. Ian From: rancid-discuss-bounces at shrubbery.net [mailto:rancid-discuss-bounces at shrubbery.net] On Behalf Of Edward Markiewicz Sent: Friday, June 01, 2012 2:18 PM To: rancid-discuss at shrubbery.net Subject: [rancid] Rancid access through a console server Does anyone know of a technique to access a Juniper device through a console server? ~Ed -------------- next part -------------- An HTML attachment was scrubbed... URL: From toby.smith at opengear.com Wed Jun 6 02:32:31 2012 From: toby.smith at opengear.com (Toby Smith) Date: Wed, 06 Jun 2012 12:32:31 +1000 Subject: [rancid] Opengear console servers and RANCID Message-ID: <4FCEC13F.6000601@opengear.com> Hi all, I've been working with doing some stuff with RANCID and the Opengear range of console servers. I've got basic device support for monitoring Opengear console servers themselves from RANCID going, that was pretty straight forward. However, I was also interested in providing capability for devices connected to an Opengear via a serial console cable to be monitored via RANCID. The Opengear exposes the management console of all the serially connected devices via the network in a bunch of ways (different SSH ports, different SSH usernames etc). I've got RANCID support for Ciscos behind an Opengear going at the moment, but I've had to add a new device type (which I've awkwardly called cisco-via-opengear). Ideally I wouldn't have had to do this, but I ran into some differences between real network device ports and Opengear-exposed serial console ports. Really it's just a different clogin script, but I had to also add a different rancid script (c-via-ograncid) to get it to call my c-via-oglogin. The simple difficulties I had to work around were: - Initial connections didn't present a prompt after login until a "\r" was sent down. - When connected via an Opengear network-to-serial port, typing "quit" or "exit" didn't close the connection. The trickiest thing though was that RANCID had the idea of one router per IP. When using the Opengear as a console server, you have serveral different devices available from the one IP, but accessed with different usernames or ssh ports. What I've done is use a % symbol as a delimiter in router.db and in .cloginrc to specify multiple hosts behind an Opengear. E.g. router.db: 192.168.0.250%ciscoASA:cisco-via-og:up 192.168.0.250%cisco17xx:cisco-via-og:up .clogin.rc: add password 192.168.0.250%cisco17xx opengearpassword ciscopassword add user 192.168.0.250%cisco17xx root:port3 add password 192.168.0.250%ciscoasa opengearpassword ciscopassword add user 192.168.0.250%ciscoasa root:port2 And then in my c-via-oglogin script, I strip the bit after the % from the router name before connecting. This all seems to be working nicely and I've got it monitoring a couple of cisco devices in my test lab. As I've said though, I've have liked to not have had to add a new device type for this (to avoid duplicating so much of the functionality). I've got patches for all this sitting in my home directory at the moment, but I thought I'd ask around if anyone else has any experience with RANCID via console servers or if there's any other interest for this before I tidy what I've got. Cheers, --Toby From zmousm at noc.grnet.gr Wed Jun 6 08:52:55 2012 From: zmousm at noc.grnet.gr (Zenon Mousmoulas) Date: Wed, 06 Jun 2012 11:52:55 +0300 Subject: [rancid] Extreme XOS (etc.) slow buffered output & clogin Message-ID: Hi, There is an issue with clogin and buffered output, easily reproducible with Extreme XOS devices, which by default show a sizable banner post-login, but I have also been able to reproduce it with Cisco switches, when a large banner is displayed: On Thu, 01 Dec 2011 03:44:32 +0200, Zenon Mousmoulas wrote: > [...] > However there's still a problem in this version with buffered output from > the extreme. After login, when you send "\r", the following expect > catches the first prompt, not the one after "\r". This becomes evident > later on, when the expect statement in the loop within run_commands > catches > "disable clipaging\r\n\" rather than the command echoed and > its' output. So you're always one step behind, until the end, where you > erroneously see a prompt after sending "quit\r" so you also > send -h "exit\r". This obviously messes up xrancid parsing as > well. See the attached clogin log for more evidence (with exp_internal > added after login). Some time ago I had posted a patch which tried to address this, among other things related to XOS & rancid. Other changes were accepted in 2.3.7 (thanks for that), however this issue is still present in 2.3.8. My rather ugly workaround was to add this code after login and before prompt detection: diff -ru rancid-2.3.8/bin/clogin.in rancid-2.3.8-zmousm/bin/clogin.in --- rancid-2.3.8/bin/clogin.in 2012-02-01 00:42:14.000000000 +0200 +++ rancid-2.3.8-zmousm/bin/clogin.in 2012-06-06 09:00:59.000000000 +0300 @@ -858,6 +858,16 @@ # if login failed or rsh was unsuccessful, move on to the next device continue } + # Get all (output after login) you can eat in 1s + # (hopefully up to and including the first prompt). + # This is mostly necessary to work around + # stoopid extreme output buffering. + expect { + -timeout 1 + -re "\[\n\r]+" { exp_continue } + -re "\[^\n\r]+" { exp_continue -continue_timer } + timeout {} + } # Figure out the prompt. if { [regexp -- "(#| \\(enable\\))" $prompt_match junk] == 1 } { set enable 0 Unfortunately this introduces a 1 second delay for all (not just XOS) clogin-controlled devices, but there is no obvious way to avoid this, since we haven't done prompt detection yet and haven't set $platform. Furthermore, this issue is not strictly limited to XOS devices, as noted previously, therefore a slightly different approach would be perhaps to trigger this delay when the output received after login exceeds some conservative threshold, but I'm not really sure if and how one could do such a thing. I can send again (off-list) clogin output with expect debugging enabled, depicting the issue described above, as well as the correct output of clogin patched with the code above. While going through the list archives, I also found this post which shows how xrancid parsing (see: missed cmds) and output is messed up exactly due to this issue: http://www.shrubbery.net/pipermail/rancid-discuss/2012-April/006308.html Please advise how this issue can be addressed. Thanks, Zenon Mousmoulas From zmousm at noc.grnet.gr Wed Jun 6 09:42:15 2012 From: zmousm at noc.grnet.gr (Zenon Mousmoulas) Date: Wed, 06 Jun 2012 12:42:15 +0300 Subject: [rancid] [PATCH] nxrancid ShowEnvPower oscillating Message-ID: Hi, ShowEnvPower in nxrancid tries to filter actual power/draw from the output, but (as noted in a comment) it does not always chop enough for the text to line up. Therefore nxrancid output oscillates when the power draw of some module(s), as reported by "show environment power", switches between 3-digit and 4-digit wattage. For example: --- group/configs/n7k-device 2012/06/04 23:18:42 7973 +++ group/configs/n7k-device 2012/06/05 02:18:43 7974 @@ -192,7 +192,7 @@ !Env: 4 N7K-M148GS-11L 400 W Powered-Up !Env: 5 N7K-SUP1 210 W Powered-Up !Env: 6 N7K-SUP1 210 W Powered-Up -!Env: 7 N7K-M132XP-12L 750 W Powered-Up +!Env: 7 N7K-M132XP-12L 750 W Powered-Up !Env: Xb1 N7K-C7010-FAB-1 80 W Powered-Up !Env: Xb2 N7K-C7010-FAB-1 80 W Powered-Up !Env: Xb3 N7K-C7010-FAB-1 80 W Powered-Up The following patch tries to stop this. Fixed width parsing works with NX-OS 6.0, I could not run this against other (previous) versions but it should be the same -- I hope someone on the list can test it. Best regards, Zenon Mousmoulas --- diff -ru rancid-2.3.8/bin/nxrancid.in rancid-2.3.8-zmousm/bin/nxrancid.in --- rancid-2.3.8/bin/nxrancid.in 2011-07-29 23:40:40.000000000 +0300 +++ rancid-2.3.8-zmousm/bin/nxrancid.in 2012-06-06 11:56:59.000000000 +0300 @@ -374,13 +374,16 @@ #------- ------------------- ----------- ----------- -------------- #2 NURBURGRING N/A 573 W Powered-Up #fan1 N/A 720 W Powered-Up - s/ Actual / /; - s/ Output / /; - s/ \(Watts \) / /; - s/ Draw / /; - s/ ----------- / /; - s/ N\/A / / || - s/ \d+ W / /; # Does not chop enough to line up. + + if (/Actual +Total/ || + /Actual +Power/ || + /Draw +Allocated/ || + /Output +Capacity/ || + /(\(Watts \)) +\g{-1}/ || + /(-----------) +\g{-1}/ || + /(\d+ W|N\/A) +\d+ W/) { + substr $_, 30, 13, ""; + } /actual draw/ && next; # Drop changing total power output. From michael6at at yahoo.de Wed Jun 6 13:28:27 2012 From: michael6at at yahoo.de (michael schnatterer) Date: Wed, 6 Jun 2012 14:28:27 +0100 (BST) Subject: [rancid] Rancid enable problem In-Reply-To: <14C91AC7-1EC9-4626-8C97-F0DAA20C7EF4@zyedge.com> References: <-5898066504269475923@unknownmsgid> <1337927131.82040.YahooMailNeo@web29012.mail.ird.yahoo.com> <5DC4853C6CC3EE4788779E0726E034DD013DC4D0@zy-ex1.zyedge.local> <1338274071.77675.YahooMailNeo@web29003.mail.ird.yahoo.com> <5DC4853C6CC3EE4788779E0726E034DD013F98A1@zy-ex1.zyedge.local>, <1338295610.94640.YahooMailNeo@web29011.mail.ird.yahoo.com> <1338302316.46729.YahooMailNeo@web29001.mail.ird.yahoo.com> <5DC4853C6CC3EE4788779E0726E034DD013FAEE9@zy-ex1.zyedge.local>, <1338470697.62318.YahooMailNeo@web29003.mail.ird.yahoo.com> <14C91AC7-1EC9-4626-8C97-F0DAA20C7EF4@zyedge.com> Message-ID: <1338989307.46226.YahooMailNeo@web29019.mail.ird.yahoo.com> Hy Guy's I'am realy Happy it works now for me :) The problem was the banner, i take * instead of the # and now everything is working Thanks again for everybody that helped me! Best Regards ________________________________ Von: Ryan West An: michael schnatterer CC: Adam Korab ; "rancid-discuss at shrubbery.net" Gesendet: 16:24 Donnerstag, 31.Mai 2012 Betreff: Re: [rancid] Rancid enable problem You're never issuing enable, which is why you need autoenable 0. ?Post the same output with autoenable 0.? Sent from handheld? On May 31, 2012, at 9:25 AM, "michael schnatterer" wrote: Hy, >Here is my Output: > >rancid at srv01: /home/rancid/bin/clogin -c show version "hostname" > >version >spawn ssh -c 3des -x -l rancid version >ssh: Could not resolve hostname version: Name or service not known > >Error: Couldn't login: version >"hostname" >spawn ssh -c 3des -x -l "User" "hostname" >"user"@"hostnames" password: >#######ASA Firewall ######## >ASA-FW> >ASA-FW> termin terminal length 0 >????????? ^ >ERROR: % Invalid input detected at '^' marker. >ERROR: Command authorization failed >ASA-FW>show >INFO: % Type "show ?" for a list of subcommands >ASA-FW> exit > > > >________________________________ > Von: Ryan West >An: michael schnatterer >CC: Adam Korab ; "rancid-discuss at shrubbery.net" >Gesendet: 17:42 Dienstag, 29.Mai 2012 >Betreff: RE: [rancid] Rancid enable problem > > > >The autoenable should be set to 0 for your config. >? >-ryan >? >From:michael schnatterer [mailto:michael6at at yahoo.de] >Sent: Tuesday, May 29, 2012 10:39 AM >To: Ryan West >Cc: Adam Korab; rancid-discuss at shrubbery.net >Subject: Re: [rancid] Rancid enable problem >? >.cloginrc >? >add user user1 {password} >add user * {rancid} > >#Firewall >add password 193.186.1.2 {userpassword} {enablepassword} >add autoenable 193.186.1.2 1 or 0 > >add method * {ssh} {telnet} > > >Thats it, how i said in my further post on every asa firewall work this config >Best regards and thanks >? > >________________________________ > >Von:Ryan West >An: michael schnatterer >CC: Adam Korab ; "rancid-discuss at shrubbery.net" >Gesendet: 14:49 Dienstag, 29.Mai 2012 >Betreff: Re: [rancid] Rancid enable problem >? >Paste a sanitized version of your .cloginrc file.? > >Sent from handheld? > >On May 29, 2012, at 8:46 AM, "michael schnatterer" wrote: >In this case i have an other username as RANCID, but this username is entered in the cloginrc too. >>? >>add user 193.186.1.2 {User} >>I login with the User and a password, after that i write enable and enter an other password as the first one. >>? >>Thanks >>? >> >>________________________________ >> >>Von:Ryan West >>An: michael schnatterer ; Adam Korab >>CC: "rancid-discuss at shrubbery.net" >>Gesendet: 13:56 Dienstag, 29.Mai 2012 >>Betreff: RE: [rancid] Rancid enable problem >> >>On Tue, May 29, 2012 at 02:47:51, michael schnatterer wrote: >>> Subject: Re: [rancid] Rancid enable problem >>> >>> Hy Guy's >>> >>> Thanks for your help, but it wouldn't work... >>> I tried with clogin -autoenable 193.186.1.2 but the enable command >>> doesn't come. >>> I tried to write the add autoenable 193.186.1.2 1 or 0 on the top of >>> my cloginrc, without success. >>> >>> I'am a little bit frustrated about the problem :( >>> >>> have anybody any other idea? >>> >>> Realy thanks for every help >> >>When you login to the device manually with the RANCID username, what exactly do you type?? Is it {username}, followed by {password}, then enable, followed by the same {password}? >> >> >> >? > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zmousm at noc.grnet.gr Wed Jun 6 17:54:27 2012 From: zmousm at noc.grnet.gr (Zenon Mousmoulas) Date: Wed, 06 Jun 2012 20:54:27 +0300 Subject: [rancid] [PATCH] clogin default prompt matches Extreme XOS banner (was: Re: Extreme XOS (etc.) slow buffered output & clogin) In-Reply-To: References: Message-ID: <5b95a3086c490d81fdbbb1a8c5a8f085@noc.grnet.gr> Hi again, Taking a closer look, the particular issue is due to '>' appearing in the banner XOS sends (by default) after login. The attached patch takes care of this. I can not recall if this appeared in XOS 12.5 or earlier. I understand there is a timeout pattern, implicitly added by a previous expect_after command, therefore slow/late output should never be an issue. As mentioned previously, I have also seen this issue on Cisco switches with similarly large post-login banners (banner motd). However I can't reproduce this currently, so let me take this back and the suggested ugly workaround. Sorry for the noise. Best regards, Z. On Wed, 06 Jun 2012 11:52:55 +0300, Zenon Mousmoulas wrote: > Hi, > > There is an issue with clogin and buffered output, easily reproducible > with Extreme XOS devices, which by default show a sizable banner > post-login, but I have also been able to reproduce it with Cisco switches, > when a large banner is displayed: > > On Thu, 01 Dec 2011 03:44:32 +0200, Zenon Mousmoulas > wrote: >> [...] >> However there's still a problem in this version with buffered output > from >> the extreme. After login, when you send "\r", the following expect >> catches the first prompt, not the one after "\r". This becomes evident >> later on, when the expect statement in the loop within run_commands >> catches >> "disable clipaging\r\n\" rather than the command echoed and >> its' output. So you're always one step behind, until the end, where you >> erroneously see a prompt after sending "quit\r" so you also >> send -h "exit\r". This obviously messes up xrancid parsing as >> well. See the attached clogin log for more evidence (with exp_internal >> added after login). > > Some time ago I had posted a patch which tried to address this, among > other things related to XOS & rancid. Other changes were accepted in 2.3.7 > (thanks for that), however this issue is still present in 2.3.8. > My rather ugly workaround was to add this code after login and before > prompt detection: > > diff -ru rancid-2.3.8/bin/clogin.in rancid-2.3.8-zmousm/bin/clogin.in > --- rancid-2.3.8/bin/clogin.in 2012-02-01 00:42:14.000000000 +0200 > +++ rancid-2.3.8-zmousm/bin/clogin.in 2012-06-06 09:00:59.000000000 +0300 > @@ -858,6 +858,16 @@ > # if login failed or rsh was unsuccessful, move on to the next device > continue > } > + # Get all (output after login) you can eat in 1s > + # (hopefully up to and including the first prompt). > + # This is mostly necessary to work around > + # stoopid extreme output buffering. > + expect { > + -timeout 1 > + -re "\[\n\r]+" { exp_continue } > + -re "\[^\n\r]+" { exp_continue -continue_timer } > + timeout {} > + } > # Figure out the prompt. > if { [regexp -- "(#| \\(enable\\))" $prompt_match junk] == 1 } { > set enable 0 > > Unfortunately this introduces a 1 second delay for all (not just XOS) > clogin-controlled devices, but there is no obvious way to avoid this, since > we haven't done prompt detection yet and haven't set $platform. > Furthermore, this issue is not strictly limited to XOS devices, as noted > previously, therefore a slightly different approach would be perhaps to > trigger this delay when the output received after login exceeds some > conservative threshold, but I'm not really sure if and how one could do > such a thing. > > I can send again (off-list) clogin output with expect debugging enabled, > depicting the issue described above, as well as the correct output of > clogin patched with the code above. > While going through the list archives, I also found this post which shows > how xrancid parsing (see: missed cmds) and output is messed up exactly due > to this issue: > http://www.shrubbery.net/pipermail/rancid-discuss/2012-April/006308.html > > Please advise how this issue can be addressed. > > Thanks, > Zenon Mousmoulas -------------- next part -------------- diff -ru rancid-2.3.8/bin/clogin.in rancid-2.3.8-zmousm/bin/clogin.in --- rancid-2.3.8/bin/clogin.in 2012-02-01 00:42:14.000000000 +0200 +++ rancid-2.3.8-zmousm/bin/clogin.in 2012-06-06 18:39:17.000000000 +0300 @@ -567,8 +567,23 @@ } exp_continue } - -re "$prompt" { + -indices -re "$prompt" { set prompt_match $expect_out(0,string); + if {"$prompt_match" == ">"} { + # Extreme XOS >= 12.5 by default sends a banner after login + # including this line: + # "Press the or '?' key at any time for completions." + # Match and discard it, as it is not a prompt. + if [string match "\r\nPress the " \ + [string range $expect_out(buffer) \ + [expr $expect_out(0,start) - 16] \ + $expect_out(0,start) \ + ] + ] { + send_error -- "second if\n"; + exp_continue + } + } break; } "Login invalid" { From zmousm at noc.grnet.gr Wed Jun 6 18:03:44 2012 From: zmousm at noc.grnet.gr (Zenon Mousmoulas) Date: Wed, 06 Jun 2012 21:03:44 +0300 Subject: [rancid] [PATCH] clogin default prompt matches Extreme XOS banner (was: Re: Extreme XOS (etc.) slow buffered output & clogin) In-Reply-To: <5b95a3086c490d81fdbbb1a8c5a8f085@noc.grnet.gr> References: <5b95a3086c490d81fdbbb1a8c5a8f085@noc.grnet.gr> Message-ID: Re-posting the patch with one minor correction. On Wed, 06 Jun 2012 20:54:27 +0300, Zenon Mousmoulas wrote: > Hi again, > > Taking a closer look, the particular issue is due to '>' appearing in the > banner XOS sends (by default) after login. The attached patch takes care of > this. I can not recall if this appeared in XOS 12.5 or earlier. > > I understand there is a timeout pattern, implicitly added by a previous > expect_after command, therefore slow/late output should never be an issue. > As mentioned previously, I have also seen this issue on Cisco switches with > similarly large post-login banners (banner motd). However I can't reproduce > this currently, so let me take this back and the suggested ugly workaround. > Sorry for the noise. > > Best regards, > Z. > > On Wed, 06 Jun 2012 11:52:55 +0300, Zenon Mousmoulas > wrote: >> Hi, >> >> There is an issue with clogin and buffered output, easily reproducible >> with Extreme XOS devices, which by default show a sizable banner >> post-login, but I have also been able to reproduce it with Cisco > switches, >> when a large banner is displayed: >> >> On Thu, 01 Dec 2011 03:44:32 +0200, Zenon Mousmoulas > >> wrote: >>> [...] >>> However there's still a problem in this version with buffered output >> from >>> the extreme. After login, when you send "\r", the following expect >>> catches the first prompt, not the one after "\r". This becomes evident >>> later on, when the expect statement in the loop within run_commands >>> catches >>> "disable clipaging\r\n\" rather than the command echoed and >>> its' output. So you're always one step behind, until the end, where you >>> erroneously see a prompt after sending "quit\r" so you also >>> send -h "exit\r". This obviously messes up xrancid parsing as >>> well. See the attached clogin log for more evidence (with exp_internal >>> added after login). >> >> Some time ago I had posted a patch which tried to address this, among >> other things related to XOS & rancid. Other changes were accepted in > 2.3.7 >> (thanks for that), however this issue is still present in 2.3.8. >> My rather ugly workaround was to add this code after login and before >> prompt detection: >> >> diff -ru rancid-2.3.8/bin/clogin.in rancid-2.3.8-zmousm/bin/clogin.in >> --- rancid-2.3.8/bin/clogin.in 2012-02-01 00:42:14.000000000 +0200 >> +++ rancid-2.3.8-zmousm/bin/clogin.in 2012-06-06 09:00:59.000000000 > +0300 >> @@ -858,6 +858,16 @@ >> # if login failed or rsh was unsuccessful, move on to the next device >> continue >> } >> + # Get all (output after login) you can eat in 1s >> + # (hopefully up to and including the first prompt). >> + # This is mostly necessary to work around >> + # stoopid extreme output buffering. >> + expect { >> + -timeout 1 >> + -re "\[\n\r]+" { exp_continue } >> + -re "\[^\n\r]+" { exp_continue -continue_timer } >> + timeout {} >> + } >> # Figure out the prompt. >> if { [regexp -- "(#| \\(enable\\))" $prompt_match junk] == 1 } { >> set enable 0 >> >> Unfortunately this introduces a 1 second delay for all (not just XOS) >> clogin-controlled devices, but there is no obvious way to avoid this, > since >> we haven't done prompt detection yet and haven't set $platform. >> Furthermore, this issue is not strictly limited to XOS devices, as noted >> previously, therefore a slightly different approach would be perhaps to >> trigger this delay when the output received after login exceeds some >> conservative threshold, but I'm not really sure if and how one could do >> such a thing. >> >> I can send again (off-list) clogin output with expect debugging enabled, >> depicting the issue described above, as well as the correct output of >> clogin patched with the code above. >> While going through the list archives, I also found this post which > shows >> how xrancid parsing (see: missed cmds) and output is messed up exactly > due >> to this issue: >> http://www.shrubbery.net/pipermail/rancid-discuss/2012-April/006308.html >> >> Please advise how this issue can be addressed. >> >> Thanks, >> Zenon Mousmoulas -------------- next part -------------- diff -ru rancid-2.3.8/bin/clogin.in rancid-2.3.8-zmousm/bin/clogin.in --- rancid-2.3.8/bin/clogin.in 2012-02-01 00:42:14.000000000 +0200 +++ rancid-2.3.8-zmousm/bin/clogin.in 2012-06-06 21:00:05.000000000 +0300 @@ -567,8 +567,22 @@ } exp_continue } - -re "$prompt" { + -indices -re "$prompt" { set prompt_match $expect_out(0,string); + if {"$prompt_match" == ">"} { + # Extreme XOS >= 12.5 by default sends a banner after login + # including this line: + # "Press the or '?' key at any time for completions." + # Match and discard it, as it is not a prompt. + if [string match "\r\nPress the " \ + [string range $expect_out(buffer) \ + [expr $expect_out(0,start) - 16] \ + $expect_out(0,start) \ + ] + ] { + exp_continue + } + } break; } "Login invalid" { From ehezi at 013netvision.co.il Wed Jun 6 08:32:53 2012 From: ehezi at 013netvision.co.il (Eyal Hezi) Date: Wed, 6 Jun 2012 08:32:53 +0000 Subject: [rancid] Nortel 8600 not working with Rancid Message-ID: <7BC19AB673A63D4D94DF55693EB044EA6BE0E0@MBX2.corp.cellcom.co.il> Hi All, I'm trying to run Rancid with Nortel 8600 but with no success. Attached here is the log file with error that I get: starting: Wed Jun 6 11:30:29 IDT 2012 cvs add: 10.10.10.6 already exists, with version number 1.1 cvs commit: Up-to-date check failed for `10.10.10.6' cvs [commit aborted]: correct above errors first! Added 10.10.10.6 Trying to get all of the configs. 10.10.10.6: missed cmd(s): bcc,exit,show config,show config -all 10.10.10.6: End of run not found ! ===================================== Getting missed routers: round 1. 10.10.10.6: missed cmd(s): bcc,exit,show config,show config -all 10.10.10.6: End of run not found ! ===================================== Getting missed routers: round 2. 10.10.10.6: missed cmd(s): bcc,exit,show config,show config -all 10.10.10.6: End of run not found ! ===================================== Getting missed routers: round 3. 10.10.10.6: missed cmd(s): bcc,exit,show config,show config -all 10.10.10.6: End of run not found ! ===================================== Getting missed routers: round 4. 10.10.10.6: missed cmd(s): bcc,exit,show config,show config -all 10.10.10.6: End of run not found ! cvs diff: Diffing . cvs diff: Diffing configs cvs commit: Examining . "var/logs/networking.20120606.113029" 43L, 1380C Thanks in advance appreciate it :) Regards, Eyal Hezi IP-Engineer IP/DATA team MIS -------------- next part -------------- An HTML attachment was scrubbed... URL: From mickey at greenglow.org Thu Jun 7 15:24:40 2012 From: mickey at greenglow.org (Mickey Everts) Date: Thu, 7 Jun 2012 10:24:40 -0500 Subject: [rancid] [PATCH] clogin default prompt matches Extreme XOS banner (was: Re: Extreme XOS (etc.) slow buffered output & clogin) In-Reply-To: References: <5b95a3086c490d81fdbbb1a8c5a8f085@noc.grnet.gr> Message-ID: <005301cd44c1$a95e5140$fc1af3c0$@greenglow.org> This patch appears to have resolved all of our issues on our switches with Extreme XOS 12.5.X and 12.6.X, and not created any new ones in our mixed environment of Cisco, Extreme, and Juniper devices. It would be really nice to see this included by default in the next release. Mickey -----Original Message----- From: Zenon Mousmoulas [mailto:zmousm at noc.grnet.gr] Sent: Wednesday, June 06, 2012 1:04 PM To: rancid-discuss at shrubbery.net Cc: Mickey Everts Subject: Re: [PATCH] clogin default prompt matches Extreme XOS banner (was: Re: Extreme XOS (etc.) slow buffered output & clogin) Re-posting the patch with one minor correction. On Wed, 06 Jun 2012 20:54:27 +0300, Zenon Mousmoulas wrote: > Hi again, > > Taking a closer look, the particular issue is due to '>' appearing in the > banner XOS sends (by default) after login. The attached patch takes > care of > this. I can not recall if this appeared in XOS 12.5 or earlier. > > I understand there is a timeout pattern, implicitly added by a > previous expect_after command, therefore slow/late output should never > be an issue. > As mentioned previously, I have also seen this issue on Cisco switches with > similarly large post-login banners (banner motd). However I can't reproduce > this currently, so let me take this back and the suggested ugly workaround. > Sorry for the noise. > > Best regards, > Z. > > On Wed, 06 Jun 2012 11:52:55 +0300, Zenon Mousmoulas > wrote: >> Hi, >> >> There is an issue with clogin and buffered output, easily >> reproducible with Extreme XOS devices, which by default show a >> sizable banner post-login, but I have also been able to reproduce it >> with Cisco > switches, >> when a large banner is displayed: >> >> On Thu, 01 Dec 2011 03:44:32 +0200, Zenon Mousmoulas > >> wrote: >>> [...] >>> However there's still a problem in this version with buffered output >> from >>> the extreme. After login, when you send "\r", the following expect >>> catches the first prompt, not the one after "\r". This becomes >>> evident later on, when the expect statement in the loop within >>> run_commands catches "disable clipaging\r\n\" rather than >>> the command echoed and its' output. So you're always one step >>> behind, until the end, where you >>> erroneously see a prompt after sending "quit\r" so you also send -h >>> "exit\r". This obviously messes up xrancid parsing as well. See the >>> attached clogin log for more evidence (with exp_internal added after >>> login). >> >> Some time ago I had posted a patch which tried to address this, among >> other things related to XOS & rancid. Other changes were accepted in > 2.3.7 >> (thanks for that), however this issue is still present in 2.3.8. >> My rather ugly workaround was to add this code after login and before >> prompt detection: >> >> diff -ru rancid-2.3.8/bin/clogin.in rancid-2.3.8-zmousm/bin/clogin.in >> --- rancid-2.3.8/bin/clogin.in 2012-02-01 00:42:14.000000000 +0200 >> +++ rancid-2.3.8-zmousm/bin/clogin.in 2012-06-06 09:00:59.000000000 > +0300 >> @@ -858,6 +858,16 @@ >> # if login failed or rsh was unsuccessful, move on to the next device >> continue >> } >> + # Get all (output after login) you can eat in 1s >> + # (hopefully up to and including the first prompt). >> + # This is mostly necessary to work around >> + # stoopid extreme output buffering. >> + expect { >> + -timeout 1 >> + -re "\[\n\r]+" { exp_continue } >> + -re "\[^\n\r]+" { exp_continue -continue_timer } >> + timeout {} >> + } >> # Figure out the prompt. >> if { [regexp -- "(#| \\(enable\\))" $prompt_match junk] == 1 } { >> set enable 0 >> >> Unfortunately this introduces a 1 second delay for all (not just XOS) >> clogin-controlled devices, but there is no obvious way to avoid this, > since >> we haven't done prompt detection yet and haven't set $platform. >> Furthermore, this issue is not strictly limited to XOS devices, as noted >> previously, therefore a slightly different approach would be perhaps >> to trigger this delay when the output received after login exceeds >> some conservative threshold, but I'm not really sure if and how one >> could do such a thing. >> >> I can send again (off-list) clogin output with expect debugging enabled, >> depicting the issue described above, as well as the correct output of >> clogin patched with the code above. >> While going through the list archives, I also found this post which > shows >> how xrancid parsing (see: missed cmds) and output is messed up >> exactly > due >> to this issue: >> http://www.shrubbery.net/pipermail/rancid-discuss/2012-April/006308.html >> >> Please advise how this issue can be addressed. >> >> Thanks, >> Zenon Mousmoulas From paolo at paolodemichele.it Sun Jun 10 13:43:34 2012 From: paolo at paolodemichele.it (Paolo De Michele) Date: Sun, 10 Jun 2012 15:43:34 +0200 Subject: [rancid] [ rancid ] - snmp trap with rancid Message-ID: <4FD4A486.50105@paolodemichele.it> Hi all, I would like to know how to configure trap on snmtp exclusively cisco devices (switches, routers). exist for the case of tutorials that I can follow to make this type of change? thanks in advance, regards -------------- next part -------------- An HTML attachment was scrubbed... URL: From toby.smith at opengear.com Wed Jun 13 05:02:18 2012 From: toby.smith at opengear.com (Toby Smith) Date: Wed, 13 Jun 2012 15:02:18 +1000 Subject: [rancid] Opengear console servers and RANCID In-Reply-To: <4FCEC13F.6000601@opengear.com> References: <4FCEC13F.6000601@opengear.com> Message-ID: <4FD81EDA.80909@opengear.com> For those interested, I've managed to get this to work without having to add a new device type for cisco devices via an opengear console servers. What I've done for now is add an expect wrapper around ssh (that can be configured as an "sshcmd" for the devices) that handles the idiosyncrasies that I ran into before. This should also open up a door to using an RANCID to monitor a whole range of devices (not just cisco ones) via an opengear console server. --Toby On 06/06/12 12:32, Toby Smith wrote: > Hi all, > > I've been working with doing some stuff with RANCID and the Opengear > range of console servers. > > I've got basic device support for monitoring Opengear console servers > themselves from RANCID going, that was pretty straight forward. > > However, I was also interested in providing capability for devices > connected to an Opengear via a serial console cable to be monitored via > RANCID. The Opengear exposes the management console of all the serially > connected devices via the network in a bunch of ways (different SSH > ports, different SSH usernames etc). > > I've got RANCID support for Ciscos behind an Opengear going at the > moment, but I've had to add a new device type (which I've awkwardly > called cisco-via-opengear). > > Ideally I wouldn't have had to do this, but I ran into some differences > between real network device ports and Opengear-exposed serial console > ports. Really it's just a different clogin script, but I had to also add > a different rancid script (c-via-ograncid) to get it to call my > c-via-oglogin. > > The simple difficulties I had to work around were: > > - Initial connections didn't present a prompt after login until a "\r" > was sent down. > - When connected via an Opengear network-to-serial port, typing "quit" > or "exit" didn't close the connection. > > The trickiest thing though was that RANCID had the idea of one router > per IP. When using the Opengear as a console server, you have serveral > different devices available from the one IP, but accessed with different > usernames or ssh ports. > > What I've done is use a % symbol as a delimiter in router.db and in > .cloginrc to specify multiple hosts behind an Opengear. E.g. > > router.db: > 192.168.0.250%ciscoASA:cisco-via-og:up > 192.168.0.250%cisco17xx:cisco-via-og:up > > .clogin.rc: > add password 192.168.0.250%cisco17xx opengearpassword ciscopassword > add user 192.168.0.250%cisco17xx root:port3 > add password 192.168.0.250%ciscoasa opengearpassword ciscopassword > add user 192.168.0.250%ciscoasa root:port2 > > And then in my c-via-oglogin script, I strip the bit after the % from > the router name before connecting. > > This all seems to be working nicely and I've got it monitoring a couple > of cisco devices in my test lab. As I've said though, I've have liked to > not have had to add a new device type for this (to avoid duplicating so > much of the functionality). > > I've got patches for all this sitting in my home directory at the > moment, but I thought I'd ask around if anyone else has any experience > with RANCID via console servers or if there's any other interest for > this before I tidy what I've got. > > Cheers, > --Toby > _______________________________________________ > Rancid-discuss mailing list > Rancid-discuss at shrubbery.net > http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss From DSearle at geminigroup.net Wed Jun 13 16:56:40 2012 From: DSearle at geminigroup.net (Dean Searle) Date: Wed, 13 Jun 2012 16:56:40 +0000 Subject: [rancid] Cisco WLC error in log Message-ID: <02D688AC1099C94C892202CA743C43222BB5E5@MAIL1.ggroup.local> Hi, I'm trying to get my Cisco 2504 WLC to talk with RANCID. With the help of the posts from here http://www.shrubbery.net/pipermail/rancid-discuss/2012-March/006254.html I have been able to get the router.db and .cloginrc setup correctly. I also have included the information into rancid-fe. Here is the line in router.db ---- 172.x.x.x:cisco-wlc5:up ---- .cloginrc ---- add user 172.x.x.x {user} add autoenable 172.x.x.x 1 add password 172.x.x.x {password} {password} add method 172.x.x.x ssh ---- If I manually do the following it works great: ---- rancid at akuma:~$ bin/clogin 172.x.x.x 172.x.x.x spawn ssh -c 3des -x -l {user} 172.x.x.x (Cisco Controller) User: Password:*********** (Cisco Controller) > (Cisco Controller) >show udi NAME: "Chassis" , DESCR: "Cisco 2500 Series Wireless LAN Controller" PID: AIR-CT2504-K9, VID: V01, SN: (Cisco Controller) >show sysinfo Manufacturer's Name.............................. Cisco Systems Inc. Product Name..................................... Cisco Controller Product Version.................................. 7.0.116.0 Bootloader Version............................... 1.0.16 Field Recovery Image Version..................... 1.0.0 Firmware Version................................. PIC 15.0 ---- But when I run this: ---- rancid at akuma:~$ bin/rancid-run -r 172.19.141.30 ---- I see this in the log: ---- Trying to get all of the configs. couldn't read file "--^M": no such file or directory 172.x.x.x: missed cmd(s): show sysinfo,show udi,show run-config commands 172.x.x.x: End of run not found ! ===================================== Getting missed routers: round 1. couldn't read file "--^M": no such file or directory 172.x.x.x: missed cmd(s): show sysinfo,show udi,show run-config commands 172.x.x.x: End of run not found ! ---- I'm not sure what file it couldn't read. If you could point me in the right direction it would be greatly appreciated. RANCID is a very nice program and has saved my hide a few times. Thanks in advance! Cheers, -Dean -------------- next part -------------- An HTML attachment was scrubbed... URL: From jj33 at pobox.com Thu Jun 14 16:37:15 2012 From: jj33 at pobox.com (John Jetmore) Date: Thu, 14 Jun 2012 12:37:15 -0400 Subject: [rancid] [PATCH] nxrancid ShowEnvPower oscillating In-Reply-To: References: Message-ID: On Wed, Jun 6, 2012 at 5:42 AM, Zenon Mousmoulas wrote: > Hi, > > ShowEnvPower in nxrancid tries to filter actual power/draw from the > output, but (as noted in a comment) it does not always chop enough for the > text to line up. Therefore nxrancid output oscillates when the power draw > of some module(s), as reported by "show environment power", switches > between 3-digit and 4-digit wattage. For example: > > --- group/configs/n7k-device ? ?2012/06/04 23:18:42 ? ? 7973 > +++ group/configs/n7k-device ? ?2012/06/05 02:18:43 ? ? 7974 > @@ -192,7 +192,7 @@ > ?!Env: 4 ? ? ? ?N7K-M148GS-11L ? ? ? ? ? ? ? ? ? ? 400 W ? ?Powered-Up > ?!Env: 5 ? ? ? ?N7K-SUP1 ? ? ? ? ? ? ? ? ? ? 210 W ? ?Powered-Up > ?!Env: 6 ? ? ? ?N7K-SUP1 ? ? ? ? ? ? ? ? ? ? 210 W ? ?Powered-Up > -!Env: 7 ? ? ? ?N7K-M132XP-12L ? ? ? ? ? ? ? ? ? 750 W ? ?Powered-Up > +!Env: 7 ? ? ? ?N7K-M132XP-12L ? ? ? ? ? ? ? ? ? ? 750 W ? ?Powered-Up > ?!Env: Xb1 ? ? ?N7K-C7010-FAB-1 ? ? ? ? ? ? ? 80 W ? ?Powered-Up > ?!Env: Xb2 ? ? ?N7K-C7010-FAB-1 ? ? ? ? ? ? ? 80 W ? ?Powered-Up > ?!Env: Xb3 ? ? ?N7K-C7010-FAB-1 ? ? ? ? ? ? ? 80 W ? ?Powered-Up > > The following patch tries to stop this. Fixed width parsing works with > NX-OS 6.0, I could not run this against other (previous) versions but it > should be the same -- I hope someone on the list can test it. > > Best regards, > Zenon Mousmoulas > --- > > diff -ru rancid-2.3.8/bin/nxrancid.in rancid-2.3.8-zmousm/bin/nxrancid.in > --- rancid-2.3.8/bin/nxrancid.in ? ? ? ?2011-07-29 23:40:40.000000000 +0300 > +++ rancid-2.3.8-zmousm/bin/nxrancid.in 2012-06-06 11:56:59.000000000 > +0300 > @@ -374,13 +374,16 @@ > ?#------- ?------------------- ?----------- ?----------- ?-------------- > ?#2 ? ? ? ?NURBURGRING ? ? ? ? ? ? ? ?N/A ? ? ? ? ?573 W ? ?Powered-Up > ?#fan1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?N/A ? ? ? ? ?720 W ? ?Powered-Up > - ? ? ? s/ ? ? ?Actual / ?/; > - ? ? ? s/ ? ? ?Output / ?/; > - ? ? ? s/ ? ?\(Watts \) / ?/; > - ? ? ? s/ ? ? ? ?Draw / ?/; > - ? ? ? s/ ----------- / ?/; > - ? ? ? s/ ? ? ? ?N\/A ?/ ?/ || > - ? ? ? s/ \d+ W / ?/; ? ? ? ? ?# Does not chop enough to line up. > + > + ? ? ? if (/Actual +Total/ || > + ? ? ? ? ? /Actual +Power/ || > + ? ? ? ? ? /Draw +Allocated/ || > + ? ? ? ? ? /Output +Capacity/ || > + ? ? ? ? ? /(\(Watts \)) +\g{-1}/ || > + ? ? ? ? ? /(-----------) +\g{-1}/ || > + ? ? ? ? ? /(\d+ W|N\/A) +\d+ W/) { > + ? ? ? ? ? substr $_, 30, 13, ""; > + ? ? ? } > > ? ? ? ?/actual draw/ && next; ?# Drop changing total power output. Zenon, thanks for reporting this. I just started looking at a similar issue on an NX-OS 5 machine, it was great to find your problem report and patch. I ended up using a slightly smaller fix which is working well for me: ######################### --- nxrancid-238-dist 2012-06-14 10:58:55.000000000 -0500 +++ nxrancid-238-local 2012-06-14 11:00:00.000000000 -0500 @@ -380,7 +380,7 @@ s/ Draw / /; s/ ----------- / /; s/ N\/A / / || - s/ \d+ W / /; # Does not chop enough to line up. + s/ [ \d]{9} W / /; # Does not chop enough to line up. (does now) /actual draw/ && next; # Drop changing total power output. ########################### I didn't feel comfortable that the substr() solution wouldn't cause other problems (for instance, unexpectedly long module or model names making the column 30 starting point incorrect). My solution isn't perfect, but it feels slightly safer to me. Thanks --John From DSearle at geminigroup.net Thu Jun 14 17:36:48 2012 From: DSearle at geminigroup.net (Dean Searle) Date: Thu, 14 Jun 2012 17:36:48 +0000 Subject: [rancid] Cisco WLC error in log Message-ID: <02D688AC1099C94C892202CA743C43222BC0AE@MAIL1.ggroup.local> I figured out my problem. When I tried to run ---- rancid at akuma:~$ bin/wlogin -f .clogin 172.x.x.x ": no such file or directory ---- Couldn't figure out what file it wasn't able to find. After combing through the file wlogin I went to save it and noticed this: ---- File Name to Write [DOS Format]: bin/wlogin ---- I tried the same thing with clogin and it did not mention anything about [DOS Format]. So I renamed wlogin to wlogin.old and created a new file, copied the code into the file and tested it out. It now works. Something must have happened when I scp'd the file to my ubuntu server. -Cheers Dean Searle -------------- next part -------------- An HTML attachment was scrubbed... URL: From heas at shrubbery.net Fri Jun 15 00:29:58 2012 From: heas at shrubbery.net (heasley) Date: Thu, 14 Jun 2012 17:29:58 -0700 Subject: [rancid] [PATCH] nxrancid ShowEnvPower oscillating In-Reply-To: <20120615002904.4534724CE9C@sea.shrubbery.net> Message-ID: <20120615002958.GQ51911@shrubbery.net> How about the following instead: Index: nxrancid.in =================================================================== --- nxrancid.in (revision 2494) +++ nxrancid.in (working copy) @@ -375,14 +375,8 @@ #------- ------------------- ----------- ----------- -------------- #2 NURBURGRING N/A 573 W Powered-Up #fan1 N/A 720 W Powered-Up - if (/Actual +Total/ || - /Actual +Power/ || - /Draw +Allocated/ || - /Output +Capacity/ || - /(\(Watts \)) +\g{-1}/ || - /(-----------) +\g{-1}/ || - /(\d+ W|N\/A) +\d+ W/) { - substr($_, 30, 13, ""); + if ( /(.*) +(\d+ W)( +\d+ W.*)/) { + $_ = sprintf("%s%-". length($2)."s%s\n", $1, "", $3); } /actual draw/ && next; # Drop changing total power output. From toby.smith at opengear.com Fri Jun 15 05:03:11 2012 From: toby.smith at opengear.com (Toby Smith) Date: Fri, 15 Jun 2012 15:03:11 +1000 Subject: [rancid] Opengear console servers and RANCID In-Reply-To: <4FCEC13F.6000601@opengear.com> References: <4FCEC13F.6000601@opengear.com> Message-ID: <4FDAC20F.6050807@opengear.com> Hi, Attached to this email are oglogin and ograncid They are modified clogin and rancid scripts for monitoring the configuration on Opengear console servers. They've been tested with telnet and ssh, and with root and admin users (although you'll only be able to backup and monitor password hashes if you're logging in as the root user). The only other modification was to add 'opengear' => 'ograncid', to %vendortable in rancid-fe and then use "opengear" to describe the console servers in router.db If anyone has any feedback I'd love to hear it. We've been using this in house for monitoring the devices in our test rack and it's been working fine and has been quite useful already. --Toby -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ograncid URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: oglogin URL: From jj33 at pobox.com Fri Jun 15 13:52:20 2012 From: jj33 at pobox.com (John Jetmore) Date: Fri, 15 Jun 2012 09:52:20 -0400 Subject: [rancid] [PATCH] nxrancid ShowEnvPower oscillating In-Reply-To: <20120615002958.GQ51911@shrubbery.net> References: <20120615002904.4534724CE9C@sea.shrubbery.net> <20120615002958.GQ51911@shrubbery.net> Message-ID: On Thu, Jun 14, 2012 at 8:29 PM, heasley wrote: > How about the following instead: > > Index: nxrancid.in > =================================================================== > --- nxrancid.in (revision 2494) > +++ nxrancid.in (working copy) > @@ -375,14 +375,8 @@ > ?#------- ?------------------- ?----------- ?----------- ?-------------- > ?#2 ? ? ? ?NURBURGRING ? ? ? ? ? ? ? ?N/A ? ? ? ? ?573 W ? ?Powered-Up > ?#fan1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?N/A ? ? ? ? ?720 W ? ?Powered-Up > - ? ? ? if (/Actual +Total/ || > - ? ? ? ? ? /Actual +Power/ || > - ? ? ? ? ? /Draw +Allocated/ || > - ? ? ? ? ? /Output +Capacity/ || > - ? ? ? ? ? /(\(Watts \)) +\g{-1}/ || > - ? ? ? ? ? /(-----------) +\g{-1}/ || > - ? ? ? ? ? /(\d+ W|N\/A) +\d+ W/) { > - ? ? ? ? ? substr($_, 30, 13, ""); > + ? ? ? if ( /(.*) +(\d+ W)( +\d+ W.*)/) { > + ? ? ? ? ? $_ = sprintf("%s%-". length($2)."s%s\n", $1, "", $3); > ? ? ? ?} > > ? ? ? ?/actual draw/ && next; ?# Drop changing total power output. > Here's a version of your patch that applies against 238 (it looks like the version above was applied against a copy already patched with Zenon's solution): ################ --- nxrancid-238-dist 2012-06-14 09:10:26.000000000 -0500 +++ nxrancid-238-heasley 2012-06-15 08:22:37.000000000 -0500 @@ -379,8 +379,10 @@ s/ \(Watts \) / /; s/ Draw / /; s/ ----------- / /; - s/ N\/A / / || - s/ \d+ W / /; # Does not chop enough to line up. + s/ N\/A / /; + if (/(.*) +(\d+ W)( +\d+ W.*)/) { + $_ = sprintf("%s%-". length($2)."s%s\n", $1, "", $3); + } /actual draw/ && next; # Drop changing total power output. ################# Second, I like what you are doing here, your solution solves my major concern with my patch, which was that I was matching [\s\d]{9}, but not strictly requiring that it be all spaces and then all digits. This left a small hole where, if there was somehow another number added immediately in front of the actual wattage, we would swallow it. My only problem with this solution is that it still leaves the \d+\sW lines out of alignment with the lines around it. I'm attaching a .txt of the different patch outputs so they can be easily viewed in a monospace font. Here is my version of your patch which solves all of the issues: 1) prevents line oscillation when the number of figits in the actual draw changes 2) stricter regexp, should only parse the line as we expect. 3) fixes alignment so all "show env power" output columns match ###################### --- nxrancid-238-dist 2012-06-14 09:10:26.000000000 -0500 +++ nxrancid-238-jetmore-2 2012-06-15 08:40:29.000000000 -0500 @@ -379,8 +379,10 @@ s/ \(Watts \) / /; s/ Draw / /; s/ ----------- / /; - s/ N\/A / / || - s/ \d+ W / /; # Does not chop enough to line up. + s/ N\/A / /; + if (/(.*?)(\s+\d+ W)( +\d+ W.*)/) { + $_ = sprintf("%s%-".(length($2)-11)."s%s\n", $1, "", $3); + } /actual draw/ && next; # Drop changing total power output. ########################## Thanks for your consideration, --John -------------- next part -------------- ####################### un-modified output: Actual Power Module Model Draw Allocated Status (Watts ) (Watts ) ------- ------------------- ----------- ----------- -------------- Xb4 xbar N/A 60 W Absent Xb5 xbar N/A 60 W Absent fan1 N7K-C7010-FAN-S 116 W 720 W Powered-Up fan2 N7K-C7010-FAN-S 116 W 720 W Powered-Up fan3 N7K-C7010-FAN-F 11 W 120 W Powered-Up fan4 N7K-C7010-FAN-F 11 W 120 W Powered-Up ############################ original code: !Env: Power !Env: Module Model Allocated Status !Env: (Watts ) !Env: ------- ------------------- ----------- -------------- !Env: Xb4 xbar 60 W Absent !Env: Xb5 xbar 60 W Absent !Env: fan1 N7K-C7010-FAN-S 720 W Powered-Up !Env: fan2 N7K-C7010-FAN-S 720 W Powered-Up !Env: fan3 N7K-C7010-FAN-F 120 W Powered-Up !Env: fan4 N7K-C7010-FAN-F 120 W Powered-Up ############################ jetmore's original patch: !Env: Power !Env: Module Model Allocated Status !Env: (Watts ) !Env: ------- ------------------- ----------- -------------- !Env: Xb4 xbar 60 W Absent !Env: Xb5 xbar 60 W Absent !Env: fan1 N7K-C7010-FAN-S 720 W Powered-Up !Env: fan2 N7K-C7010-FAN-S 720 W Powered-Up !Env: fan3 N7K-C7010-FAN-F 120 W Powered-Up !Env: fan4 N7K-C7010-FAN-F 120 W Powered-Up ################################ heasley's patch: !Env: Power !Env: Module Model Allocated Status !Env: (Watts ) !Env: ------- ------------------- ----------- -------------- !Env: Xb4 xbar 60 W Absent !Env: Xb5 xbar 60 W Absent !Env: fan1 N7K-C7010-FAN-S 720 W Powered-Up !Env: fan2 N7K-C7010-FAN-S 720 W Powered-Up !Env: fan3 N7K-C7010-FAN-F 120 W Powered-Up !Env: fan4 N7K-C7010-FAN-F 120 W Powered-Up ################################## jetmore's new patch: !Env: Power !Env: Module Model Allocated Status !Env: (Watts ) !Env: ------- ------------------- ----------- -------------- !Env: Xb4 xbar 60 W Absent !Env: Xb5 xbar 60 W Absent !Env: fan1 N7K-C7010-FAN-S 720 W Powered-Up !Env: fan2 N7K-C7010-FAN-S 720 W Powered-Up !Env: fan3 N7K-C7010-FAN-F 120 W Powered-Up !Env: fan4 N7K-C7010-FAN-F 120 W Powered-Up From zmousm at noc.grnet.gr Fri Jun 15 14:57:46 2012 From: zmousm at noc.grnet.gr (Zenon Mousmoulas) Date: Fri, 15 Jun 2012 17:57:46 +0300 Subject: [rancid] [PATCH] nxrancid ShowEnvPower oscillating In-Reply-To: References: <20120615002904.4534724CE9C@sea.shrubbery.net> <20120615002958.GQ51911@shrubbery.net> Message-ID: <135972bfe3323691f125b7f905a14168@noc.grnet.gr> On Fri, 15 Jun 2012 09:52:20 -0400, John Jetmore wrote: > [...] > Here is my version of your patch which solves all of the issues: > 1) prevents line oscillation when the number of figits in the actual > draw changes > 2) stricter regexp, should only parse the line as we expect. > 3) fixes alignment so all "show env power" output columns match > > ###################### > --- nxrancid-238-dist 2012-06-14 09:10:26.000000000 -0500 > +++ nxrancid-238-jetmore-2 2012-06-15 08:40:29.000000000 -0500 > @@ -379,8 +379,10 @@ > s/ \(Watts \) / /; > s/ Draw / /; > s/ ----------- / /; > - s/ N\/A / / || > - s/ \d+ W / /; # Does not chop enough to line up. > + s/ N\/A / /; > + if (/(.*?)(\s+\d+ W)( +\d+ W.*)/) { > + $_ = sprintf("%s%-".(length($2)-11)."s%s\n", $1, "", $3); > + } > > /actual draw/ && next; # Drop changing total power output. > ########################## In my approach I also trimmed the whitespace after this column (11+2=13 chars). Other than that, LGTM. That is, until Cisco changes the width of this column ;) Thanks, Z. From heas at shrubbery.net Fri Jun 15 16:00:21 2012 From: heas at shrubbery.net (heasley) Date: Fri, 15 Jun 2012 09:00:21 -0700 Subject: [rancid] [PATCH] nxrancid ShowEnvPower oscillating In-Reply-To: References: <20120615002904.4534724CE9C@sea.shrubbery.net> <20120615002958.GQ51911@shrubbery.net> Message-ID: <20120615160021.GA97748@shrubbery.net> Fri, Jun 15, 2012 at 09:52:20AM -0400, John Jetmore: > --- nxrancid-238-dist 2012-06-14 09:10:26.000000000 -0500 > +++ nxrancid-238-heasley 2012-06-15 08:22:37.000000000 -0500 > @@ -379,8 +379,10 @@ > s/ \(Watts \) / /; > s/ Draw / /; > s/ ----------- / /; > - s/ N\/A / / || > - s/ \d+ W / /; # Does not chop enough to line up. > + s/ N\/A / /; > + if (/(.*) +(\d+ W)( +\d+ W.*)/) { > + $_ = sprintf("%s%-". length($2)."s%s\n", $1, "", $3); > + } > > /actual draw/ && next; # Drop changing total power output. > ################# > > Second, I like what you are doing here, your solution solves my major > concern with my patch, which was that I was matching [\s\d]{9}, but > not strictly requiring that it be all spaces and then all digits. > This left a small hole where, if there was somehow another number > added immediately in front of the actual wattage, we would swallow it. > > My only problem with this solution is that it still leaves the \d+\sW > lines out of alignment with the lines around it. I'm attaching a .txt > of the different patch outputs so they can be easily viewed in a > monospace font. your patch isnt complete; mine removed all the filters to remove the column and just blanked the data. so the column remains and there is no issue with alignment. but, your regex is correct including that WS, so in my method > + if (/(.*) +(\d+ W)( +\d+ W.*)/) { becomes + if (/(.* +)(\d+ W)( +\d+ W.*)/) { > Here is my version of your patch which solves all of the issues: > 1) prevents line oscillation when the number of figits in the actual > draw changes > 2) stricter regexp, should only parse the line as we expect. > 3) fixes alignment so all "show env power" output columns match > > ###################### > --- nxrancid-238-dist 2012-06-14 09:10:26.000000000 -0500 > +++ nxrancid-238-jetmore-2 2012-06-15 08:40:29.000000000 -0500 > @@ -379,8 +379,10 @@ > s/ \(Watts \) / /; > s/ Draw / /; > s/ ----------- / /; > - s/ N\/A / / || > - s/ \d+ W / /; # Does not chop enough to line up. > + s/ N\/A / /; > + if (/(.*?)(\s+\d+ W)( +\d+ W.*)/) { > + $_ = sprintf("%s%-".(length($2)-11)."s%s\n", $1, "", $3); > + } > > /actual draw/ && next; # Drop changing total power output. > ########################## > > Thanks for your consideration, > --John > ####################### > un-modified output: > Actual Power > Module Model Draw Allocated Status > (Watts ) (Watts ) > ------- ------------------- ----------- ----------- -------------- > Xb4 xbar N/A 60 W Absent > Xb5 xbar N/A 60 W Absent > fan1 N7K-C7010-FAN-S 116 W 720 W Powered-Up > fan2 N7K-C7010-FAN-S 116 W 720 W Powered-Up > fan3 N7K-C7010-FAN-F 11 W 120 W Powered-Up > fan4 N7K-C7010-FAN-F 11 W 120 W Powered-Up > > ############################ > original code: > !Env: Power > !Env: Module Model Allocated Status > !Env: (Watts ) > !Env: ------- ------------------- ----------- -------------- > !Env: Xb4 xbar 60 W Absent > !Env: Xb5 xbar 60 W Absent > !Env: fan1 N7K-C7010-FAN-S 720 W Powered-Up > !Env: fan2 N7K-C7010-FAN-S 720 W Powered-Up > !Env: fan3 N7K-C7010-FAN-F 120 W Powered-Up > !Env: fan4 N7K-C7010-FAN-F 120 W Powered-Up > > > ############################ > jetmore's original patch: > !Env: Power > !Env: Module Model Allocated Status > !Env: (Watts ) > !Env: ------- ------------------- ----------- -------------- > !Env: Xb4 xbar 60 W Absent > !Env: Xb5 xbar 60 W Absent > !Env: fan1 N7K-C7010-FAN-S 720 W Powered-Up > !Env: fan2 N7K-C7010-FAN-S 720 W Powered-Up > !Env: fan3 N7K-C7010-FAN-F 120 W Powered-Up > !Env: fan4 N7K-C7010-FAN-F 120 W Powered-Up > > ################################ > heasley's patch: > !Env: Power > !Env: Module Model Allocated Status > !Env: (Watts ) > !Env: ------- ------------------- ----------- -------------- > !Env: Xb4 xbar 60 W Absent > !Env: Xb5 xbar 60 W Absent > !Env: fan1 N7K-C7010-FAN-S 720 W Powered-Up > !Env: fan2 N7K-C7010-FAN-S 720 W Powered-Up > !Env: fan3 N7K-C7010-FAN-F 120 W Powered-Up > !Env: fan4 N7K-C7010-FAN-F 120 W Powered-Up > > ################################## > jetmore's new patch: > !Env: Power > !Env: Module Model Allocated Status > !Env: (Watts ) > !Env: ------- ------------------- ----------- -------------- > !Env: Xb4 xbar 60 W Absent > !Env: Xb5 xbar 60 W Absent > !Env: fan1 N7K-C7010-FAN-S 720 W Powered-Up > !Env: fan2 N7K-C7010-FAN-S 720 W Powered-Up > !Env: fan3 N7K-C7010-FAN-F 120 W Powered-Up > !Env: fan4 N7K-C7010-FAN-F 120 W Powered-Up > From jj33 at pobox.com Fri Jun 15 18:39:26 2012 From: jj33 at pobox.com (John Jetmore) Date: Fri, 15 Jun 2012 14:39:26 -0400 Subject: [rancid] [PATCH] nxrancid ShowEnvPower oscillating In-Reply-To: <20120615160021.GA97748@shrubbery.net> References: <20120615002904.4534724CE9C@sea.shrubbery.net> <20120615002958.GQ51911@shrubbery.net> <20120615160021.GA97748@shrubbery.net> Message-ID: On Fri, Jun 15, 2012 at 12:00 PM, heasley wrote: > your patch isnt complete; mine removed all the filters to remove the > column and just blanked the data. ?so the column remains and there is > no issue with alignment. ?but, your regex is correct including that > WS, so in my method > >> + ? ? ? if (/(.*) +(\d+ W)( +\d+ W.*)/) { > becomes > + ? ? ? if (/(.* +)(\d+ W)( +\d+ W.*)/) { It wasn't clear to me what you were doing because your diff wasn't against the 2.3.8 code, but I now understand what you are saying. Sounds like a fine solution to me, and I'm glad my response helped a little. Looking forward to seeing it in the next release. For the record, here's what I actually tested locally: ############################# --- nxrancid-238-dist 2012-06-14 09:10:26.000000000 -0500 +++ nxrancid-238-heasley-2 2012-06-15 13:37:27.000000000 -0500 @@ -374,13 +374,9 @@ #------- ------------------- ----------- ----------- -------------- #2 NURBURGRING N/A 573 W Powered-Up #fan1 N/A 720 W Powered-Up - s/ Actual / /; - s/ Output / /; - s/ \(Watts \) / /; - s/ Draw / /; - s/ ----------- / /; - s/ N\/A / / || - s/ \d+ W / /; # Does not chop enough to line up. + if (/(.* +)(\d+ W)( +\d+ W.*)/) { + $_ = sprintf("%s%-".length($2)."s%s\n", $1, "", $3); + } /actual draw/ && next; # Drop changing total power output. ######################## And example output (which lines up properly in monospace font): !Env: Xb4 xbar N/A 60 W Absent !Env: Xb5 xbar N/A 60 W Absent !Env: fan1 N7K-C7010-FAN-S 720 W Powered-Up !Env: fan2 N7K-C7010-FAN-S 720 W Powered-Up Thanks --John From eravin at panix.com Fri Jun 29 17:20:44 2012 From: eravin at panix.com (Ed Ravin) Date: Fri, 29 Jun 2012 13:20:44 -0400 Subject: [rancid] new RANCID code for Vyatta Message-ID: <20120629172044.GA2063@panix.com> Anyone out there using Vyatta boxes and wants to put them into RANCID? Currently, the only people I've seen doing this are using the wrapper rancid and ssh'ing the config file in themselves. I'm putting together a more RANCID-like solution that runs Vyatta CLI commands via non-interactive ssh (requires public key authentication), and it fetches the running config so you will be able to track unsaved changes. So far it does this: show version show hardware dmi show hardware pci show hardware cpu show configuration commands If you have a Vyatta and would like to try this out, please email me off-list. I'll post the code to the list when it stabilizes. -- Ed