AnsweredAssumed Answered

Assignment to event.origin using LUA and PPR

Question asked by beard245 on Sep 5, 2013
Latest reply on Sep 5, 2013 by beard245

I have a simple script that I'm using to parse event.message and take that result and assign to event.origin. When testing the script in the editor it works fine, however, when I test with a PPR the assignment does not work.

 

Example:


Script: 

list = split ("event.message","-") 
if list ~= nil then 
event.origin = list[3] 
return event 
end 

Sample event message: 

EMC Smarts Trap - Customer ID: Company-ABCD001-AM-PM - Node: CARD-x.x.x.x/2 [143] - Alert Group: Card, Down - Event message: Indicates that a failed card is the root cause 

I want event.origin to equal 'ABCD001' in this case. 

In testing I was able to parse ABCD001 with the following script, however, it will not assign to event.origin 

Testing Script: 

list = split ("EMC Smarts Trap - Customer ID: Company-ABCD001-AM-PM - Node: CARD-x.x.x.x/2 [143] - Alert Group: Card, Down - Event message: Indicates that a failed card is the root cause.", "-") 

if list ~= nil then 
a=list[3] 
print(a) 
end 

Result = ABCD001

Also, I thought you could not update the origin or the origin still gets set be the hub after the PPR, but that is not the case as I tried this test script and it changed the origin value on the alarm with a PPR : 

event.origin = "ABCD001" 
return event

 

For some reason the assignment is not seeing the data as a string, and I'm not sure why. If anyone has suggestions it will be appreciated. 

Outcomes