Package org.opennms.netmgt.eventd
Class EventUtilDaoImpl
- java.lang.Object
-
- org.opennms.netmgt.eventd.AbstractEventUtil
-
- org.opennms.netmgt.eventd.EventUtilDaoImpl
-
- All Implemented Interfaces:
EventUtil
public class EventUtilDaoImpl extends AbstractEventUtil
-
-
Field Summary
-
Fields inherited from class org.opennms.netmgt.eventd.AbstractEventUtil
ASSET_BEGIN, ASSET_END_SUFFIX, ATTRIB_DELIM, HARDWARE_BEGIN, HARDWARE_END_SUFFIX, NAME_VAL_DELIM, NUM_PARMS_STR, PARM_BEGIN, PARM_BEGIN_LENGTH, PARM_END_SUFFIX, PARM_NAME_NUMBERED_PREFIX, PARM_NAME_NUMBERED_PREFIX_LENGTH, PARM_NUM_PREFIX, PARM_NUM_PREFIX_LENGTH, PARM_REGEX, PARMS_ALL, PARMS_NAMES, PARMS_VALUES, SPACE_DELIM, TAG_DESCR, TAG_DPNAME, TAG_EVENT_DB_ID, TAG_FOREIGNID, TAG_FOREIGNSOURCE, TAG_HOST, TAG_IFALIAS, TAG_IFINDEX, TAG_INTERFACE, TAG_INTERFACE_RESOLVE, TAG_LOGMSG, TAG_MOUSEOVERTEXT, TAG_NODEID, TAG_NODELABEL, TAG_NODELOCATION, TAG_OPERINSTR, TAG_PERCENT_SIGN, TAG_PRIMARY_INTERFACE_ADDRESS, TAG_SERVICE, TAG_SEVERITY, TAG_SHORT_TIME, TAG_SNMP, TAG_SNMP_COMMUNITY, TAG_SNMP_GENERIC, TAG_SNMP_ID, TAG_SNMP_IDTEXT, TAG_SNMP_SPECIFIC, TAG_SNMP_TRAP_OID, TAG_SNMP_VERSION, TAG_SNMPHOST, TAG_SOURCE, TAG_TIME, TAG_TTICKET_ID, TAG_UEI
-
-
Constructor Summary
Constructors Constructor Description EventUtilDaoImpl()
EventUtilDaoImpl(com.codahale.metrics.MetricRegistry registry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
expandParms(String inp, Event event)
Expand the value if it has 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[name]% is expanded to the value of the parameter named 'name' - %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 String
expandParms(String input, Event event, Map<String,Map<String,String>> decode)
Expand the value if it has 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[name]% is expanded to the value of the parameter named 'name' - %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 String
getAssetFieldValue(String parm, long nodeId)
Helper method.String
getForeignId(long nodeId)
Retrieve foreign id from the node table of the database given a particular nodeId.String
getForeignSource(long nodeId)
Retrieve foreign source from the node table of the database given a particular nodeId.String
getHardwareFieldValue(String parm, long nodeId)
String
getHostName(int nodeId, String hostip)
This method is used to convert the event host into a hostname id by performing a lookup in the database.String
getIfAlias(long nodeId, String ipaddr)
Retrieve ifAlias from the snmpinterface table of the database given a particular nodeId and ipAddr.String
getNodeLabel(long nodeId)
Retrieve nodeLabel from the node table of the database given a particular nodeId.String
getNodeLocation(long nodeId)
Retrieve nodeLocation from the node table of the database given a particular nodeId.String
getPrimaryInterface(long nodeId)
-
Methods inherited from class org.opennms.netmgt.eventd.AbstractEventUtil
decodeSnmpV2TcDateAndTime, escape, expandMapValues, getAllParamValues, getAllParmNames, getAllParmValues, getEventHost, getInstance, getNamedParmValue, getNumParmName, getNumParmValue, getResolver, setInstance, splitAndExtract
-
-
-
-
Method Detail
-
getNodeLabel
public String getNodeLabel(long nodeId)
Description copied from interface:EventUtil
Retrieve nodeLabel from the node table of the database given a particular nodeId.- Parameters:
nodeId
- Node identifier- Returns:
- nodeLabel Retreived nodeLabel
-
getPrimaryInterface
public String getPrimaryInterface(long nodeId)
-
getNodeLocation
public String getNodeLocation(long nodeId)
Description copied from interface:EventUtil
Retrieve nodeLocation from the node table of the database given a particular nodeId.- Parameters:
nodeId
- Node identifier- Returns:
- nodeLocation Retrieved nodeLocation
-
getForeignSource
public String getForeignSource(long nodeId)
Description copied from interface:EventUtil
Retrieve foreign source from the node table of the database given a particular nodeId.- Parameters:
nodeId
- Node identifier- Returns:
- foreignSource Retrieved foreign source
-
getForeignId
public String getForeignId(long nodeId)
Description copied from interface:EventUtil
Retrieve foreign id from the node table of the database given a particular nodeId.- Parameters:
nodeId
- Node identifier- Returns:
- foreignId Retrieved foreign id
-
getIfAlias
public String getIfAlias(long nodeId, String ipaddr)
Description copied from interface:EventUtil
Retrieve ifAlias from the snmpinterface table of the database given a particular nodeId and ipAddr.- Parameters:
nodeId
- Node identifieripaddr
- Interface IP address- Returns:
- ifAlias Retreived ifAlias
-
getAssetFieldValue
public String getAssetFieldValue(String parm, long nodeId)
Description copied from interface:EventUtil
Helper method.- Returns:
- The value of an asset field based on the nodeid of the event
-
getHostName
public String getHostName(int nodeId, String hostip)
This method is used to convert the event host into a hostname id by performing a lookup in the database. If the conversion is successful then the corresponding hostname will be returned to the caller.- Parameters:
nodeId
- Node IDhostip
- The event host- Returns:
- The hostname
-
expandParms
public String expandParms(String inp, Event event)
Description copied from class:AbstractEventUtil
Expand the value if it has 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[name]% is expanded to the value of the parameter named 'name' - %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 - Specified by:
expandParms
in interfaceEventUtil
- Overrides:
expandParms
in classAbstractEventUtil
- Parameters:
inp
- the input string in which parm values are to be expandedevent
- aEvent
object.- Returns:
- expanded value if the value had any parameter to expand, null otherwise
-
expandParms
public String expandParms(String input, Event event, Map<String,Map<String,String>> decode)
Description copied from class:AbstractEventUtil
Expand the value if it has 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[name]% is expanded to the value of the parameter named 'name' - %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 - Specified by:
expandParms
in interfaceEventUtil
- Overrides:
expandParms
in classAbstractEventUtil
- Parameters:
input
- the input string in which parm values are to be expandedevent
- aEvent
object.decode
- the varbind decode for this- Returns:
- expanded value if the value had any parameter to expand, null otherwise
-
-