Condition to auto close these alerts

Hi Team,

We have a customized Windows Event log policy alert for which we don’t get the closed event, so due to required customization we need to auto close these alerts with below conditions;

 

Alert Event Name : Wireless Access Point goes down

 

Required Condition to auto close these alerts;

 

Close the alert if the “Received Time” (shown in attached screen shot) is more than 15 minutes from the current time.

Can someone please help us to achieve this. Apologies for the ignorance as I am  very new to OBM tool.

  • Suggested Answer

    0  

    You can use Administration > Event Processing > Automation > Time-Based Event Automation.  See the "Close Old Events" example.

    --
    If you found this post useful, give it a “Like” or click on "Verify Answer" under the "More" button

  • 0 in reply to   

    It has a option for Groovy script, but where can we get that script which will fulfil this requirement? I tried below script, but its not working

    import com.hp.ov.nms.*
    import java.text.SimpleDateFormat
    import java.util.concurrent.TimeUnit

    // Define the time threshold (15 minutes)
    def timeThreshold = 15 * 60 * 1000 // 15 minutes in milliseconds

    // Get the current time
    def currentTime = System.currentTimeMillis()

    // Define the date format for parsing the received time
    def dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")

    // Function to convert a date string to milliseconds
    def parseDateToMillis(String dateStr) {
    try {
    return dateFormat.parse(dateStr).getTime()
    } catch (ParseException e) {
    e.printStackTrace()
    return 0
    }
    }

    // Fetch all open events
    def openEvents = Event.getEvents([status: "Open"])

    openEvents.each { event ->
    def receivedTime = event.getReceivedTime()
    def receivedTimeMillis = parseDateToMillis(receivedTime)

    if (currentTime - receivedTimeMillis > timeThreshold) {
    // Close the event
    event.close("Automatically closed due to 15-minute inactivity")
    println("Event ${event.getId()} closed due to 15-minute inactivity.")
    }
    }

  • 0   in reply to 

    Hello,

    Looks like you are trying to import a NNMi package.

    If you need a groovy script to do this, there are a number at the Market Place (https://www.microfocus.com/marketplace/itom/category/all) where you might find one that might be a starting point.  Else, you may need to contact Opentext Professional Services or a Partner to write the script for you.  OBM is event driven, so you'll need something which looks at open events every minute or so, and checks if the event can be closed. 

    Sorry, I don't know/I hope you get a better answer.

    --
    If you found this post useful, give it a “Like” or click on "Verify Answer" under the "More" button