Using the simulator

Community and Context Indexing

An SNMP agent can have multiple data files, each associated with a different community or SNMPv3 context. The community or context in a request determines which data file the agent uses.

For example, the bundled context sample agent (in examples/context) specifies two data files in its project file:

<dataFile name="data/linux1.xml"/>
<dataFile name="data/linux2.xml"/>

At the beginning of linux1.xml:

<Instances readCommunity="public1" >

At the beginning of linux2.xml:

<Instances readCommunity="public2" >

The first data file uses the community/context public1, and the second uses public2.

For an SNMPv1 or SNMPv2c agent, these values are community names. For an SNMPv3 agent, the readCommunity value becomes the context name.

The SNMPv3 parameters are:

Field

Value

User Name

newUser

Auth Algorithm

MD5

Auth Password

abc12345

Priv Algorithm

DES

Priv Password

abc1345

Context

public1 or public2

Note the context settings in the configuration file (SnmpSimulator.xml):

contextPrefix="pub"
match="prefix"

The default setting is match="exact". Because both context names begin with pub, the sample uses prefix matching.

When you query the agent with an SNMP manager, it returns different data for the two community or context names.