I know there are a tremendous number of posts regarding traps>>>alerts which resolve similar scenarios, but I can't find one that fits mine. Traps from over 100 devices are all received from the same server (source IP). There is no OID that specifies the device, however, the device name is the last 6 characters of the OID value "enterprises.3263.2.1.1.2.1.10.2.3.4.5.6.7.8.9" (the red portion in this example): enterprises.3263.2.1.1.2.1.10.2.3.4.5.6.7.8.9 = DEV 2 SW TO BKUP SRC BUS 072 PPHINW
I follow the documented process of rules which tag the trap with varBind values, and color the trap with red for SET, and green for CLEAR. Examples of traps below:
TIME OF TRAP | IP ADDRESS | HOSTNAME | TRAP TYPE | TRAP DETAILS |
6/1/2017 12:52:12 PM | 10.7.1.102 | 10.7.1.102 | AM-MIB:enterprises.3263.2.1.2.0.6 | snmpTrapEnterprise = AM-MIB:enterprises.3263.2.1.2 experimental.1057.1.0 = 10.7.1.102 sysUpTime = 55 days 2 hours 15 minutes 38.85 seconds snmpTrapOID = AM-MIB:enterprises.3263.2.1.2.0.6 enterprises.3263.2.1.1.2.1.12.2.3.4.5.6.7.8.9 = 2017060116521100Z enterprises.3263.2.1.1.2.1.11.2.3.4.5.6.7.8.9 = 3 enterprises.3263.2.1.1.2.1.10.2.3.4.5.6.7.8.9 = DEV 2 SW TO BKUP SRC BUS 072 PPHINW enterprises.3263.2.1.1.2.1.9.2.3.4.5.6.7.8.9 = 1 enterprises.3263.2.1.1.2.1.8.2.3.4.5.6.7.8.9 = 54 enterprises.3263.2.1.1.2.1.7.2.3.4.5.6.7.8.9 = 21 enterprises.3263.2.1.1.2.1.6.2.3.4.5.6.7.8.9 = 54 enterprises.3263.2.1.1.2.1.5.2.3.4.5.6.7.8.9 = 21 enterprises.3263.2.1.1.2.1.4.2.3.4.5.6.7.8.9 = 99 enterprises.3263.2.1.1.2.1.3.2.3.4.5.6.7.8.9 = 1 enterprises.3263.2.1.1.2.1.2.2.3.4.5.6.7.8.9 = 2 enterprises.3263.2.1.1.2.1.1.2.3.4.5.6.7.8.9 = 2 |
6/1/2017 12:52:06 PM | 10.7.1.102 | 10.7.1.102 | AM-MIB:enterprises.3263.2.1.2.0.2 | snmpTrapEnterprise = AM-MIB:enterprises.3263.2.1.2 experimental.1057.1.0 = 10.7.1.102 sysUpTime = 55 days 2 hours 15 minutes 33.26 seconds snmpTrapOID = AM-MIB:enterprises.3263.2.1.2.0.2 enterprises.3263.2.1.1.2.1.12.2.3.4.5.6.7.8.9 = 2017060116520600Z enterprises.3263.2.1.1.2.1.11.2.3.4.5.6.7.8.9 = 3 enterprises.3263.2.1.1.2.1.10.2.3.4.5.6.7.8.9 = DEV 2 SW TO BKUP SRC BUS 072 PPHINW enterprises.3263.2.1.1.2.1.9.2.3.4.5.6.7.8.9 = 2 enterprises.3263.2.1.1.2.1.8.2.3.4.5.6.7.8.9 = 54 enterprises.3263.2.1.1.2.1.7.2.3.4.5.6.7.8.9 = 21 enterprises.3263.2.1.1.2.1.6.2.3.4.5.6.7.8.9 = 54 enterprises.3263.2.1.1.2.1.5.2.3.4.5.6.7.8.9 = 21 enterprises.3263.2.1.1.2.1.4.2.3.4.5.6.7.8.9 = 99 enterprises.3263.2.1.1.2.1.3.2.3.4.5.6.7.8.9 = 1 enterprises.3263.2.1.1.2.1.2.2.3.4.5.6.7.8.9 = 2 enterprises.3263.2.1.1.2.1.1.2.3.4.5.6.7.8.9 = 2 |
Trap Viewer:
SET Condition:
enterprises.3263.2.1.1.2.1.9.2.3.4.5.6.7.8.9 is equal to 2
Trigger Actions:
Color the Trap with: 8388863
Tag the Trap with: ${vbData9} | ${vbData12} | ${vbData10}
Stop Processing Trap Rules
CLEAR Condition:
enterprises.3263.2.1.1.2.1.9.2.3.4.5.6.7.8.9 is equal to 1
Clear Actions:
Color the Trap with: 8454016
Tag the Trap with: ${vbData9} | ${vbData12} | ${vbData10}
Stop Processing Trap Rules
Advanced Alert SQL queries:
Trigger Condition:
where nodeid in
(SELECT a.nodeid
FROM traps a with (nolock)
where colorcode=8388863 and acknowledged=0
and not exists ( select 1 from traps b where a.nodeid=b.nodeid and b.colorcode=8454016 and b.datetime>a.datetime)
)
Reset Condition:
where nodeid not in
(SELECT a.nodeid
FROM traps a with (nolock)
where colorcode=8388863 and acknowledged=0
and not exists ( select 1 from traps b where a.nodeid=b.nodeid and b.colorcode=8454016 and b.datetime>a.datetime)
)
The problem with the queries is that it uses 'nodeid' to match sets/clears. Since the 'nodeid' is always the same in my case, I'm getting inconsistent results.
What I would like to be able to do is somehow parse the name of the device (it's always the last 6 characters of the OID value "enterprises.3263.2.1.1.2.1.10.2.3.4.5.6.7.8.9 = DEV 2 SW TO BKUP SRC BUS 072 PPHINW
and include the device name in the query instead of the 'nodeid' Unfortunately, my SQL skills are not this advanced. Any help or suggestions is appreciated!