Hi there,
I am receiving SNMP traps through syslog that are as follows:
Trap 1
------
Nov 30 16:54:10 localhost snmptrapd(2271): 192.168.0.5:
Link Up Trap (0) Uptime: 3:14:25.28,
interfaces.ifTable.ifEntry.ifIndex.2 = 2,
interfaces.ifTable.ifEntry.ifDescr.2 = Ethernet1,
interfaces.ifTable.ifEntry.ifType.2 = ethernetCsmacd(6),
enterprises.9.2.2.1.1.20.2 = "up"
Trap 2
------
Nov 30 16:54:20 localhost snmptrapd(2271): 192.168.0.5:
Link Down Trap (0) Uptime: 3:14:30.90,
interfaces.ifTable.ifEntry.ifIndex.2 = 2,
interfaces.ifTable.ifEntry.ifDescr.2 = Ethernet1,
interfaces.ifTable.ifEntry.ifType.2 = ethernetCsmacd(6),
enterprises.9.2.2.1.1.20.2 = "administratively
down"
I have placed the information that I need into an array.
What I need to do is store subsequent traps into arrays and
compare them and act on certain conditions. For example,
if interface Ethernet1 is up and then receives a Link Down Trap,
the output should reflect the change. This is a
cumulative state that should be reflected in the output
message if the Ethernet1 shows Link Up Trap. All traps are
received in the syslog and the messages should continue to
output as long as syslog updates continue.
There are other IP Addresses and interfaces that need to
be tracked as well.
Here is an example of the three variables that I need, placed into an array:
IP Address: 192.168.0.5
Trap: Link Up Trap
Interface: Ethernet1
I would be grateful for any suggestions.
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.