in reply to Cut n' paste monkey on my back

off the cuff --

why read from a file and not just probe the devices directly? i would think that files would get out of date extremely quickly.

but i don't see a faster way of rewriting the lines in question.

Replies are listed 'Best First'.
RE: (2) Cut n' paste monkey on my back
by ybiC (Prior) on Nov 02, 2000 at 04:01 UTC
    Hmmm... guess I just hadn't got there yet.

    Think I follow you, though - have UCD-SNMP output to variable instead of intermediate file.   Bear with me here, would you use one scalar for the whole thing, or an array of one-line elements?   Highest portcount chassis in my environment is around 400, and 3 lines per port, so over 1000 lines o' info being scanned.

    ybiC smiles, as he continues to learn wonders of Perl...

      if you're already using UCD-SNMP ( how different is that from SNMP.pm off CPAN?? ), you can do the processing INSTEAD of printing out to the temp file.

      i'm taking a stab in the dark here, but if you're using SNMP to fetch data and write a file, then using another script to parse the file, you'd be better off doing the parsing IN the original 'fetch' script and eliminating the intermediate file.

      with a large environment, you'll probably need to think about run-time, how often the script is run, and consider using fork() for parallel processing. there is an asyncronous polling feature in SNMP.pm. it might help also.

        University of Californa at Davis SNMP includes command-line utilities, MIB queries by name, and a Tk/Perl MIB browser.   From a scripting standpoint, I understand that SNMP.pm combined with SNMP::MIB::Compiler does most of that as well.   Not clear on this, but if SNMP.pm and UCD-SNMP both installed, they might work together somehow.

        Actually, I was going to tack parsing onto existing collection script, and hadn't yet realized could skip the intermediate file.   Learning better ways to do it (like this) is a big part of my Monasterial compulsion.   {grin}   I'm always amazed to find that my long-pondered posts turn out to be asking the *wrong* question, yet I still come away with a revelation.
            cheers,
            Don
            striving for Perl Adept