- java.lang.Object
-
- org.snmp4j.agent.mo.snmp.SNMPv2MIB
-
- All Implemented Interfaces:
EventListener,AgentCapabilityList,MOGroup,org.snmp4j.event.CounterListener
public class SNMPv2MIB extends Object implements MOGroup, org.snmp4j.event.CounterListener, AgentCapabilityList
TheSystemGroupimplements the objects in the SNMPv2-MIB specification. Since version 2.0, the SysUpTime class usesSystem.nanoTime()insteadSystem.currentTimeMillis()for up-time computation which makes the implementation stable against system time changes.- Version:
- 2.0
- Author:
- Frank Fock
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSNMPv2MIB.SnmpEnableAuthenTrapsEnumclassSNMPv2MIB.SysOREntrystatic classSNMPv2MIB.SysUpTimeImpl
-
Constructor Summary
Constructors Modifier Constructor Description SNMPv2MIB(org.snmp4j.smi.OctetString sysDescr, org.snmp4j.smi.OID sysOID, org.snmp4j.smi.Integer32 sysServices)Create a new SNMPv2MIB instance with description, OID, services indicator, and system up-time which starts when this constuctor is being called.protectedSNMPv2MIB(org.snmp4j.smi.OctetString sysDescr, org.snmp4j.smi.OID sysOID, org.snmp4j.smi.Integer32 sysServices, SysUpTime sysUpTime)Create a new SNMPv2MIB instance with description, OID, services indicator, and system up-time.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.snmp4j.smi.OIDaddSysOREntry(org.snmp4j.smi.OID sysORID, org.snmp4j.smi.OctetString sysORDescr)Add a capabilities description to the exported list.org.snmp4j.smi.OctetStringgetContact()org.snmp4j.smi.OctetStringgetDescr()org.snmp4j.smi.OctetStringgetLocation()org.snmp4j.smi.OctetStringgetName()NotificationOriginatorgetNotificationOriginator()Gets the notification originator used for sending authenticationFailure traps.org.snmp4j.smi.OIDgetObjectID()org.snmp4j.smi.Integer32getServices()MOScalar<org.snmp4j.smi.Integer32>getSnmpEnableAuthenTraps()Gets the snmpEnableAuthenTrapsMOScalarobject.SysUpTimegetSysUpTime()static SysUpTimegetSysUpTime(org.snmp4j.smi.OctetString context)Returns the sysUpTime for the supplied context.org.snmp4j.smi.TimeTicksgetUpTime()voidincrementCounter(org.snmp4j.event.CounterEvent event)voidregisterMOs(MOServer server, org.snmp4j.smi.OctetString context)Registers the managed objects of this group with the server for the supplied context.MOTableRowremoveSysOREntry(org.snmp4j.smi.OID index)Remove a capabilities description from the exported list.voidsetContact(org.snmp4j.smi.OctetString contact)voidsetLocation(org.snmp4j.smi.OctetString sysLocation)voidsetName(org.snmp4j.smi.OctetString sysName)voidsetNotificationOriginator(NotificationOriginator notificationOriginator)Sets theNotificationOriginatorto be used for sending the authenticationFailure trap.voidunregisterMOs(MOServer server, org.snmp4j.smi.OctetString context)Unregisters the managed objects of this group from the supplied server and from the supplied context.protected voidupdateSysORLastChange()
-
-
-
Constructor Detail
-
SNMPv2MIB
public SNMPv2MIB(org.snmp4j.smi.OctetString sysDescr, org.snmp4j.smi.OID sysOID, org.snmp4j.smi.Integer32 sysServices)Create a new SNMPv2MIB instance with description, OID, services indicator, and system up-time which starts when this constuctor is being called.- Parameters:
sysDescr- the description of the system.sysOID- the (unique) OID of the OBJECT-IDENTITY construct identifying this system.sysServices- the services indicator that roughly describes which network services this entity supports. See sysServices MIB description.
-
SNMPv2MIB
protected SNMPv2MIB(org.snmp4j.smi.OctetString sysDescr, org.snmp4j.smi.OID sysOID, org.snmp4j.smi.Integer32 sysServices, SysUpTime sysUpTime)Create a new SNMPv2MIB instance with description, OID, services indicator, and system up-time.- Parameters:
sysDescr- the description of the system.sysOID- the (unique) OID of the OBJECT-IDENTITY construct identifying this system.sysServices- the services indicator that roughly describes which network services this entity supports. See sysServices MIB description.sysUpTime- the up-time service whoseSysUpTime.get()is called when the system up-time needs to be determined.- Since:
- 2.4.1
-
-
Method Detail
-
updateSysORLastChange
protected void updateSysORLastChange()
-
addSysOREntry
public org.snmp4j.smi.OID addSysOREntry(org.snmp4j.smi.OID sysORID, org.snmp4j.smi.OctetString sysORDescr)Description copied from interface:AgentCapabilityListAdd a capabilities description to the exported list.- Specified by:
addSysOREntryin interfaceAgentCapabilityList- Parameters:
sysORID- the OID of an AGENT-CAPABILITIES statement.sysORDescr- A textual description of the capabilities identified by the corresponding instance of sysORID.- Returns:
- the index OID of the entry that uniquely identifies it.
-
removeSysOREntry
public MOTableRow removeSysOREntry(org.snmp4j.smi.OID index)
Description copied from interface:AgentCapabilityListRemove a capabilities description from the exported list.- Specified by:
removeSysOREntryin interfaceAgentCapabilityList- Parameters:
index- the index OID previously returned byAgentCapabilityList.addSysOREntry(org.snmp4j.smi.OID, org.snmp4j.smi.OctetString).- Returns:
- MOTableRow
the removed sysOREntry row or
nullif such a row could not be found.
-
registerMOs
public void registerMOs(MOServer server, org.snmp4j.smi.OctetString context) throws DuplicateRegistrationException
Description copied from interface:MOGroupRegisters the managed objects of this group with the server for the supplied context.- Specified by:
registerMOsin interfaceMOGroup- Parameters:
server- theMOServerwhere to register the managed objects.context- the context to use (may benullif no specific context is selected).- Throws:
DuplicateRegistrationException- if a managed object's scope (i.e. lower bound) is already registered at the server.
-
unregisterMOs
public void unregisterMOs(MOServer server, org.snmp4j.smi.OctetString context)
Description copied from interface:MOGroupUnregisters the managed objects of this group from the supplied server and from the supplied context.- Specified by:
unregisterMOsin interfaceMOGroup- Parameters:
server- theMOServerwhere to unregister the managed objects.context- the context to use (may benullif no specific context is selected).
-
getContact
public org.snmp4j.smi.OctetString getContact()
-
setContact
public void setContact(org.snmp4j.smi.OctetString contact)
-
getDescr
public org.snmp4j.smi.OctetString getDescr()
-
getLocation
public org.snmp4j.smi.OctetString getLocation()
-
setLocation
public void setLocation(org.snmp4j.smi.OctetString sysLocation)
-
getName
public org.snmp4j.smi.OctetString getName()
-
setName
public void setName(org.snmp4j.smi.OctetString sysName)
-
getObjectID
public org.snmp4j.smi.OID getObjectID()
-
getServices
public org.snmp4j.smi.Integer32 getServices()
-
getUpTime
public org.snmp4j.smi.TimeTicks getUpTime()
-
getSysUpTime
public SysUpTime getSysUpTime()
-
incrementCounter
public void incrementCounter(org.snmp4j.event.CounterEvent event)
- Specified by:
incrementCounterin interfaceorg.snmp4j.event.CounterListener
-
getSysUpTime
public static SysUpTime getSysUpTime(org.snmp4j.smi.OctetString context)
Returns the sysUpTime for the supplied context.- Parameters:
context- a context ornullfor the default context.- Returns:
- the SysUpTime instance associated with the given context or
nullif such a sysUpTime instance has not been registered yet.
-
setNotificationOriginator
public void setNotificationOriginator(NotificationOriginator notificationOriginator)
Sets theNotificationOriginatorto be used for sending the authenticationFailure trap.- Parameters:
notificationOriginator- a NotificationOriginator instance ornullto disable authenticationFailure traps (default).
-
getNotificationOriginator
public NotificationOriginator getNotificationOriginator()
Gets the notification originator used for sending authenticationFailure traps.- Returns:
- a NotificationOriginator.
- Since:
- 1.2
-
-