Re: Net-snmp 5.7.3 - Issue to communicate with subAgent and Master Agent

Larry Hayes <[email protected]>
Newsgroups gmane.network.net-snmp.devel
Message-ID <CAG3KfNY4iJQUQGvcbsJJ5uQyXXRw4K72SzXtmxJ0eigU7j3ZcQ@mail.gmail.com>
I am no expert, but I also run snmpd and a custom sub agent configuration.
Your sub agent should be registering with the master what OIDs it will
handle:
One line for each MIB.

    REGISTER_SYSOR_TABLE(companyx_oid, companyx_oid_len, "Top level MIB for
Company products");
    REGISTER_SYSOR_TABLE( companyx_base_oid,  companyx_base_oid_len, "MIB
for Company base OIDs");
    REGISTER_SYSOR_TABLE( companyx_events_oid,  companyx_events_oid_len,
"MIB for Company notifications and traps");
    REGISTER_SYSOR_TABLE( companyx_mgmt_oid,  companyx_mgmt_oid_len, "MIB
for Company Mgmt");

Larry Hayes

On Tue, Feb 4, 2020 at 5:20 PM Philippe Denis <[email protected]> wrote:

> Hello all,
> I've performed some actions to fix my problem(s) but I'm not sure the
> situation is the one that I though; it's.
>
> I though the Agentx and master agent are connected based on the following
> behaviour:
>
>    - I've started the Master agent followed by the Agentx, I got a
>    connection message.
>    - When stopping the Master Agent, I've seen a message saying that the
>    connection between the master agent and the subagent is broken. (message
>    AgentX master disconnected us, reconnecting in 15)
>    - Is it sufficient to be sure that the Master Agent and Sub-agentx are
>    correctly connected ?
>
>
> I've read that on Google that in the SubagentX configuration file, I need
> to declare the MIB which is allocated to the subagent. I'm not sure of the
>  keyword to use, I've added in the SubAgentx file: 'view all included'
> terminated by the value of my MIB OID. Is it correct ?
>
> If someone has some clues or advices to help me to clearly identify this
> problem.
>
> Thanks by advance
> Ph. DENIS
>
> Le lun. 3 févr. 2020 à 00:52, Philippe Denis <[email protected]> a
> écrit :
>
>> *Expéditeur:* Philippe Denis <[email protected]>
>>
>> *Date:* 3 février 2020 à 00:41:11 UTC+1
>> *Destinataire:* Magnus Fromreide <[email protected]>
>> *Objet:* *Rép:  Net-snmp 5.7.3 - Issue to communicate with subAgent and
>> Master Agent*
>>
>> Hello,
>>
>> I’ve succeeded to connect the sub-agent and the master agent by using the
>> /var/agents/master in the c code and also in conf. Files.
>>
>> Both are exchanging request but no value is received from local host or
>> through remote.
>>
>> I got the following error messages ‘´Timeout: No response from
>> localhost’’ when using a snmpget.
>>
>> Then I’m wondering if the objects which are part of my daemon are
>> correctly registered as I put a syslog in an handler and this one is never
>> displays.
>>
>> How can I know if the sub agent had registred correctly the OIDs?
>> Moreover, I read that as a good advice you can generate C code and test
>> it on the master agent and after that move it to the sub agent. This code
>> should not be impacted.
>>
>> Then what is the difference between netsnmp_register_long_instance and
>> the couple netsnmp_create_handler_registration & netsnmp_register_instance.
>> Which one should I used to register objects from my subagent?
>>
>> Thanks for your help.
>> Philippe DENIS
>>
>> Le 2 févr. 2020 à 23:07, Magnus Fromreide <[email protected]> a écrit
>> :
>>
>>
>> On Sun, Feb 02, 2020 at 02:13:59PM +0100, Philippe Denis wrote:
>>
>> Hello all,
>>
>>
>> I've a problem to communicate with my subAgent through the Master Agent.
>>
>> I've used the option -Dnetsnmp_udpbase and the message is correctly
>>
>> received at master Agent level (of course, the one which send from remote
>>
>> PC or localhost).
>>
>>
>> The Master Agent is not responding to the request sent by an snmpget
>>
>> command.
>>
>>
>> The Master Agent is launched with the this command line:
>>
>>
>>
>> *snmpd -Dnetsnmp_udpbase -f -Lo -C -c /usr/share/snmp/snmpd.conf
>>
>> -agentXSocket=tcp:localhost:1705 udp:1161 -VVV*
>>
>>
>> *See attached the log of the command:*
>>
>>
>> Could you please rerun the test with the agent debug flags
>>
>> -Dagentx -Dtdomain
>>
>>
>> -Dagentx logs the agentx interactions
>>
>> -Dtdomain logs all opening of sockets
>>
>>
>> *registered debug token netsnmp_udpbase, 1Log handling defined -
>>
>> disabling stderrTurning on AgentX master support.netsnmp_udpbase: open
>>
>> local UDP: [0.0.0.0]:1161->[0.0.0.0]:0netsnmp_udpbase: set
>>
>> IP_PKTINFOnetsnmp_udpbase: binding socket: 7 to UDP:
>>
>> [0.0.0.0]:0->[0.0.0.0]:1161NET-SNMP version 5.8*
>>
>>
>> Which is based on the one present in
>>
>> http://net-snmp.sourceforge.net/wiki/index.php/TUT:Writing_a_Subagent
>>
>>
>> The content of the snmpd.conf used is the following one:
>>
>>
>> master agentx
>>
>> agentxsocket /var/agentx/master
>>
>> agentxperms 777 777
>>
>>
>> rwuser MyCom_RW
>>
>> rouser MyCom_RO
>>
>>
>>
>> For the subagent, I'm using the following command line:
>>
>>
>> *./mysubagent -f -Lo -x  tcp:localhost:1705*
>>
>>
>>
>> *snmpget -v 2c -c MyCom_RW localhost .1.3.6.1.4.1.32699.255.4.1.0Timeout:
>>
>> No Response from localhost.*
>>
>>
>> I'm quite surprise my mib is known as the snmptranslate -Tp -IR MyTestmib
>>
>> answered correctly.
>>
>>
>> This means you have told snmptranslate where the mib is located. This is
>> good.
>>
>>
>> I've also used net-snmp 5.8 but still have the same result.
>>
>>
>> Thanks by avdance for your help
>>
>> --
>>
>> Cordialement
>>
>> Ph. DENIS
>>
>>
>>
>> _______________________________________________
>>
>> Net-snmp-coders mailing list
>>
>> [email protected]
>>
>> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
>>
>>
>>
>
> --
> Cordialement
> Ph. DENIS
> _______________________________________________
> Net-snmp-coders mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
>

_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.