Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: Resizing MRTG (RRDTool) logs en-masse

by jwkrahn (Monsignor)
on Nov 30, 2010 at 02:23 UTC ( #874417=note: print w/replies, xml ) Need Help??


in reply to Re^2: Resizing MRTG (RRDTool) logs en-masse
in thread Resizing MRTG (RRDTool) logs en-masse

Also,  /.*rrd$/ will match both of the strings  "rrd" and  "rrd\n" so perhaps you should use  /.*rrd\z/ instead.

Or perhaps even:  'rrd' eq substr( $_, -3 )

Replies are listed 'Best First'.
Re^4: Resizing MRTG (RRDTool) logs en-masse
by McDarren (Abbot) on Nov 30, 2010 at 04:03 UTC
    It would be pretty unusual to have a file name that ends with \n, so I see that as an edge case that's probably not worth worrying about.

    It's probably better to have a check after the call to RRDs::info, so I've inserted:

    my $info = RRDs::info "$logsdir/$rrd"; # Check to ensure we actually have a valid rrd file unless ($info->{filename}) { print qq|"$logsdir/$rrd" doesn't appear to be a valid rrd log, + skipping\n|; next; }
    Which does the trick...
    $ touch foo.rrd $ ./rrd-resize.pl Starting, found 1 rrd files Processing foo.rrd "./foo.rrd" doesn't appear to be a valid rrd log, skipping Finished, processed 1 files in 0.00 seconds

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://874417]
help
Chatterbox?
[ambrus]: Corion: does building airports "somewhat outside of" a city ever work? cities always grow around the airport quickly, because it's practical to be close to it, and after that, people start to complain that the airplanes land so close to their house and sh
[ambrus]: ould keep down the noise

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2017-02-23 12:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (346 votes). Check out past polls.