How to use server side script to get impacted elements and root causes

  • 7006513
  • 27-Jul-2010
  • 26-Jun-2012

Environment

Business Service Manager 4.5
Business Service Manager 4.6
Business Service Manager 4.7

Situation

Impacted elements and root causes wanted via server side script.

Resolution

From an element or alarm.element, ImpactedInfo could be retrieved by: var impactedInfo = element.getImpactedInfo(session);
Class ImpactedInfo has impactedInfo.potentials which returns a String[] for all the parents and impactedInfo.potentialsIds which returns a int[][] for all the element IDs of each impacted path. You may use element.fromId(potentialsIds[i][j]) to get an element instance. impactedInfo.causes will return a RootCauseTree[] and from each RootCauseTree instance, the following are available: elementDName,elementName,elementID,reason,where,condition, and children, which is also a RootCauseTree[].
All the information can be seen from ShowImpacted popup via a server side script. Below is an example:
 
var impactedInfo = element.getImpactedInfo(session);
var causes = impactedInfo.causes;   //RootCauseTree[]
var str = "rootcauses:";
if (causes != null)
{
    for( i=0; i < causes.length; i++ )
    {
        str=str + "\n " + causes[i].elementDName
        +","+causes[i].reason
        +","+causes[i].where
        +","+causes[i].condition;
    }
}
session.sendMessage(str)