Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE
prv_microfocus
Visitor.
225 views

need to create an EPI script, to change the value of the "Category" field in the alert

Hi All,

We have a requirement to change the "Category" value of the alert, when the alert reaches OMi.

We tried, by creating the EPI script, still it didnot work. Can some one provide us the groovy script which can be used for this requirement

Regards.

Praveen

0 Likes
3 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: need to create an EPI script, to change the value of the "Category" field in the alert

First of all, EPI scripts work with events, not alerts.

The OMi product documentation has an example EPI script that should help you: https://docs.microfocus.com/itom/Operations_Bridge_Manager:2018.11/OMi/ExtGuide/Groovy/Scripts-EPI It's much more sophisticated example than what you need, but should be enough for you as your requirement is pretty trivial.

Many more EPI scripts examples can be found on the ITOM Marketplace: https://marketplace.microfocus.com/ITOM/search?q=epi script

0 Likes
ramesh9 Acclaimed Contributor.
Acclaimed Contributor.

Re: need to create an EPI script, to change the value of the "Category" field in the alert

Not sure what groovy script you used, please try with below function in groovy script to set Category field,

void setCategory(String category)

0 Likes
Outstanding Contributor.. SahilGupta Outstanding Contributor..
Outstanding Contributor..

Re: need to create an EPI script, to change the value of the "Category" field in the alert

Hello Praveen,

This sshould suffice your need

1) Create desired event filter in OBM(ex. OMi)

2) Change the value of "Nag" with the category value you need

----------- Script start here-----------------

 

import com.hp.opr.api.scripting.Event;

class GroovyScriptSkeleton
{
def init()
{
}

def destroy()
{
}

def process(List<Event> events)
{

try
{

events.each {
event -> event.setCategory("Nag")

if(Thread.interrupted())
throw new InterruptedException()
}
}
catch(InterruptedException e)
{
return
}
}
}

 

--------------- Script end here--------------------

 

Regards,
Sahil Gupta

Regards,
Sahil Gupta
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.