|
AdventNet Web NMS 4 API Specification | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
TrapAPI deals with configuration of Trap filters as well as Trap parsers. It also has necessary methods to enable and disable Trap filters and parsers. It has methods for saving and retriving Trap parsers and filters from flat files. It also deals with registering and deregistering of Trap listeners.
The following code snippet can be used to get TrapAPI handle in secured and authenticated mode through RMI. In this mode, NMS needs userName and password to provide the API handle.
try
{
RMIAccessAPI rmiapi = (RMIAccessAPI)Naming.lookup("//hostName/RMIAccessAPI");
TrapAPI api = (TrapAPI)rmiapi.getAPI("userName","password","TrapAPI");
}
catch(Exception ee)
{
System.out.println("Error in getting TrapAPI handle");
ee.printStackTrace();
}
The following code snippet can be used to get TrapAPI handle through RMI, without RMI security mechanism of NMS.
try
{
TrapAPI api = (TrapAPI)Naming.lookup("//hostName/TrapAPI");
}
catch(Exception ee)
{
System.out.println("Error in getting TrapAPI handle");
ee.printStackTrace();
}
For the same JVM as that of WebNMS server, com.adventnet.nms.NmsUtil#getAPI(String)
can be used to get TrapAPI handle.
TrapParser,
TrapFilter,
TrapFilterHolder,
SocketListener,
RMIAccessAPI| Field Summary | |
static int |
VERSION_1
Constant for Snmp v1 traps. |
static int |
VERSION_2C
Constant for Snmpv2c traps. |
| Method Summary | |
boolean |
deleteAllTrapFilters()
To delete all the Trap Filters configured in the server. |
boolean |
deleteAllTrapParsers()
To delete all the Trap Parsers configured in the server. |
boolean |
deleteTrapParsers(java.lang.String[] names)
To delete a set of Trap parsers, whose names are given in String[]. |
void |
deRegister(SocketListener trapListener)
To deregister the given TrapListener from Trap notification for all registered ports. |
void |
deRegisterForTrap(int port,
SocketListener trapListener)
To deregister TrapListener from notification for Traps on particular port. |
void |
deRegisterForTraps(int[] portArray)
To deregister from getting notified by NMS for Traps on multiple ports to which the NMS is registered. |
void |
deRegisterForTraps(int[] portArray,
SocketListener trapListener)
To deregister from getting notified by NMS for Traps on multiple ports. |
boolean |
disableTrapsForGroups(java.lang.String[] groups,
boolean deleteOldGroups)
To disable traps for a set of groups i.e. |
boolean |
disableTrapsForNodes(java.lang.String[] nodes,
boolean deleteOldNodes)
To disable traps for a set of nodes i.e. |
void |
enableFilters(java.lang.String[] filterNames,
boolean bool)
To enable or disable Trap Filters specified by their names. |
void |
enableParsers(java.lang.String[] parserNames,
boolean bool)
To enable or disable Trap Parsers specified by the parameter 'parserNames'. |
boolean |
enableTrapsForGroups(java.lang.String[] groups)
To enable traps for groups which were disabled previously. |
boolean |
enableTrapsForNodes(java.lang.String[] nodes)
To enable traps for nodes which have been disabled previously. |
TrapFilterHolder[] |
getAllTrapFilters()
To get all the Trap Filters configured in the server. |
TrapParser[] |
getAllTrapParsers()
Gets all the Trap Parsers that are configured in the server. |
java.lang.String[] |
getGroupsDisabledForTraps()
To get the names of the groups for which traps have been disabled. |
java.lang.String[] |
getNodesDisabledForTraps()
To get the names of the nodes for which traps have been disabled. |
TrapFilterHolder[] |
getTrapFiltersFromFile(java.lang.String file)
Gets the Trap Filters from a file. |
TrapParser[] |
getTrapParsers(java.lang.String[] names)
To get Trap Parsers, with given names. |
TrapParser[] |
getTrapParsersFromFile(java.lang.String file)
Gets the Trap Parsers from a file. |
TrapParser[] |
getTrapParsersFromMib(java.lang.String mib)
Gets the trap parsers from a mib. |
void |
registerForTrap(int port,
SocketListener trapListener)
To register for Trap notification for some specific 'port'. |
void |
registerForTraps(int[] portArray)
To register for notification for Traps on multiple ports. |
void |
registerForTraps(int[] portArray,
SocketListener trapListener)
To register for notification for Traps on multiple ports. |
boolean |
saveTrapFiltersToFile(TrapFilterHolder[] tf,
java.lang.String file)
To save a set of Trap Filters in a file. |
boolean |
saveTrapParsersToFile(TrapParser[] tp,
java.lang.String file)
To save a set of Trap Parsers in a file. |
void |
setEnableReceiveTraps(boolean flag)
To enable NMS to receive Traps, set the flag to true and to stop receiving traps set the flag to false. |
boolean |
setTrapFilter(TrapFilterHolder tf,
boolean saveToFile)
To set a Trap Filter in the server. |
boolean |
setTrapFilters(TrapFilterHolder[] tf,
boolean deleteOldFilters,
boolean saveToFile)
To set an array of Trap Filters in the server. |
boolean |
setTrapParser(TrapParser tp)
To add/replace a Trap parser in the server. |
boolean |
setTrapParsers(TrapParser[] tp,
boolean deleteOldParsers)
To set an array of trap parsers in the server. |
| Field Detail |
public static final int VERSION_1
public static final int VERSION_2C
| Method Detail |
public boolean setTrapParser(TrapParser tp)
throws java.rmi.RemoteException,
NmsStorageException,
FaultException
TrapParser.setProperties(Properties)
to set the properties of Trap Parser. This method automatically saves the Trap Parser
in the default configuration file trap.parsers which presents under
WebNMS/conf directory.tp - Trap parser object which has to be added/replaced in the server.java.rmi.RemoteException - if request fails in remote machineNmsStorageException - if any error occurs while storing TrapParsersFaultException - wrapper for all other module level errorsTrapParser,
getAllTrapParsers(),
getTrapParsers(String[])
public boolean setTrapParsers(TrapParser[] tp,
boolean deleteOldParsers)
throws java.rmi.RemoteException,
NmsStorageException,
FaultException
tp - Array of Trap Parser objects.deleteOldParsers - Whether to discard the already existing parsers or not. If
it is true,then existing Trap Parsers will be deleted. It it is false,
existing Trap Parsers will not be deleted.java.rmi.RemoteException - if request fails in remote machineNmsStorageException - if any error occurs while storing TrapParsersFaultException - wrapper for all other module level errorsTrapParser,
getAllTrapParsers(),
getTrapParsers(String[])
public TrapParser[] getTrapParsers(java.lang.String[] names)
throws java.rmi.RemoteException,
FaultException
TrapParser.getEnable() method.names - An array of names of trap parsers.java.rmi.RemoteException - if request fails in remote machineFaultException - wrapper for all other module level errorsTrapParser,
setTrapParser(TrapParser),
getAllTrapParsers()
public TrapParser[] getAllTrapParsers()
throws java.rmi.RemoteException
TrapParser.getEnable() method.java.rmi.RemoteException - if request fails in remote machineTrapParser,
getTrapParsers(String[]),
setTrapParser(TrapParser)
public TrapParser[] getTrapParsersFromFile(java.lang.String file)
throws java.rmi.RemoteException,
FaultException
TrapParser.getEnable() method.file - The fully qualified name( i.e absolute name) of the file.java.rmi.RemoteException - if request fails in remote machineFaultException - wrapper for all other module level errorsTrapParser,
setTrapParser(TrapParser),
saveTrapParsersToFile(TrapParser[],String)
public TrapParser[] getTrapParsersFromMib(java.lang.String mib)
throws java.rmi.RemoteException,
FaultException
mib - The fully qualified name of the mib file.java.rmi.RemoteException - if request fails in remote machineFaultException - wrapper for all module level errorsTrapParser,
getTrapParsersFromFile(String),
setTrapParser(TrapParser)
public boolean saveTrapParsersToFile(TrapParser[] tp,
java.lang.String file)
throws java.rmi.RemoteException,
NmsStorageException,
FaultException
tp - An array of TrapParser objects to be saved.file - The full path name or simple name of the file.java.rmi.RemoteException - if request fails in remote machineNmsStorageException - if any error occurs while storing TrapParsersFaultException - wrapper for all other module level errorsgetTrapParsersFromFile(String)
public boolean deleteTrapParsers(java.lang.String[] names)
throws java.rmi.RemoteException,
NmsStorageException,
FaultException
names - An array of names of Trap Parsers.java.rmi.RemoteException - if request fails in remote machineNmsStorageException - if any error occurs while updating all storage sourcesFaultException - wrapper for all other module level errorsdeleteAllTrapParsers()
public boolean deleteAllTrapParsers()
throws java.rmi.RemoteException
java.rmi.RemoteException - if request fails in remote machinedeleteTrapParsers(String[])
public boolean setTrapFilter(TrapFilterHolder tf,
boolean saveToFile)
throws java.rmi.RemoteException,
NmsStorageException,
FaultException
If any TrapFilter is already there in WebNMS with the same name, then that old TrapParser will be replaced by the latest one. If no Trap Filter is there in WebNMS with the same name, then new Trap Filter will be added.
tf - The TrapFilterHolder object.saveToFile - parameter decides whether Trap Filter details should be saved into
WebNms/conf/trap.filters file (Default configuratrion file for Trap Filters) or not.java.rmi.RemoteException - if request fails in remote machineNmsStorageException - if any error occurs while storing TrapFiltersFaultException - wrapper for all other module level errorsTrapFilterHolder,
setTrapFilters(TrapFilterHolder[],boolean,boolean),
getAllTrapFilters()
public boolean setTrapFilters(TrapFilterHolder[] tf,
boolean deleteOldFilters,
boolean saveToFile)
throws java.rmi.RemoteException,
NmsStorageException,
FaultException
tf - Array of trap filters objects.deleteOldFilters - Whether to discard the already existing filters.saveToFile - parameter decides whether to save the Trap Filter details or
not into WebNms/conf/trap.filters file (the default Trap filter file).java.rmi.RemoteException - if request fails in remote machineNmsStorageException - if any error occurs while storing TrapFiltersFaultException - wrapper for all other module level errorsTrapFilterHolder,
setTrapFilter(TrapFilterHolder,boolean),
getAllTrapFilters()
public boolean deleteAllTrapFilters()
throws java.rmi.RemoteException
java.rmi.RemoteException - if request fails in remote machinesetTrapFilter(TrapFilterHolder,boolean),
getAllTrapFilters()
public TrapFilterHolder[] getAllTrapFilters()
throws java.rmi.RemoteException
TrapFilterHolder.getEnableType() to see, whether the corresponding Trap Filter
is enabled or disabled.java.rmi.RemoteException - if request fails in remote machinesetTrapFilter(TrapFilterHolder,boolean),
getTrapFiltersFromFile(String)
public TrapFilterHolder[] getTrapFiltersFromFile(java.lang.String file)
throws java.rmi.RemoteException,
FaultException
TrapFilterHolder.getEnableType() to see, whether the corresponding Trap Filter
is enabled or disabled.file - The fully qualified name of the file.java.rmi.RemoteException - if request fails in remote machineFaultException - wrapper for all module level errorsTrapFilterHolder,
getAllTrapFilters(),
saveTrapFiltersToFile(TrapFilterHolder[],String)
public boolean saveTrapFiltersToFile(TrapFilterHolder[] tf,
java.lang.String file)
throws java.rmi.RemoteException,
NmsStorageException,
FaultException
tf - An array of TrapFilterHolder objects to be saved.file - The fully qualified name or simple name of the file.java.rmi.RemoteException - if request fails in remote machineNmsStorageException - if any error occurs while storing TrapFiltersFaultException - wrapper for all other module level errorsgetTrapFiltersFromFile(String),
getAllTrapFilters()
public boolean disableTrapsForNodes(java.lang.String[] nodes,
boolean deleteOldNodes)
throws java.rmi.RemoteException,
NmsStorageException,
FaultException
nodes - The string array specifying the node names.deleteOldNodes - Whether to delete the old set of nodes.java.rmi.RemoteException - if request fails in remote machineNmsStorageException - if any error occurs while storing the changesFaultException - wrapper for all other module level errorsenableTrapsForNodes(String[]),
disableTrapsForGroups(String[],boolean)
public boolean enableTrapsForNodes(java.lang.String[] nodes)
throws java.rmi.RemoteException,
NmsStorageException,
FaultException
nodes - The array specifying the node names.java.rmi.RemoteException - if request fails in remote machineNmsStorageException - if any error occurs while storing the changesFaultException - wrapper for all other module level errorsdisableTrapsForNodes(String[],boolean),
enableTrapsForGroups(String[])
public java.lang.String[] getNodesDisabledForTraps()
throws java.rmi.RemoteException
java.rmi.RemoteException - if request fails in remote machineenableTrapsForNodes(String[]),
disableTrapsForNodes(String[],boolean)
public boolean disableTrapsForGroups(java.lang.String[] groups,
boolean deleteOldGroups)
throws java.rmi.RemoteException,
NmsStorageException,
FaultException
groups - The string array specifying the group names.deleteOldGroups - Whether to delete the old set of groups.java.rmi.RemoteException - if request fails in remote machineNmsStorageException - if any error occurs while storing the changesFaultException - wrapper for all other module level errorsenableTrapsForGroups(String[])
public boolean enableTrapsForGroups(java.lang.String[] groups)
throws java.rmi.RemoteException,
NmsStorageException,
FaultException
groups - The array specifying the group names.java.rmi.RemoteException - if request fails in remote machineNmsStorageException - if any error occurs while storing the changesFaultException - wrapper for all other module level errorsdisableTrapsForGroups(String[],boolean)
public java.lang.String[] getGroupsDisabledForTraps()
throws java.rmi.RemoteException
java.rmi.RemoteException - if request fails in remote machineenableTrapsForGroups(String[]),
disableTrapsForGroups(String[],boolean)
public void registerForTrap(int port,
SocketListener trapListener)
throws java.rmi.RemoteException,
NmsStorageException
port - - Port for which the SocketListener is registering for notification.trapListener - - Implementation of SocketListener interface for which notifications
need to be sent.java.rmi.RemoteException - if request fails in remote machineNmsStorageException - When problems opening socketregisterForTraps(int[],SocketListener),
deRegisterForTrap(int,SocketListener),
deRegisterForTraps(int[],SocketListener)
public void registerForTraps(int[] portArray,
SocketListener trapListener)
throws java.rmi.RemoteException,
NmsStorageException
portArray - - Trap Port values for which the SocketListener is
registering for notification.trapListener - - Implementation of SocketListener interface to which notifications
need to be sent.java.rmi.RemoteException - if request fails in remote machineNmsStorageException - When problems in opening socketregisterForTrap(int,SocketListener),
deRegisterForTrap(int,SocketListener),
deRegisterForTraps(int[],SocketListener)
public void registerForTraps(int[] portArray)
throws java.rmi.RemoteException,
NmsStorageException
portArray - - Trap Port values for which the NMS is registering for notification.java.rmi.RemoteException - if request fails in remote machineNmsStorageException - When problem in opening socketdeRegisterForTraps(int[])
public void deRegisterForTrap(int port,
SocketListener trapListener)
throws java.rmi.RemoteException,
NmsStorageException
port - - Port for which notifications need to be deregistered.trapListener - - Implementation of SocketListener interface which has to be
deregistered from notifications.java.rmi.RemoteException - if request fails in remote machineNmsStorageException - When problem in closing socketdeRegisterForTraps(int[],SocketListener),
registerForTrap(int,SocketListener),
registerForTraps(int[],SocketListener)
public void deRegisterForTraps(int[] portArray,
SocketListener trapListener)
throws java.rmi.RemoteException,
NmsStorageException
portArray - - Trap Port values for which notifications
need to be deregistered.trapListener - - Implementation of SocketListener interface which has to be
deregistered from notification.NmsStorageException - When problem in closing socketjava.rmi.RemoteException - if request fails in remote machine
public void deRegisterForTraps(int[] portArray)
throws java.rmi.RemoteException,
NmsStorageException
portArray - - Trap Port values for which notifications need to be deregistered.NmsStorageException - When problem in closing socketjava.rmi.RemoteException - if request fails in remote machinedeRegisterForTrap(int,SocketListener),
registerForTrap(int,SocketListener),
registerForTraps(int[],SocketListener)
public void deRegister(SocketListener trapListener)
throws java.rmi.RemoteException,
NmsStorageException
trapListener - - Implementation of SocketListener interface which has to be
deregistered from all registered ports.NmsStorageException - When problem in closing socketjava.rmi.RemoteException - if request fails in remote machineregisterForTrap(int,SocketListener),
registerForTraps(int[],SocketListener),
deRegisterForTraps(int[],SocketListener)
public void setEnableReceiveTraps(boolean flag)
throws java.rmi.RemoteException
flag - false to disable trap receiving, true to enable receiving trap.java.rmi.RemoteException - if request fails in remote machine
public void enableParsers(java.lang.String[] parserNames,
boolean bool)
throws java.rmi.RemoteException,
NmsStorageException,
FaultException
parserNames - - String array containsTrap Parser names.bool - - boolean 'true' sets the Trap Parses enabled and 'false' sets disabled.NmsStorageException - if error occurs while storing the changesjava.rmi.RemoteException - if request fails in remote machineFaultException - wrapper for all other module level errorsenableFilters(String[],boolean)
public void enableFilters(java.lang.String[] filterNames,
boolean bool)
throws java.rmi.RemoteException,
NmsStorageException,
FaultException
filterNames - - String array contains TrapFilter names.bool - - boolean 'true' sets the TrapFilters enabled and 'false' sets disabled.FaultException - wrapper for all other module level errorsjava.rmi.RemoteException - if request fails in remote machineNmsStorageException - if error occurs while storing the changesenableParsers(String[],boolean)
|
AdventNet Web NMS 4 API Specification | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||