i already contacted Insight support about my demand, they said i need to do it by Groovy Script :
I have an object type called "Servers". All server are automatically added using the discovery. An specific Attribute for each object called FQDN, it's simply the full name of the servers. Exemple : AFDAOS.fr***.int.
To monitore our server, we using Centreon (based on nagios), when we have a critical alert, an email is sent to mailbox Jira who create the issue. The subject of the mail is our summary. Exemple : ** PROBLEM alert - AFDAOS.f***.int/AX TEST Service is CRITICAL **.
The result expected : Assign automatically the good server depending of the summary. In this case, the system need to found the part "AFDAOS.fr***.int" inside the summary and automatically assign it to this object inside a specific custom field insight. We already try (we Mindville support ) to do it using IQL but it's not working with the LIKE command.
I never use Groovy script and i don"t have any idea how to start to do it. It doesn't seem too complicated but i need help to start.
Thank you !
Hello... I'm learned Groovy (as much as i can) and i'm almost the result i want !
Here my code :
Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade");
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass);
Class iqlFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.IQLFacade");
def iqlFacade = ComponentAccessor.getOSGiComponentInstanceOfType(iqlFacadeClass);
def objects = iqlFacade.findObjectsByIQLAndSchema(10,"objectTypeId = 2443");
//def test = "AF-172738"
//def ObjectInsightBean = objectFacade.loadObjectBean(test)
//log.warn("ObjectInsightBean " + ObjectInsightBean)
def n = 0
CurrentObject = objects[n]
def FQDNValue = objectFacade.loadObjectAttributeBean(CurrentObject.getId(),47464).getObjectAttributeValueBeans(); //Load Attribute Value
log.warn("Server " + objects[n])
//log.warn("FQDNValue " + FQDNValue)
//FQDNValueSTR = FQDNValue.ToString()
log.warn("FQDNValue " + FQDNValue)
result = (issue.getSummary().contains(FQDNValue))
log.warn("result " + result)
The output is :
2020-06-29 16:45:28,650 [http-nio-8080-exec-17] | Server AFAW16-FS01 (AF-173140)
2020-06-29 16:45:28,650 [http-nio-8080-exec-17] | FQDNValue [2629351(AFAW16-FS01.francois.int)]
I have the following error :
GroovyInsightException: No signature of method: java.lang.String.contains() is applicable for argument types: (com.riadalabs.jira.plugins.insight.services.model.ObjectAttributeValueBean) values: [[2629351(AFAW16-FS01.francois.int)]] Possible solutions: contains(java.lang.CharSequence), contains(java.lang.CharSequence), toString(), toString(), toString(), notify()'
The problem is i want use the contain in (issue.getSummary().contains(FQDNValue)), FQDNValue have the good value but seems not be string value. It's [2629351(AFAW16-FS01.xxxx.int) (what's the 2629351 value?? I just want compare the AFAW16-FS01.xxxx.int .
Have i to import a specific plugin, use another syntax? I tried FQDNValueSTR = FQDNValue.ToString() but it's not working....
Thank you !!
Atlassian's marketplace partners have had a very productive start to 2021! Since our last roundup, our developer community has added over 160 new cloud apps to the Atlassian Marketplace to help you...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events