I would start with something like this. It only checks for "Value On" 
(case-insensitive) in the message. You could add another IF statement to 
specifically look for "Off" too if that's important, rather than just 
generating the 0xfff000c1 event if there's no match in the IF statement.

Disclaimer: I put it together quickly and it's not tested but should be OK as a 
starting point.

0xfff000a0 P " \
  SetVariable({V eventmsg}, ToString(GetEventVariable({U 0x12a63})), \
    If(Regexp({V eventmsg},{S \".*?[Vv]alue\\\\s+[Oo][Nn].*\"}), \
      CreateEventWithVariables({C CURRENT_MODEL}, {H 0xfff000b1}, \
        SetEventVariable(GetEventVariableList(), {H 0x12b4c}, {S \"Alarm title 
goes here...\"}) \
      ), \
      CreateEventWithVariables({C CURRENT_MODEL}, {H 0xfff000c1}, \
        SetEventVariable(GetEventVariableList(), {H 0x12b4c}, {S \"Alarm title 
goes here...\"}) \
      ) \
    ) \
  )"

Craig Porter, Enterprise Systems Management - Availability & Performance 
Monitoring
Marsh & McLennan Companies
Global Technology Infrastructure (MGTI) | Centralized Operations
Sackville House 1.6, 143-149 Fenchurch Street, London EC3M 6BN, Great Britain
+44 (0)20 7178 4827 | Mobile +44 (0)7585 803 093 | 
[email protected]<mailto:[email protected]>
www.mmc.com<http://www.mmc.com/>

From: Pretorius, Vynita [mailto:[email protected]]
Sent: 15 September 2015 13:13
To: spectrum
Subject: [spectrum] splitting an oid into multiple variables in an event

Hi All

Assistance required please.

I need help to break up the third variable of an incoming trap (event) as it 
contains the eventmsg, event condition and date and time (0x12a63,0)
Below is a sample of a trap that I am receiving.
However the event condition is based on the 3rd Variable whether it is on 
(critical) or off (clear)
The Critical gets set, however I think due to the eventmsg changing it never 
clears

Critical event
snmptrap -v 1 -c public 10.10.77.77 1.3.6.1.4.1.4399 10.11.12.13 6 0 "" \
1.3.6.1.2.1.1.1.3.0 s "12456" \
1.3.6.1.6.3.1.1.4.1.0 o 1.3.6.1.4.1.4399.0 \
1.3.6.1.4.1.4399.0 s "2014-09-15 08:40 test abcd is testing Critical Value On 
someone is sending"

Clear Event
snmptrap -v 1 -c public 172.20.10.249 1.3.6.1.4.1.4399 10.114.78.11 6 0 "" \
1.3.6.1.2.1.1.1.3.0 s "124534" \
1.3.6.1.6.3.1.1.4.1.0 o 1.3.6.1.4.1.4399.0 \
1.3.6.1.4.1.4399.0 s "2014-09-15 08:40 test abcd is testing Critical Value Off 
someone is sending"

1.3.6.1.4.1.4399.6.0   0xfff000a0       1.3.6.1.2.1.1.1.3.0(501,0)\
                                        1.3.6.1.6.3.1.1.4.1.0(502,0)\
                                        1.3.6.1.4.1.4399.0(0x12a63,0)

    Event Condition            If event 0xfff000a0 occurs,
if (regexp({v 76387} {S Value On})) evaluates to TRUE, then generate 0xfff000b1.
else (regexp({v 76387} {S Normal})) evaluates to TRUE, then generate 0xfff000c1


Thanks
Vynita Pretorius
0828560321

To read FirstRand Bank's Disclaimer for this email click on the following 
address or copy into your Internet browser:
https://www.fnb.co.za/disclaimer.html



If you are unable to access the Disclaimer, send a blank e-mail to 
[email protected]<mailto:[email protected]> and 
we will send you a copy of the Disclaimer.

 *   --To unsubscribe from spectrum, send email to 
[email protected]<mailto:[email protected]> with the body: unsubscribe spectrum 
[email protected]<mailto:[email protected]>

________________________________

The Insurance Act 2015 - Are you prepared? Check our website, uk.marsh.com, or 
ask your Marsh contact for further details.

Marsh Ltd. Registered in England and Wales Number: 1507274
Registered office 1 Tower Place West, Tower Place, London, EC3R 5BU.

Marsh Ltd is authorised and regulated by the Financial Conduct Authority.

This message and any attachments are confidential.
If you have received this message in error please delete it from your system.
If you require any assistance please notify the sender. Thank you.

---
To unsubscribe from spectrum, send email to [email protected] with the body: 
unsubscribe spectrum [email protected]

Reply via email to