[SNMP4J] R: SNMP4J Agent cannot be discovered (Netwrok Discovery)
Denis Ioan
d.ioan at next-italia.it
Fri Sep 18 18:18:36 CEST 2015
Hi Frank,
It's clear. Thank you a lot!
My very best regards
Denis
> Il giorno 18/set/2015, alle ore 17:09, Frank Fock <fock at agentpp.com> ha scritto:
>
> Denis,
>
> Many people seem to use the iReasoning tool and bother me with question why it does not
> provide the results they expect. Please ask the provider of the tool instead.
>
> The agent is just fine. It cannot be an issue with the agent if you can access it with some
> (standard conforming) SNMP tool.
>
> Best regards,
> Frank
>
>> Am 18.09.2015 um 17:05 schrieb Denis Ioan:
>> Frank,
>> actually if I perform the Network Discovery Tools of iReasoning in my office where I have a standard router, the tool could find easy a couple of printers with all the informations (sysDescr, sysObject, sysUpTime, etc) but not my Agent :( Maybe I'm wrong but it seem an issue un my Agent. Or is it something should I configure on the operating system where the Agent works (it's a Linux Ubuntu)?
>> Best Regards
>> Denis
>>
>> -----Messaggio originale-----
>> Da: Frank Fock [mailto:fock at agentpp.com]
>> Inviato: venerdì 18 settembre 2015 16:52
>> A: Denis Ioan <d.ioan at next-italia.it>
>> Cc: snmp4j at agentpp.org
>> Oggetto: Re: [SNMP4J] SNMP4J Agent cannot be discovered (Netwrok Discovery)
>>
>>
>> Hi Denis,
>>
>> The accessibility by IP multi-cast and broadcast is a network issue.
>> Your agent is fine if you can access it by a simple SNMP message it also can be accessed by a multi-cast or broadcast. From the agent point of view, the IP packet types cannot be distinguished and are processed in exactly the same way.
>>
>> Best regards,
>> Frank
>>
>>
>>
>>> On 18 Sep 2015, at 16:47, Denis Ioan <d.ioan at next-italia.it> wrote:
>>>
>>> Hi Frank,
>>> just for my understand, the problem where my agent cannot be not accessible by IP broadcast or multi-cast UDP packets is it a problem inside my software (my Agent programming) or could come from the network environment? (After this question I try to do not disturb you more).
>>> Thank you
>>> Best Regards
>>> Denis
>>>
>>> -----Messaggio originale-----
>>> Da: Frank Fock [mailto:fock at agentpp.com]
>>> Inviato: venerdì 18 settembre 2015 16:38
>>> A: Denis Ioan <d.ioan at next-italia.it>; snmp4j at agentpp.org
>>> Oggetto: Re: R: [SNMP4J] SNMP4J Agent cannot be discovered (Netwrok
>>> Discovery)
>>>
>>> Hi Denis,
>>>
>>> What object a manager expects to find to successfully "discover" an agent depends on the manager itself. However, there are some standard objects that should be there in any case.
>>> For SNMPv3 those objects are provided by the SNMP-FRAMEWORK-MIB.
>>> SNMP4J-Agent by default provides those objects.
>>>
>>> You can use MIB Explorer Pro to run a discovery by yourself and log the exchanged packets too.
>>> But also please check for network security issues. The agent you are running could be not accessible by IP broadcast or multi-cast UDP packets.
>>>
>>> Best regards,
>>> Frank
>>>
>>>> Am 18.09.2015 um 10:28 schrieb Denis Ioan:
>>>> Hi Frank,
>>>> first of all thank you for the quick reply. I try to give you some more details about my issue:
>>>> As you could check in my lines of code I've implemented (or I tried to implement) an SNMP Agent v3.
>>>> I registered all my private OIDs and I've also implemented all the mib-2/system OIDs (sysName, sysDescription, etc).
>>>> So you can "get" any the system OIDs and get/set all my enterprise OIDs (as well you can SnmpWalk, GetNext, etc). This works well.
>>>> Some software like "Whats Up Gold" in order to connect to a SNMP device uses such a "SNMP Network Discovery" where they poll all the subnet addresses looking for a SNMP Device. I've tried with a Cisco router (SNMPv3 and authentication) and the application discovers it immediately, but when I try on my device the software cannot discover it. As well if I use the "Network Discovery" function if the iReasoning MIB Browser (with the one I can work perfectly in terms of SnmpGet, SnmpSet and so on).
>>>> At this point I ask myself if I should register some other mandatory OIDs (not only the system OIDs) to let my device to be automatically discovered or I miss to implement in my software something important.
>>>> I hope I could give some more indications and thank once more.
>>>> Best Regards
>>>> Denis
>>>>
>>>> -----Messaggio originale-----
>>>> Da: SNMP4J [mailto:snmp4j-bounces at agentpp.org] Per conto di Frank
>>>> Fock
>>>> Inviato: giovedì 17 settembre 2015 22:05
>>>> A: snmp4j at agentpp.org
>>>> Oggetto: Re: [SNMP4J] SNMP4J Agent cannot be discovered (Netwrok
>>>> Discovery)
>>>>
>>>> Hi Denis,
>>>>
>>>> Before I can answer your question, I need to know what you exactly mean by "Network Discovery"?
>>>>
>>>> Often IP multi-cast was used for that. Nowadays this is often no longer possible because switches/router/firewalls block multi-cast packets for security reasons.
>>>>
>>>> In addition, multi-cast works only with SNMPv1 and v2c (community
>>>> based) and
>>>> SNMPv3 with noAuthNoPriv.
>>>>
>>>> Best regards,
>>>> Frank
>>>>
>>>>> Am 17.09.2015 um 11:14 schrieb Denis Ioan:
>>>>> Hi to everybody,
>>>>> I'm new to the SNMP protocol but I had to implement an Agent in v3.
>>>>> Using SNMP4J I've implemented and all works fine except the agent
>>>>> cannot be discovered automatically from the Network Discovery functions.
>>>>> I guess I forgot to insert something in the configuration. I post
>>>>> here the Agent class and the way I use it in the software:
>>>>>
>>>>> public class SNMPAgent extends BaseAgent {
>>>>>
>>>>> private final String GROUP_NAME = "v3group";
>>>>>
>>>>> private String address;
>>>>> private String baseOID;
>>>>> private String securityName; // User
>>>>> private String SHAPassword;
>>>>> private String AES128Passphrase;
>>>>> private String trapIPAddress;
>>>>> private String trapPort;
>>>>>
>>>>> /**
>>>>> *
>>>>> * @param address
>>>>> * @throws IOException
>>>>> */
>>>>> public SNMPAgent(String address, String baseOID,
>>>>> String securityName, String SHAPassword, String
>>>>> AES128Passphrase, String trapIPAddress, String trapPort) throws
>>>>> IOException {
>>>>>
>>>>> /**
>>>>> * Creates a base agent with boot-counter, config file,
>>>>> and a
>>>>> * CommandProcessor for processing SNMP requests.
>>>>> Parameters:
>>>>> * "bootCounterFile" - a file with serialized
>>>>> boot-counter information
>>>>> * (read/write). If the file does not exist it is
>>>>> created on shutdown of
>>>>> * the agent. "configFile" - a file with serialized
>>>>> configuration
>>>>> * information (read/write). If the file does not exist
>>>>> it is created on
>>>>> * shutdown of the agent. "commandProcessor" - the
>>>>> CommandProcessor
>>>>> * instance that handles the SNMP requests.
>>>>> */
>>>>> super(new File("conf.agent"), new File("bootCounter.agent"),
>>>>> new CommandProcessor(
>>>>> new
>>>>> OctetString(MPv3.createLocalEngineID())));
>>>>>
>>>>> this.address = address;
>>>>> this.baseOID = baseOID;
>>>>> this.securityName = securityName;
>>>>> this.SHAPassword = SHAPassword;
>>>>> this.AES128Passphrase = AES128Passphrase;
>>>>> this.trapIPAddress = trapIPAddress;
>>>>> this.trapPort = trapPort;
>>>>>
>>>>> }
>>>>>
>>>>> /**
>>>>> * Adds community to security name mappings needed for SNMPv1
>>>>> and SNMPv2c.
>>>>> */
>>>>> @Override
>>>>> protected void addCommunities(SnmpCommunityMIB communityMIB) {
>>>>>
>>>>> }
>>>>>
>>>>> /**
>>>>> * Adds initial notification targets and filters.
>>>>> */
>>>>> @Override
>>>>> protected void addNotificationTargets(final SnmpTargetMIB targetMIB,
>>>>> final SnmpNotificationMIB notificationMIB) {
>>>>> }
>>>>>
>>>>> /**
>>>>> * Adds all the necessary initial users to the USM.
>>>>> */
>>>>> @Override
>>>>> protected void addUsmUser(USM usm)
>>>>> {
>>>>> UsmUser user = new UsmUser(
>>>>> new OctetString(securityName),
>>>>> AuthSHA.ID,
>>>>> new OctetString(SHAPassword),
>>>>> PrivAES128.ID,
>>>>> new OctetString(AES128Passphrase)
>>>>> );
>>>>>
>>>>> usm.addUser(user.getSecurityName(), null, user);
>>>>> }
>>>>>
>>>>> /**
>>>>> * Adds initial VACM configuration.
>>>>> */
>>>>> @Override
>>>>> protected void addViews(VacmMIB vacm)
>>>>> {
>>>>> vacm.addGroup(
>>>>> SecurityModel.SECURITY_MODEL_USM,
>>>>> new OctetString(securityName),
>>>>> new OctetString(GROUP_NAME),
>>>>> StorageType.nonVolatile
>>>>> );
>>>>>
>>>>> vacm.addAccess(
>>>>> new OctetString(GROUP_NAME),
>>>>> new OctetString(),
>>>>> SecurityModel.SECURITY_MODEL_USM,
>>>>> SecurityLevel.AUTH_PRIV,
>>>>> MutableVACM.VACM_MATCH_EXACT,
>>>>> new OctetString("fullReadView"),
>>>>> new OctetString("fullWriteView"),
>>>>> new OctetString("fullNotifyView"),
>>>>> StorageType.nonVolatile
>>>>> );
>>>>>
>>>>> vacm.addViewTreeFamily(
>>>>> new OctetString("fullReadView"),
>>>>> new OID(baseOID),
>>>>> new OctetString(),
>>>>> VacmMIB.vacmViewIncluded,
>>>>> StorageType.nonVolatile
>>>>> );
>>>>>
>>>>> vacm.addViewTreeFamily(
>>>>> new OctetString("fullWriteView"),
>>>>> new OID(baseOID),
>>>>> new OctetString(),
>>>>> VacmMIB.vacmViewIncluded,
>>>>> StorageType.nonVolatile
>>>>> );
>>>>>
>>>>> vacm.addViewTreeFamily(new OctetString("fullReadView"), new
>>>>> OID("1.3"),
>>>>> new OctetString(), VacmMIB.vacmViewIncluded,
>>>>> StorageType.nonVolatile);
>>>>> }
>>>>>
>>>>> /**
>>>>> * Unregister the basic MIB modules from the agent's MOServer.
>>>>> */
>>>>> @Override
>>>>> protected void unregisterManagedObjects() {
>>>>> // TODO Auto-generated method stub
>>>>>
>>>>> }
>>>>>
>>>>> /**
>>>>> * Register additional managed objects at the agent's server.
>>>>> */
>>>>> @Override
>>>>> protected void registerManagedObjects() {
>>>>> // TODO Auto-generated method stub
>>>>>
>>>>> }
>>>>>
>>>>> protected void initTransportMappings() throws IOException {
>>>>> transportMappings = new TransportMapping[1];
>>>>> Address addr = GenericAddress.parse(address);
>>>>> TransportMapping tm = TransportMappings.getInstance()
>>>>> .createTransportMapping(addr);
>>>>> transportMappings[0] = tm;
>>>>> }
>>>>>
>>>>> /**
>>>>> * Start method invokes some initialization methods needed to
>>>>> start the
>>>>> * agent
>>>>> *
>>>>> * @throws IOException
>>>>> */
>>>>> public void start() throws IOException {
>>>>>
>>>>> init();
>>>>> // This method reads some old config from a file and causes
>>>>> // unexpected behavior.
>>>>> // loadConfig(ImportModes.REPLACE_CREATE);
>>>>> addShutdownHook();
>>>>> //getServer().addContext(new OctetString("public"));
>>>>> finishInit();
>>>>> run();
>>>>> sendColdStartNotification();
>>>>> }
>>>>>
>>>>> /**
>>>>> * Clients can register the MO they need
>>>>> */
>>>>> public void registerManagedObject(ManagedObject mo) {
>>>>> try {
>>>>> server.register(mo, null);
>>>>> } catch (DuplicateRegistrationException ex) {
>>>>> throw new RuntimeException(ex);
>>>>> }
>>>>> }
>>>>>
>>>>> public void unregisterManagedObject(MOGroup moGroup) {
>>>>> moGroup.unregisterMOs(server, getContext(moGroup));
>>>>> }
>>>>>
>>>>> }
>>>>>
>>>>> I user the Agent in this way:
>>>>>
>>>>>
>>>>> agent = new SNMPAgent(
>>>>> LOCALHOST + '/' + configuration.getAgentSnmpPort(),
>>>>> configuration.getAgentBaseOID(),
>>>>> configuration.getAgentSnmpUser(),
>>>>> configuration.getAgentSHAPassword(),
>>>>> configuration.getAgentAES128PassPhrase(),
>>>>> configuration.getTrapDestIPAddress(),
>>>>> configuration.getTrapPort());
>>>>>
>>>>> agent.start();
>>>>>
>>>>> // Since BaseAgent registers some mibs by default we need to unregister
>>>>> // one before we register our own sysDescr. Normally you would
>>>>> // override that method and register the mibs that you need
>>>>> agent.unregisterManagedObject(agent.getSnmpv2MIB());
>>>>>
>>>>> // Register a system description, use one from you product environment
>>>>> // to test with
>>>>>
>>>>> agent.registerManagedObject(MOCreator.createReadOnly(sysDescr,SYS_DE
>>>>> S
>>>>> C
>>>>> RIPTION));
>>>>>
>>>>> agent.registerManagedObject(MOCreator.createReadOnly(sysObjectID,
>>>>> new OID(configuration.getAgentBaseOID())));
>>>>>
>>>>> agent.registerManagedObject(MOCreator.createReadOnly(sysContact,SYS_
>>>>> C
>>>>> O
>>>>> NTACT));
>>>>>
>>>>> agent.registerManagedObject(MOCreator.createReadOnly(sysName,SYS_NAM
>>>>> E
>>>>> )
>>>>> );
>>>>>
>>>>> agent.registerManagedObject(MOCreator.createReadOnly(sysLocation,SYS
>>>>> _
>>>>> L
>>>>> OCATION));
>>>>>
>>>>> agent.registerManagedObject(MOCreator.createReadOnly(sysServices,SYS
>>>>> _
>>>>> S
>>>>> ERVICES));
>>>>>
>>>>> MOSSysUpTime = MOCreator.createReadWrite(sysUpTime, new
>>>>> TimeTicks((long)0));
>>>>> agent.registerManagedObject(MOSSysUpTime);
>>>>>
>>>>>
>>>>> I thank you in advance everybody will answer me.
>>>>> Denis
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> SNMP4J mailing list
>>>>> SNMP4J at agentpp.org
>>>>> https://oosnmp.net/mailman/listinfo/snmp4j
>>>> --
>>>> ---
>>>> AGENT++
>>>> Maximilian-Kolbe-Str. 10
>>>> 73257 Koengen, Germany
>>>> https://agentpp.com
>>>> Phone: +49 7024 8688230
>>>> Fax: +49 7024 8688231
>>>>
>>>> _______________________________________________
>>>> SNMP4J mailing list
>>>> SNMP4J at agentpp.org
>>>> https://oosnmp.net/mailman/listinfo/snmp4j
>>> --
>>> ---
>>> AGENT++
>>> Maximilian-Kolbe-Str. 10
>>> 73257 Koengen, Germany
>>> https://agentpp.com
>>> Phone: +49 7024 8688230
>>> Fax: +49 7024 8688231
>
> --
> ---
> AGENT++
> Maximilian-Kolbe-Str. 10
> 73257 Koengen, Germany
> https://agentpp.com
> Phone: +49 7024 8688230
> Fax: +49 7024 8688231
>
More information about the SNMP4J
mailing list