public class SnmpTrapSink extends Object implements Destination
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
LOG
The Constant LOG.
|
static String |
MAPPINGS_DIRECTORY_NAME
The Constant MAPPINGS_DIRECTORY_NAME.
|
Constructor and Description |
---|
SnmpTrapSink() |
Modifier and Type | Method and Description |
---|---|
boolean |
accepts(NorthboundAlarm alarm)
Verifies if the sink accepts a given northbound alarm.
|
void |
addImportMapping(SnmpTrapMappingGroup mappingGroup)
Adds the import mapping.
|
void |
addMappingGroup(SnmpTrapMappingGroup mappingGroup)
Adds the mapping group.
|
void |
cleanMappingGroups()
Clean mapping groups.
|
SnmpTrapConfig |
createTrapConfig(NorthboundAlarm alarm)
Creates the SNMP trap configuration object.
|
String |
getCommunity()
Gets the community.
|
SnmpTrapMappingGroup |
getImportMapping(String mappingName)
Gets the import mapping.
|
List<String> |
getImportMappings()
Gets the import mappings.
|
String |
getIpAddress()
Gets the IP address.
|
File |
getMappingGroupFile(String mappingFileName)
Gets the mapping group file.
|
String |
getMappingGroupFileName(String mappingName)
Gets the mapping group file name.
|
List<SnmpTrapMappingGroup> |
getMappings()
Gets the mappings.
|
String |
getName()
Gets the destination name.
|
Integer |
getPort()
Gets the port.
|
String |
getV1AgentIpAddress()
Gets the v1 agent IP address.
|
SnmpVersion |
getVersion()
Gets the version.
|
boolean |
isFirstOccurrenceOnly()
Checks if is first occurrence only.
|
boolean |
removeImportMapping(String mappingName)
Removes the import mapping.
|
void |
setCommunity(String community)
Sets the community.
|
void |
setImportMappings(List<String> importMappings)
Sets the import mappings.
|
void |
setIpAddress(String ipAddress)
Sets the IP address.
|
void |
setMappings(List<SnmpTrapMappingGroup> mappings)
Sets the mappings.
|
void |
setName(String name)
Sets the name.
|
void |
setPort(int port)
Sets the port.
|
void |
setV1AgentIpAddress(String v1AgentIpAddress)
Sets the v1 agent IP address.
|
void |
setVersion(SnmpVersion version)
Sets the version.
|
public static final org.slf4j.Logger LOG
public static final String MAPPINGS_DIRECTORY_NAME
public boolean isFirstOccurrenceOnly()
Destination
isFirstOccurrenceOnly
in interface Destination
public String getName()
Destination
getName
in interface Destination
public String getIpAddress()
public Integer getPort()
public String getV1AgentIpAddress()
public SnmpVersion getVersion()
public String getCommunity()
public List<SnmpTrapMappingGroup> getMappings()
public List<String> getImportMappings()
public void setName(String name)
name
- the new namepublic void setIpAddress(String ipAddress)
ipAddress
- the new IP addresspublic void setPort(int port)
port
- the new portpublic void setV1AgentIpAddress(String v1AgentIpAddress)
v1AgentIpAddress
- the new v1 agent IP addresspublic void setVersion(SnmpVersion version)
version
- the new versionpublic void setCommunity(String community)
community
- the new communitypublic void setMappings(List<SnmpTrapMappingGroup> mappings)
mappings
- the new mappingspublic void setImportMappings(List<String> importMappings)
importMappings
- the new import mappingspublic void addMappingGroup(SnmpTrapMappingGroup mappingGroup)
If there is a mapping group with the same name, the existing one will be overridden.
mappingGroup
- the mapping grouppublic String getMappingGroupFileName(String mappingName)
mappingName
- the mapping namepublic File getMappingGroupFile(String mappingFileName)
mappingFileName
- the mapping file namepublic SnmpTrapMappingGroup getImportMapping(String mappingName) throws Exception
mappingName
- the mapping nameException
- the exceptionpublic void addImportMapping(SnmpTrapMappingGroup mappingGroup) throws Exception
mappingGroup
- the mapping groupfileName
- the file nameException
public boolean removeImportMapping(String mappingName)
mappingName
- the mapping namepublic boolean accepts(NorthboundAlarm alarm)
alarm
- the northbound alarmpublic SnmpTrapConfig createTrapConfig(NorthboundAlarm alarm) throws SnmpTrapException
alarm
- the northbound alarmSnmpTrapException
- the SNMP trap exceptionpublic void cleanMappingGroups()
This is intended to be used when saving the configuration on a file.
All the groups that currently exist on the mappings list and also on the import-mappings list will be removed from the mapping list to avoid duplicates.
Copyright © 2021. All rights reserved.