AnsweredAssumed Answered

Replace alarm message via LUA replacing it with only part of initial message

Question asked by dutchie on Oct 19, 2016
Latest reply on Oct 30, 2017 by rommel.salvacion

Hello,

 

I am receiving an alarm using the email2alarm probe and need to clean up the alarm message before it actually gets processed. I am trying to accomplish this via LUA script and preprocessing rule.

 

I only want in the portion staring from Details to "windowsize" to be part of the alarm message and drop the rest. Has somebody done something similar and if so can you share the syntax to do this? Thanks!

 

==

message:Hello,

 

You are assigned 1 triggered incident:

1) Incident #1
   Opened on: Oct 19 at 9:06 AM CDT
   Description: test01: Percentage CPU GreaterThan 1 undefined
   Details:
       resourceName: test01
       resourceId: /subscriptions/0000000/resourceGroups/US_IT/providers/Microsoft.Compute/virtualMachines/host
       resourceRegion: westus
       condition: {"metricName"=>"Percentage CPU", "metricValue"=>"18.3483333333333", "threshold"=>"1", "windowSize"=>"5", "timeAggregation"=>"Average", "operator"=>"GreaterThan"}
       resourceType: microsoft.compute/virtualmachines
       name: CPU Usage Percent

Outcomes