I will post up my script later, but as a general question.
i have a log that i am tailing using file::tail, that takes line by line and sorts the data into certain queues which are just values then based on them values generates a snmp trap and sends the data off to a server which takes care of that side.
The problem is that randomly there will be an error generated.
FATAL: select() error [] at /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/Net/SNMP/Dispatcher.pm line 635.
i am in the process now of putting debugging into the script so that i may see the output and that before it dies.
origannly i thought this was due to the tail missing lines and then passing bad data into the trap, i have since tweaked the tail to be more stable but i would like to eradicate this for good.
but as a general question what sort of things should i be looking at, or things that could help?. i will post up parts of the script soon. :)
Cheers
ADDED
my( $session, $error );
( $session, $error ) = Net::SNMP->session(
-hostname=>'1.1.1.1',
-community=>'silly',
-port=>162 );
if( length( $session->error())) {
print "Session Error $session->error()\n";
return;
}
my( $result );
$result = $session->trap( -enterprise=>'.3.1.4.1.5',
-specifictrap=>1000,
-varbindlist=>['.3.1.4.1.5', UNSIGNED32, $resu
+lt{1},
'.3.1.4.1.5', UNSIGNED32, $resu
+lt{2},
'.3.1.4.1.5', UNSIGNED32, $resu
+lt{3},
'.3.1.4.1.5', UNSIGNED32, $resu
+lt{4},
'.3.1.4.1.5', UNSIGNED32, $resu
+lt{5},
'.3.1.4.1.5', UNSIGNED32, $resu
+lt{6},
'.3.1.4.1.5', UNSIGNED32, $resu
+lt{7},
'.3.1.4.1.5', UNSIGNED32, $resu
+lt{8} ]
);
if (!defined($result)) {
printf ("SCript error: %s.\n", $session->error);
$session->close;
return;
}
$result = $session->trap( -enterprise=>'.1.3.6.1.3.42',
-specifictrap=>999,
-varbindlist=>['.3.1.4.1.5', UNSIGNED32, $resu
+lt{9},
'.3.1.4.1.5', UNSIGNED32, $resu
+lt{10}]
);
if (!defined($result)) {
printf("ERROR: %s.\n", $session->error);
$session->close;
return;
}
$session->close();
}
this has been changed so normally the values are unique and all that :P
That is how the snmp traps are generated.. and i cant seem to put a finger on why the dispatcher module throws an error
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.