public class SnmpInterfaceRrdMigratorOnline extends AbstractOnmsUpgrade
1.12 always add the MAC Address to the snmpinterface table if exist, which is different from the 1.10 behavior. For this reason, some interfaces are going to appear twice, and the data must be merged.
This tool requires that OpenNMS 1.12 is running for a while to be sure that all the MAC addresses have been updated, and the directories already exist.
Issues fixed:
AbstractOnmsUpgrade.VersionOperator
ZIP_EXT
Constructor and Description |
---|
SnmpInterfaceRrdMigratorOnline()
Instantiates a new SNMP interface RRD migrator online.
|
Modifier and Type | Method and Description |
---|---|
void |
execute()
Execute.
|
String |
getDescription()
Gets the description.
|
protected List<SnmpInterfaceUpgrade> |
getInterfacesToMerge()
Gets the interfaces to merge.
|
protected File |
getNodeDirectory(int nodeId,
String foreignSource,
String foreignId)
Gets the node directory.
|
int |
getOrder()
Gets the order.
|
protected void |
merge(File oldDir,
File newDir)
Merge.
|
protected void |
mergeJrb(File source,
File dest)
Merge JRBs.
|
protected void |
mergeRrd(File source,
File dest)
Merge RRDs.
|
void |
postExecute()
Post execute.
|
void |
preExecute()
Pre-execute
|
boolean |
requiresOnmsRunning()
Requires OpenNMS running.
|
void |
rollback()
Rollback.
|
getDbConnection, getFiles, getHomeDirectory, getId, getInstalledVersion, getMainProperties, getOpennmsProductDescription, getOpennmsProductName, getOpennmsVersion, getRrdExtension, getRrdProperties, getRrdStrategy, initializeDatasource, isInstalledVersion, isInstalledVersionGreaterOrEqual, isMeridian, isRrdToolEnabled, isStoreByForeignSourceEnabled, isStoreByGroupEnabled, loadProperties, log, printFullSettings, printMainSettings, registerProperties, setProductDescription, setProductName, setVersion, unzipFile, versionToInteger, zipDir, zipFile
public SnmpInterfaceRrdMigratorOnline() throws OnmsUpgradeException
OnmsUpgradeException
- the OpenNMS upgrade exceptionpublic int getOrder()
OnmsUpgrade
In order to execute all the implementations of this interface on a specify order, each implementation must return an integer for this purpose.
public String getDescription()
OnmsUpgrade
This is for informational purposes, and should contain a brief description about what is the purpose of this upgrade class.
public boolean requiresOnmsRunning()
OnmsUpgrade
public void preExecute() throws OnmsUpgradeException
OnmsUpgrade
Runs some checks to ensure that what it would execute() would work. If something is missing, an exception will be thrown
Execute backups of the JRBs/RRDs if they are going to be modified.
OnmsUpgradeException
- the OpenNMS upgrade exceptionpublic void postExecute() throws OnmsUpgradeException
OnmsUpgrade
Runs some clean up tasks after executing the execute() method. If something is wrong, an exception will be thrown
OnmsUpgradeException
- the OpenNMS upgrade exceptionpublic void rollback() throws OnmsUpgradeException
OnmsUpgrade
Restore the initial state of the OpenNMS files if something went wrong while running the execute() method.
Must restore the backups of the files if necessary.
OnmsUpgradeException
- the onms upgrade exceptionpublic void execute() throws OnmsUpgradeException
OnmsUpgrade
This is the main method, and this is the one where all the upgrade code must be placed.
OnmsUpgradeException
- the OpenNMS upgrade exceptionprotected List<SnmpInterfaceUpgrade> getInterfacesToMerge() throws OnmsUpgradeException
OnmsUpgradeException
- the OpenNMS upgrade exceptionprotected void merge(File oldDir, File newDir) throws Exception
oldDir
- the old directorynewDir
- the new directoryException
- the exceptionprotected void mergeRrd(File source, File dest) throws Exception
source
- the source RRDdest
- the destination RRDException
- the exceptionprotected void mergeJrb(File source, File dest) throws Exception
source
- the source JRBdest
- the destination JRBException
- the exceptionCopyright © 2021. All rights reserved.