in reply to RE: Cut n' paste monkey on my back
in thread Cut n' paste monkey on my back

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...

Replies are listed 'Best First'.
RE: RE: (2) Cut n' paste monkey on my back
by geektron (Curate) on Nov 02, 2000 at 05:43 UTC
    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

        There are a variety of SNMP modules available for perl. I use the same combo you do, and it has full access to the ucd-snmp library calls. Given the motivation, you can easily rewrite all the utilities that cam with the SNMP library in perl.

        I have written a script much like what you, ybic. Message me with an email address and I will send you some of the interesting snippets where I gather the same kind of data. Not that my code is anything marvelous, but it sometimes helps seeing what other people have done. Sorry, I am concerned that certain NDAs and copyrights prevent me from slamming the entire thing into the Catacombs.

        mikfire