[rancid] Re: Eliminating two lines from foundry output

Jeremy Singletary jeremys at rickyninja.net
Wed Jan 9 22:32:57 UTC 2008


#!/usr/bin/perl

use strict;
use warnings;

while (<DATA>) {
    if (/^!\s+Fan\s+\d+/) {
        $_ = (split /:/, $_)[0] . "\n";
    }
    print;
}

__DATA__
!
! Fan 1 ok, speed (auto): 1<->2<->[[3]]
! Fan 2 ok, speed (auto): 1<->2<->[[3]]
!
! Fan controlled temperature: 35.0 deg-C
! Fan controlled temperature: 35.5 deg-C
!
! Fan speed switching temperature thresholds:
!             Speed 1: NM<----->30                            deg-C
!             Speed 2:       25<----->40                      deg-C


On 01/09/08, Chris Gauthier <cgauthie at pcc.edu> said:
> That did the trick, though I have one other trick I need to pull out of 
> my sleeve (after I learn it).
> 
> I still am getting config changes, even though nothing actually changes...
> 
> Exerpt:
> 
> - ! Fan 1 ok, speed (auto): 1<->2<->[[3]]
> - ! Fan 2 ok, speed (auto): 1<->2<->[[3]]
> + ! Fan 1 ok, speed (auto): 1<->[[2]]<->3
> + ! Fan 2 ok, speed (auto): 1<->[[2]]<->3
> 
> What I want to do is preserve the "Fan X ok" or "Fan X failed", but with 
> out the fan speed information.  Why?  Because the temperature hangs 
> right at the threshold between the two fan speeds, so it goes up and 
> down several times per day.
> 
> Is there a way to be that granular in my string processing without 
> bogging everything down?
> 
> Chris
> 
> 
> Mike Ashcraft wrote:
> > Chris,
> >
> > This is a fairly simple modification to francid.
> >
> > I don't have a Foundry handy to figure this out but the following steps
> > should get you there quickly.
> >
> > open francid with an editor and find the line that starts with
> > @commandtable
> > After this are the commands run on the switch followed by the name of
> > the subroutine that processes the output.
> >
> > Find the name of the subroutine that processes the output you want to
> > eliminate and modify that subroutine to skip the desired line.
> >
> > If my guesses are right, you will find the following line which
> > eliminates TEMPERATURE output but doesn't match on this specific switch:
> >
> >        if (/(POWERS|TEMPERATURE READINGS)/) {
> >
> > You can add 'temperature' to this line like:
> >
> > 	       if (/(POWERS|TEMPERATURE READINGS|temperature)/) {
> >
> > Or otherwise modify the subroutine to skip this output.
> >
> > Good luck,
> >
> > Mike
> >
> >  
> >
> > -----Original Message-----
> > From: rancid-discuss-bounces at shrubbery.net
> > [mailto:rancid-discuss-bounces at shrubbery.net] On Behalf Of Chris
> > Gauthier
> > Sent: Monday, January 07, 2008 11:33 AM
> > To: 'rancid-discuss at shrubbery.net'
> > Subject: [rancid] Eliminating two lines from foundry output
> >
> > Hello,
> >
> > I am a happy user of rancid for my Foundry switches (except the EdgeIron
> >
> > line, which needs support, but I haven't worked on that yet), but have 
> > become annoyed in the past weeks because I get an email nearly every 
> > time rancid checks one switch.  It is because it displays the temp.  
> > Here is the output:
> >
> > Index: configs/10.x.x.x
> > ===================================================================
> > retrieving revision 1.1031
> > diff -U4 -r1.1031 10.x.x.x
> > @@ -22,9 +22,9 @@
> >   ! 
> >   ! Fan 1 ok, speed (auto): 1<->2<->[[3]]
> >   ! Fan 2 ok, speed (auto): 1<->2<->[[3]]
> >   ! 
> > - ! Fan controlled temperature: 35.0 deg-C
> > + ! Fan controlled temperature: 35.5 deg-C
> >   ! 
> >   ! Fan speed switching temperature thresholds:
> >   ! 		Speed 1: NM<----->30                            deg-C
> >   ! 		Speed 2:       25<----->40                      deg-C
> >
> >
> > My problem is that I want to eliminate the "Fan controlled temperature 
> > lines" so I don't get an email every 1/2 hour (as I have rancid 
> > configured to poll).
> >
> > Any thoughts on how to do this?
> >
> > Thanks,
> >
> > Chris
> >
> >   
> 
> -- 
> Chris Gauthier, CCNA, Network+, A+
> Network Administration Team
> Portland Community College
> Portland, Oregon
> 
> "For once you have tasted flight you will walk the earth with your eyes turned skywards, for there you have been and there you will long to return."
> --Leonardo da Vinci
> 
> _______________________________________________
> 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