I sure can. Don't laugh too hard, I'm fairly new at this and I kind of sort of "inherited" this from my predecessor who ha moved on to greener pastures.
#!/usr/local/bin/perl # node_down.pl # Called from the OV_Node_Down event use File::Basename; require "/opt/ov_action_scripts/send_trap.pl"; $ENV{'PATH'} = '/usr/sbin:/usr/bin:/usr/ucb:/usr/local/bin:/opt/OV/bin +'; $argv0 = basename($0); ($sn) = ($argv0 =~ /(\w+)\./); $date = $ARGV[0]; $time = $ARGV[1]; $device = $ARGV[2]; $LOGFILE = "/opt/ov_action_scripts/logs/$sn.log"; $COREFILE = "/opt/ov_action_scripts/core_dev_list"; $INTERFACE = "/opt/ov_action_scripts/interface_dev_list"; $match = 0; # # See if device is in the core device list # open(CF, $COREFILE) || die "Can't open $COREFILE for read: $!\n"; while (<CF>) { $match = 1 if (/^$device/); } close(CF); open(CF, $INTERFACE) || die "Can't open $COREFILE for read: $!\n"; while (<CF>) { $match = 2 if (/^$interface/); } close(CF); snmpget $device .1.3.6.1.2.1.2.2.1.2.$interface if ($match) { ($shortname) = ($device =~ /^\d+\./ $interface =~ /^\d+\./) ? $dev +ice : ($device =~ /^(\w+)/); $summary = "$shortname Down"; $descr = "Node Down"; $intfc = "Interface Name"; # Forward trap to the Common Event Path by sending another trap # to the host # Trap args: # Event Source Device # Short Description (Summary) Device Down # Description Node Down # TrapData1 NODE_DOWN $rc = sendtrap("$device", "$summary", "$descr", $intfc" "NODE_DOWN +"); $ti = ($rc) ? "Trap NOT forwarded" : "Trap forwarded"; # Log it open(LF, ">>$LOGFILE") || die "Can't open $LOGFILE for write: $!\n +"; print LF "$date: $time: $device down ($ti)\n"; close(LF); }


In reply to Re^2: NNM Nonsense by Perl_Pursuer
in thread NNM Nonsense by Perl_Pursuer

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.