public class DefaultUsmAgent extends java.lang.Object implements UsmAgent
Note that it is not guaranteed that the agent will allow discovery by itself. Also, if the SNMP agent reboots while the stack is running, it will not pick up the new boots and time.
Users are advised and encouraged to provide a better, more accurate implementation of UsmAgent.
SnmpContextv3
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
LOCAL_HOST
The default name of the local host, localhost.
|
static int |
LOCAL_PORT
The default port number of the local host, 161.
|
MYFAKEHOSTNAME
Constructor and Description |
---|
DefaultUsmAgent() |
Modifier and Type | Method and Description |
---|---|
int |
getSnmpEngineBoots()
Returns the authoritative Engine Boots.
|
java.lang.String |
getSnmpEngineId()
Returns the authoritative SNMP Engine ID.
|
int |
getSnmpEngineTime()
Returns the authoritative Engine Time.
|
long |
getUsmStatsNotInTimeWindows()
Returns the value of the usmStatsNotInTimeWindows counter.
|
long |
getUsmStatsUnknownEngineIDs()
Returns the value of the usmStatsUnknownEngineIDs counter.
|
void |
setAgentName(java.lang.String host)
Sets my own hostname, i.e. the name of the agent or authoritative
engine.
|
void |
setAgentPort(int p)
Sets my own port number, i.e. the port number of the agent
or authoritative engine.
|
void |
setSnmpContext(SnmpContextv3Basis c)
Sets the SNMP context.
|
public static final java.lang.String LOCAL_HOST
public static final int LOCAL_PORT
public java.lang.String getSnmpEngineId()
getSnmpEngineId
in interface UsmAgent
SnmpUtilities.toBytes(String)
public int getSnmpEngineBoots()
getSnmpEngineBoots
in interface UsmAgent
public int getSnmpEngineTime()
getSnmpEngineTime
in interface UsmAgent
public void setSnmpContext(SnmpContextv3Basis c)
setSnmpContext
in interface UsmAgent
public void setAgentName(java.lang.String host) throws java.net.UnknownHostException
java.net.UnknownHostException
- Thrown when java.net.InetAddress cannot
resolve the nameLOCAL_HOST
public void setAgentPort(int p)
LOCAL_PORT
public long getUsmStatsUnknownEngineIDs()
UsmAgent
getUsmStatsUnknownEngineIDs
in interface UsmAgent
public long getUsmStatsNotInTimeWindows()
UsmAgent
getUsmStatsNotInTimeWindows
in interface UsmAgent