Class SnmpInterfaceRrdMigratorOnline
- java.lang.Object
-
- org.opennms.upgrade.api.AbstractOnmsUpgrade
-
- org.opennms.upgrade.implementations.SnmpInterfaceRrdMigratorOnline
-
- All Implemented Interfaces:
OnmsUpgrade
public class SnmpInterfaceRrdMigratorOnline extends AbstractOnmsUpgrade
The Class RRD/JRB Migrator for SNMP Interfaces Data (Online Version)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:
- NMS-6056
- Author:
- Alejandro Galue
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.opennms.upgrade.api.AbstractOnmsUpgrade
AbstractOnmsUpgrade.VersionOperator
-
-
Field Summary
-
Fields inherited from class org.opennms.upgrade.api.AbstractOnmsUpgrade
ZIP_EXT
-
-
Constructor Summary
Constructors Constructor Description SnmpInterfaceRrdMigratorOnline()
Instantiates a new SNMP interface RRD migrator online.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute()
Execute.java.lang.String
getDescription()
Gets the description.protected java.util.List<SnmpInterfaceUpgrade>
getInterfacesToMerge()
Gets the interfaces to merge.protected java.io.File
getNodeDirectory(int nodeId, java.lang.String foreignSource, java.lang.String foreignId)
Gets the node directory.int
getOrder()
Gets the order.protected void
merge(java.io.File oldDir, java.io.File newDir)
Merge.protected void
mergeJrb(java.io.File source, java.io.File dest)
Merge JRBs.protected void
mergeRrd(java.io.File source, java.io.File dest)
Merge RRDs.void
postExecute()
Post execute.void
preExecute()
Pre-executeboolean
requiresOnmsRunning()
Requires OpenNMS running.void
rollback()
Rollback.-
Methods inherited from class org.opennms.upgrade.api.AbstractOnmsUpgrade
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
-
-
-
-
Constructor Detail
-
SnmpInterfaceRrdMigratorOnline
public SnmpInterfaceRrdMigratorOnline() throws OnmsUpgradeException
Instantiates a new SNMP interface RRD migrator online.- Throws:
OnmsUpgradeException
- the OpenNMS upgrade exception
-
-
Method Detail
-
getOrder
public int getOrder()
Description copied from interface:OnmsUpgrade
Gets the order.In order to execute all the implementations of this interface on a specify order, each implementation must return an integer for this purpose.
- Returns:
- the order
-
getDescription
public java.lang.String getDescription()
Description copied from interface:OnmsUpgrade
Gets the description.This is for informational purposes, and should contain a brief description about what is the purpose of this upgrade class.
- Returns:
- the description
-
requiresOnmsRunning
public boolean requiresOnmsRunning()
Description copied from interface:OnmsUpgrade
Requires OpenNMS running.- Returns:
- true, if OpenNMS must be running to execute this upgrade or false if OpenNMS must be stopped.
-
preExecute
public void preExecute() throws OnmsUpgradeException
Description copied from interface:OnmsUpgrade
Pre-executeRuns 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.
- Throws:
OnmsUpgradeException
- the OpenNMS upgrade exception
-
postExecute
public void postExecute() throws OnmsUpgradeException
Description copied from interface:OnmsUpgrade
Post execute.Runs some clean up tasks after executing the execute() method. If something is wrong, an exception will be thrown
- Throws:
OnmsUpgradeException
- the OpenNMS upgrade exception
-
rollback
public void rollback() throws OnmsUpgradeException
Description copied from interface:OnmsUpgrade
Rollback.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.
- Throws:
OnmsUpgradeException
- the onms upgrade exception
-
execute
public void execute() throws OnmsUpgradeException
Description copied from interface:OnmsUpgrade
Execute.This is the main method, and this is the one where all the upgrade code must be placed.
- Throws:
OnmsUpgradeException
- the OpenNMS upgrade exception
-
getInterfacesToMerge
protected java.util.List<SnmpInterfaceUpgrade> getInterfacesToMerge() throws OnmsUpgradeException
Gets the interfaces to merge.- Returns:
- the list of interfaces to merge
- Throws:
OnmsUpgradeException
- the OpenNMS upgrade exception
-
merge
protected void merge(java.io.File oldDir, java.io.File newDir) throws java.lang.Exception
Merge.- Parameters:
oldDir
- the old directorynewDir
- the new directory- Throws:
java.lang.Exception
- the exception
-
mergeRrd
protected void mergeRrd(java.io.File source, java.io.File dest) throws java.lang.Exception
Merge RRDs.- Parameters:
source
- the source RRDdest
- the destination RRD- Throws:
java.lang.Exception
- the exception
-
mergeJrb
protected void mergeJrb(java.io.File source, java.io.File dest) throws java.lang.Exception
Merge JRBs.- Parameters:
source
- the source JRBdest
- the destination JRB- Throws:
java.lang.Exception
- the exception
-
getNodeDirectory
protected java.io.File getNodeDirectory(int nodeId, java.lang.String foreignSource, java.lang.String foreignId)
Gets the node directory.- Parameters:
nodeId
- the node idforeignSource
- the foreign sourceforeignId
- the foreign id- Returns:
- the node directory
-
-