Class EventExpander
- java.lang.Object
-
- org.opennms.netmgt.eventd.EventExpander
-
- All Implemented Interfaces:
EventExpander
,EventProcessor
,org.springframework.beans.factory.InitializingBean
public final class EventExpander extends java.lang.Object implements EventExpander, EventProcessor, org.springframework.beans.factory.InitializingBean
This class is responsible for looking up the matching eventconf 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
-
-
Constructor Summary
Constructors Constructor Description EventExpander(com.codahale.metrics.MetricRegistry registry)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
afterPropertiesSetvoid
expandEvent(Event e)
This method is invoked to check and configure a received event.EventConfDao
getEventConfDao()
getEventConfDaostatic Event
lookup(EventConfDao dao, Event event)
This method is used to lookup the event configuration object based upon information in the passed information.void
process(Log eventLog)
void
process(Log eventLog, boolean synchronous)
Event expansion is always synchronous so this method just delegates toprocess(Log)
.void
setEventConfDao(EventConfDao eventConfDao)
setEventConfDaovoid
setEventUtil(EventUtil eventUtil)
-
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet()
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
lookup
public static Event lookup(EventConfDao dao, Event event)
This method is used to lookup the event configuration object based upon information in the passed information. The
EventConfDao
instance is consulted to find a matching configured event. The lookup algorithm favors SNMP information if available, and then defaults to the event's Universal Event Identifier.- 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.
-
expandEvent
public 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 incoming event are cleared during expansion.
- Specified by:
expandEvent
in interfaceEventExpander
- Parameters:
e
- The event to expand if necessary.
-
process
public void process(Log eventLog, boolean synchronous) throws EventProcessorException
Event expansion is always synchronous so this method just delegates toprocess(Log)
.- Specified by:
process
in interfaceEventProcessor
- Throws:
EventProcessorException
-
process
public void process(Log eventLog) throws EventProcessorException
- Specified by:
process
in interfaceEventProcessor
- Throws:
EventProcessorException
-
getEventConfDao
public EventConfDao getEventConfDao()
getEventConfDao
- Returns:
- a
EventConfDao
object.
-
setEventConfDao
public void setEventConfDao(EventConfDao eventConfDao)
setEventConfDao
- Specified by:
setEventConfDao
in interfaceEventExpander
- Parameters:
eventConfDao
- aEventConfDao
object.
-
setEventUtil
public void setEventUtil(EventUtil eventUtil)
-
-