|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.snmp4j.agent.example.SampleAgent
public class SampleAgent
The SampleAgent uses an AgentConfigManager instance to create a
minimal SNMP agent using the configuration defined by
SampleAgentConfig.properties in this package. That properties
file defines the initial content of the registered MIB objects of this agent
which may differ from the hard coded defaults.
In order to add a new MIB object, call server.register(..) or
replace the Modules.java file in this package by the
Modules.java generated by AgenPro for your MIB module(s).
The agent uses the Java logging framework to log messages.
| Field Summary | |
|---|---|
protected AgentConfigManager |
agent
|
protected Modules |
modules
|
protected MOServer |
server
|
| Constructor Summary | |
|---|---|
SampleAgent(java.util.Map args)
|
|
| Method Summary | |
|---|---|
protected void |
addListenAddresses(org.snmp4j.MessageDispatcher md,
java.util.List addresses)
|
org.snmp4j.smi.Variable |
getVariable(java.lang.String name)
Gets the variable with the specified name, which might be either a textual name or an instance OID. |
static void |
main(java.lang.String[] args)
Runs a sample agent with a default configuration defined by SampleAgentConfig.properties. |
protected void |
registerMIBs()
Register your own MIB modules in the specified context of the agent. |
void |
run()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected AgentConfigManager agent
protected MOServer server
protected Modules modules
| Constructor Detail |
|---|
public SampleAgent(java.util.Map args)
| Method Detail |
|---|
protected void addListenAddresses(org.snmp4j.MessageDispatcher md,
java.util.List addresses)
public void run()
protected void registerMIBs()
DuplicateRegistrationException - if some of the MIB modules
registration regions conflict with already registered regions.public org.snmp4j.smi.Variable getVariable(java.lang.String name)
VariableProvider
getVariable in interface VariableProvidername - the name or OID of the variable to return.
null if such a variable with the
specified name or OID does not exists.public static void main(java.lang.String[] args)
SampleAgentConfig.properties. A sample command line is:
-c SampleAgent.cfg -bc SampleAgent.bc udp:127.0.0.1/4700 tcp:127.0.0.1/4700
args - the command line arguments defining at least the listen addresses.
The format is -c[s{=SampleAgent.cfg}] -bc[s{=SampleAgent.bc}]
#address[s<(udp|tcp):.*[/[0-9]+]?>] ... For the format
description see ArgumentParser.
|
Copyright 2005-2008 Frank Fock (SNMP4J.org) | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||