Discussion:
a question aboat "Writing a Subagent
(too old to reply)
Mostafa Salari
2015-08-15 15:05:36 UTC
Permalink
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). I thought that
Mostafa Salari
2015-08-15 15:09:55 UTC
Permalink
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.
shubham soni
2015-08-15 16:45:24 UTC
Permalink
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 .
Post by Mostafa Salari
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"
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
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
"
#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
"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
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
Loading...