[SNMP4J] Configure agent communities via properties file

Pete Dow dothoro at gmail.com
Mon Nov 7 18:13:36 CET 2011


Hello,
I built the sample agent (SNMP4J-agent 1.4.3) and ran it with the sample
agent config properties file.  I can v1-walk the SNMP-COMMUNITY-MIB (using
community "public").  This is great, but how do I use a community other
than "public" via properties-file configuration item?

What I've done so far:  here's what I get when I v1-walk the community MIB:

SNMP-COMMUNITY-MIB::snmpCommunityName.'public' = STRING: "public"
SNMP-COMMUNITY-MIB::snmpCommunitySecurityName.'public' = STRING: public
SNMP-COMMUNITY-MIB::snmpCommunityContextEngineID.'public' = Hex-STRING: 80
00 13 70 01 0A 01 01 03
SNMP-COMMUNITY-MIB::snmpCommunityContextName.'public' = STRING:
SNMP-COMMUNITY-MIB::snmpCommunityTransportTag.'public' = STRING:
SNMP-COMMUNITY-MIB::snmpCommunityStorageType.'public' = INTEGER:
permanent(4)
SNMP-COMMUNITY-MIB::snmpCommunityStatus.'public' = INTEGER: active(1)

If I replace all instances of "public" in the sample agent config file from
"public" to "foo" and then re-run the agent, then I can still use "public"
to read objects, which I find puzzling (I figure I should not be able to
use "public" after I made that replacement).  When I v1-walk the community
MIB after I do that (again using "public" community), I get this:

SNMP-COMMUNITY-MIB::snmpCommunityName.'foo' = STRING: "foo"
SNMP-COMMUNITY-MIB::snmpCommunityName.'public' = STRING: "public"
SNMP-COMMUNITY-MIB::snmpCommunitySecurityName.'foo' = STRING: foo
SNMP-COMMUNITY-MIB::snmpCommunitySecurityName.'public' = STRING: public
... etc.

So it looks like "public" is still being used in the agent, that I haven't
disabled "public" correctly, that "foo" is now in place, and that at least
I know that changes to the properties file produce some effect.  How do I
not use "public" and use "foo" instead, via a properties-file configuration
item?

It looks like I'm on the right track considering my walk results, but that
there's more to it than a search/replace of "public" in the sample agent
config properties file.  I haven't been able to figure out what more there
is to it.

I've searched the list in case this question has been asked before.  I've
seen similar questions asked in the list, but the answers were not exactly
what I seek.  E.g., here are some similar threads I found in the list with
which I could not reach a solution:


http://lists.agentpp.org/pipermail/snmp4j/2010-October/004341.html :
couldn't find a response to this post

http://lists.agentpp.org/pipermail/snmp4j/2009-January/003324.html :
couldn't find a response to this post

http://lists.agentpp.org/pipermail/snmp4j/2006-April/001251.html : Frank
posted a response discussing the SnmpCommunityMIB class, but I'm looking
for a way to do this in a config file (not programmatically and not via
SNMP-SETs, methods which have been answers in the list already).

http://lists.agentpp.org/pipermail/snmp4j/2008-May/002925.html : I don't
understand the response.

http://lists.agentpp.org/pipermail/snmp4j/2011-April/004517.html : "edit
SNMP-COMMUNITY-MIB": implies there's a way to do it, but not discussed or
referenced.


I noticed there's a wiki mentioned in the list; I found a page in the wiki
FAQ titled "How do I change communities?" but the page is blank.

Scanning the code for uses of hard-coded "public" community turns up in
code files used only in test scenarios, from what I can tell.

It seems like there's a way to do this (to configure (not via code) the
agent to not use "public") and I'm just not looking in the right place; can
anyone point me to the correct resource?

Thanks,
Pete



More information about the SNMP4J mailing list