Re: a question aboat "Writing a Subagent

shubham soni <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CA+ATxNJ0W6vRkb-OVT1tGoDomTffif30vZOE0RQOX5OUzx7gwA@mail.gmail.com>
By default netsnmp agent try to connect to master agentx on default
configuration that is default socket for connection is unix  socket and
that's why following error comes
"Warning: Failed to connect to the agentx master agent ([NIL]):"

Here NIL represent default unix  socket.

Solution :
Either configure agent configuration (example.conf) for connection at
tcp:localhost:1705, snmpd.conf is for SNMP demon for listen at that port (
must be there also)

Or add the following line in your example demon :
netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,NETSNMP_DS_AGENT_X_SOCKET,
"tcp:localhost:1705");

Hope this can help you .
On Aug 15, 2015 8:45 PM, "Mostafa Salari" <[email protected]> wrote:

> REALLY SORRY I PRESSED Ctrl+Enter AND NOT COMPLETED EMAIL HAS BEEN SENT
>
> Hello,
> I'm new to net-snmp agent. I am trying to do "Writing a Sub agent"
> tutorial as described in the following link:
>
> http://www.net-snmp.org/wiki/index.php/TUT:Writing_a_Subagent#Test_object_with_subagent
>
> I was successfull to compile and run my own agentx subagent using net-snmp
> --compile-subagent ... as described in the tutorial.
>
> I wrote a sub agent that reads any number of OIDs and Values from a text
> file and registers them via "netsnmp_register_long_instance" function. It
> works! but if the textfile changed the sub agennt must be killed and
> executed again so that snmpwalk shows the new values. SO: I want to write a
> sub agent that read the textfile repeatedly (for example every 5 secs).
>
> It would be thankful if you can help me.
>
> Best regards,
> thanks,
> Mustafa
>
>
> Appendix:
> I thought that maybe "Instrumenting your own code with agentx subagent
> support" topic in the above link can help me to write such a sub agent! So
> I tried to do the tutorial. But I cant get answere from "exemple-demon"
>
> The [make example-demon] command is successful, next I execute [*./example-demon
> &*] to sun the sub agent. but the "Warning: Failed to connect to the
> agentx master agent ([NIL]):" message is shown repeatedly after
> executation. Note thet I run snmpd with the following configuration
> before running example-demon:
> "
> #com2sec paranoid  default         public
> com2sec readonly  default         public
> com2sec readwrite default         private
> rocommunity public
> rwcommunity private
>  group MyROGroup v1 readonly
> view all included .1 80
> access MyROGroup "" any noauth exact all none none
> master agentx
> agentXSocket tcp:localhost:1705
> "
>
> Also the command [snmpget -c public -v1 localhost
> NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0] says that:
> "Error in packet
> Reason: (noSuchName) There is no such variable name in this MIB.
> Failed object: NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0"
>
> while I copied NET-SNMP-TUTORIAL-MIB.txt file in
> "/usr/local/share/snmp/mibs" directory and I append the file name to the
> end of "/var/net-snmp/mib_indexes/0" file!
>
> WHAT CAN I DO?
> THANKS.
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Net-snmp-users mailing list
> [email protected]
> Please see the following page to unsubscribe or change other options:
> https://lists.sourceforge.net/lists/listinfo/net-snmp-users
>
>

------------------------------------------------------------------------------

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
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.