OpenNMS API 1.2.3

org.opennms.netmgt.eventd
Class EventExpander

java.lang.Object
  extended byorg.opennms.netmgt.eventd.EventExpander

public final class EventExpander
extends java.lang.Object

This class is responsible for looking up the matching evenconf entry for an event and loading info from the eventconf match to the event. This class is also responsible for the event parm expansion

Notes on event parm expansion:

The list of elements that can have a %element% or %parms[*]% in their value are : descr, logmsg, operinstr, autoaction, operaction(/menu), tticket

The list of elements that can occur as a %element% are : uei, source, nodeid, time, host, interface, snmphost, service, snmp, id, idtext, version, specific, generic, community, severity, operinstr, mouseovertext, parm[values-all], parm[names-all], parm[all], parm[ ], parm[##], parm[# ]

 
  Expansions are made so that 
  - %element% is replaced by the value of the element
    -i.e a 'xxx %uei%'  would expand to 'xxx <eventuei>'
  - %parm[values-all]% is replaced by a space-separated list of all parm values
    -i.e a 'xxx %parm[values-all]%'  would expand to 'xxx parmVal1 parmVal2 ..'
  - %parm[names-all]% is replaced by a space-separated list of all parm names 
    -i.e a 'xxx %parm[names-all]%'  would expand to 'xxx parmName1 parmName2 ..'
  - %parm[all]% is replaced by a space-separated list of all parmName="parmValue"
     -i.e a 'xxx %parm[all]%'  would expand to 'xxx parmName1="parmVal1" parmName2="parmVal2" ..'
  - %parm[<name>]% is replaced by the value of the parameter named 'name', if present
  - %parm[#<num>]% is replaced by the value of the parameter number 'num', if present
  - %parm[##]% is replaced by the number of parameters 
  
 

Author:
Brian Weaver , Sowmya Nataraj , OpenNMS

Field Summary
private static java.lang.String DEFAULT_EVENT_UEI
          The default event UEI - if the event lookup into the 'event.conf' fails, the event is loaded with information from this default UEI
private static java.lang.String DEFAULT_TRAP_UEI
          The default trap UEI - if the trap lookup into the 'event.conf' fails, the trap event is loaded with information from this default UEI
private static java.lang.String ENTERPRISE_PRE
          The enterprise ID prefix - incoming events and the events in event.conf can have EIDs that have the partial EIDs as in '18.1.1.6' instead of '.1.3.6.1.4.1.18.1.1.6'.
private static java.lang.String[] GENERIC_SNMP_UEIS
          This is the list of Universal Event Identifiers (UEIs) that map to the generic types in a SNMPv1 trap.
 
Constructor Summary
private EventExpander()
          private constructor
 
Method Summary
static void expandEvent(Event e)
           This method is invoked to check and configure a received event.
private static void expandParms(Autoaction[] autoactions, Event event)
          Expand parms in the event autoaction(s)
private static void expandParms(Event event)
          Expand the element values if they have parms in one of the following formats - %element% values are expanded to have the value of the element where 'element' is an element in the event DTD - %parm[values-all]% is expanded to a delimited list of all parmblock values - %parm[names-all]% is expanded to a list of all parm names - %parm[all]% is expanded to a full dump of all parmblocks - %parm[ ]% is replaced by the value of the parameter named 'name', if present - %parm[# ]% is replaced by the value of the parameter number 'num', if present - %parm[##]% is replaced by the number of parameters
private static void expandParms(Logmsg logmsg, Event event)
          Expand parms in the event logmsg
private static void expandParms(Operaction[] operactions, Event event)
          Expand parms in the event operaction(s)
private static void expandParms(Tticket tticket, Event event)
          Expand parms in the event tticket
private static Event lookup(Event event)
           This method is used to lookup the event configuration object based upon information in the passed information.
private static Event lookup(Snmp snmpInfo)
           This method is used to find the matching event configuration object by looking at the event's SNMP information.
private static Autoacknowledge transform(Autoacknowledge src)
          This method is used to transform an auto acknowledgement event configuration instance into an auto acknowledgement event instance.
private static Autoaction transform(Autoaction src)
          This method is used to transform an auto action event configuration instance into an auto action event instance.
private static Correlation transform(Correlation src)
          This method is used to transform a correlation event configuration instance into a correlation event instance.
private static Forward transform(Forward src)
          This method is used to transform a forward event configuration instance into a forward event instance.
private static Logmsg transform(Logmsg src)
          This method is used to transform a log message event configuration instance into a log message event instance.
private static Mask transform(Mask src)
          This method is used to transform an event configuration mask instance into an event mask instance.
private static Operaction transform(Operaction src)
          This method is used to transform an operator action event configuration instance into an operator action event instance.
private static Script transform(Script src)
          This method is used to transform a script event configuration instance into a script event instance.
private static Snmp transform(Snmp src)
          This method is used to transform an SNMP event configuration instance into an SNMP event instance.
private static Tticket transform(Tticket src)
          This method is used to transform a trouble ticket event configuration instance into a trouble ticket event instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENTERPRISE_PRE

private static final java.lang.String ENTERPRISE_PRE
The enterprise ID prefix - incoming events and the events in event.conf can have EIDs that have the partial EIDs as in '18.1.1.6' instead of '.1.3.6.1.4.1.18.1.1.6'. When a event lookup is done based on the EID, a lookup with both the partial and the full EID is done

See Also:
Constant Field Values

DEFAULT_EVENT_UEI

private static final java.lang.String DEFAULT_EVENT_UEI
The default event UEI - if the event lookup into the 'event.conf' fails, the event is loaded with information from this default UEI

See Also:
Constant Field Values

DEFAULT_TRAP_UEI

private static final java.lang.String DEFAULT_TRAP_UEI
The default trap UEI - if the trap lookup into the 'event.conf' fails, the trap event is loaded with information from this default UEI

See Also:
Constant Field Values

GENERIC_SNMP_UEIS

private static final java.lang.String[] GENERIC_SNMP_UEIS
This is the list of Universal Event Identifiers (UEIs) that map to the generic types in a SNMPv1 trap. These are not relevant to a SNMPv2c trap.

Constructor Detail

EventExpander

private EventExpander()
private constructor

Method Detail

transform

private static Mask transform(Mask src)
This method is used to transform an event configuration mask instance into an event mask instance. This is used when the incomming event does not have a mask and the information from the configuration object is copied.

Parameters:
src - The configuration source to transform.
Returns:
The transformed mask information.

transform

private static Snmp transform(Snmp src)
This method is used to transform an SNMP event configuration instance into an SNMP event instance. This is used when the incomming event does not have any SNMP information and the information from the configuration object is copied.

Parameters:
src - The configuration source to transform.
Returns:
The transformed SNMP information.

transform

private static Logmsg transform(Logmsg src)
This method is used to transform a log message event configuration instance into a log message event instance. This is used when the incomming event does not have any log message information and the information from the configuration object is copied.

Parameters:
src - The configuration source to transform.
Returns:
The transformed log message information.

transform

private static Correlation transform(Correlation src)
This method is used to transform a correlation event configuration instance into a correlation event instance. This is used when the incomming event does not have any correlation information and the information from the configuration object is copied.

Parameters:
src - The configuration source to transform.
Returns:
The transformed correlation information.

transform

private static Autoaction transform(Autoaction src)
This method is used to transform an auto action event configuration instance into an auto action event instance. This is used when the incomming event does not have any auto action information and the information from the configuration object is copied.

Parameters:
src - The configuration source to transform.
Returns:
The transformed auto action information.

transform

private static Operaction transform(Operaction src)
This method is used to transform an operator action event configuration instance into an operator action event instance. This is used when the incomming event does not have any operator action information and the information from the configuration object is copied.

Parameters:
src - The configuration source to transform.
Returns:
The transformed operator action information.

transform

private static Autoacknowledge transform(Autoacknowledge src)
This method is used to transform an auto acknowledgement event configuration instance into an auto acknowledgement event instance. This is used when the incomming event does not have any auto acknowledgement information and the information from the configuration object is copied.

Parameters:
src - The configuration source to transform.
Returns:
The transformed auto acknowledgement information.

transform

private static Tticket transform(Tticket src)
This method is used to transform a trouble ticket event configuration instance into a trouble ticket event instance. This is used when the incomming event does not have any trouble ticket information and the information from the configuration object is copied.

Parameters:
src - The configuration source to transform.
Returns:
The transformed trouble ticket information.

transform

private static Forward transform(Forward src)
This method is used to transform a forward event configuration instance into a forward event instance. This is used when the incomming event does not have any forward information and the information from the configuration object is copied.

Parameters:
src - The configuration source to transform.
Returns:
The transformed forward information.

transform

private static Script transform(Script src)
This method is used to transform a script event configuration instance into a script event instance. This is used when the incoming event does not have any script information and the information from the configuration object is copied.

Parameters:
src - The configuration source to transform.
Returns:
The transformed script information.

lookup

private static Event lookup(Snmp snmpInfo)

This method is used to find the matching event configuration object by looking at the event's SNMP information. In particular, the SNMP Enterprise Identifier is used first if it exist to find the matching record. If the enterprise identifier exists then it is compared as is, if that doesn't match then the enterprise prefix is stripped and the lookup is preformed again.

If the enterprise identifier is not found, but the event has generic and specific information then the appropriate generic UEI is used to find the appropriate record.

Parameters:
snmpInfo - The SNMP event information.
Returns:
The matching event configuration object if found. A null reference is returned if no match can be found.
Throws:
java.lang.NullPointerException - Thrown if the snmpInfo parameter that was passed is null.

lookup

private static Event lookup(Event event)

This method is used to lookup the event configuration object based upon information in the passed information. The EventConfigurationManagerinstance is consulted to find a matching configured event. The lookup algorithm favors SNMP information if avaialable, and then defaults to the event's Universal Event Identfier.

Parameters:
event - The event to find a configuration for.
Returns:
The matching configuration event, if any.
Throws:
java.lang.NullPointerException - Thrown if the event parameter that was passed is null.

expandParms

private static void expandParms(Logmsg logmsg,
                                Event event)
Expand parms in the event logmsg


expandParms

private static void expandParms(Autoaction[] autoactions,
                                Event event)
Expand parms in the event autoaction(s)


expandParms

private static void expandParms(Operaction[] operactions,
                                Event event)
Expand parms in the event operaction(s)


expandParms

private static void expandParms(Tticket tticket,
                                Event event)
Expand parms in the event tticket


expandParms

private static void expandParms(Event event)
Expand the element values if they have parms in one of the following formats - %element% values are expanded to have the value of the element where 'element' is an element in the event DTD - %parm[values-all]% is expanded to a delimited list of all parmblock values - %parm[names-all]% is expanded to a list of all parm names - %parm[all]% is expanded to a full dump of all parmblocks - %parm[ ]% is replaced by the value of the parameter named 'name', if present - %parm[# ]% is replaced by the value of the parameter number 'num', if present - %parm[##]% is replaced by the number of parameters


expandEvent

public static void expandEvent(Event e)

This method is invoked to check and configure a received event. The event configuration manager is consulted to find the appropriate configuration that is used to expand the event. In addition, the security parameters from the configuration manager is consulted to ensure that secure files are cleared out if necessary.

Any secure fields that exists in the incomming event are cleared during expansion.

Parameters:
e - The event to expand if necesary.

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.