Hello!
I use source code from
http://www.net-snmp.org/wiki/index.php/TUT:Writing_a_Subagent tutorial.
I have run "snmpd -Le -f -Dagentx" under one consloe and "./subagent"
compiled from that sources under other console.
I have added to the subage code:
...
debug_register_tokens("nstAgentSubagentObject");
debug_register_tokens("snmp_alarm");
debug_register_tokens("agentx");
snmp_set_do_debugging(1);
netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_X_SOCKET, "udp:localhost:705");
...
Then
linux-h110 /root# snmpget -v1 -c rwpublic localhost
.1.3.6.1.4.1.8072.2.4.1.1.2.0
Timeout: No Response from localhost.
TCPDUMP shows:
linux-h110 /root# tcpdump -i lo
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on lo, link-type EN10MB (Ethernet), capture size 96 bytes
01:30:50.063287 IP localhost.33763 > localhost.snmp: C=rwpublic
GetRequest(33) E:8072.2.4.1.1.2.0
01:30:51.066819 IP localhost.33763 > localhost.snmp: C=rwpublic
GetRequest(33) E:8072.2.4.1.1.2.0
01:30:52.069128 IP localhost.33763 > localhost.snmp: C=rwpublic
GetRequest(33) E:8072.2.4.1.1.2.0
01:30:53.071589 IP localhost.33763 > localhost.snmp: C=rwpublic
GetRequest(33) E:8072.2.4.1.1.2.0
01:30:54.074751 IP localhost.33763 > localhost.snmp: C=rwpublic
GetRequest(33) E:8072.2.4.1.1.2.0
01:30:55.077898 IP localhost.33763 > localhost.snmp: C=rwpublic
GetRequest(33) E:8072.2.4.1.1.2.0
SNMPD shows:
agentx/master: agentx master handler starting, mode = 0xa0
agentx/master: request for variable
(NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0)
agentx: sending pdu (req=0x2,trans=0x1,sess=0x6)
agentx_build: packet built okay
agentx/master: agentx master handler starting, mode = 0xa0
agentx/master: request for variable
(NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0)
agentx: sending pdu (req=0x4,trans=0x3,sess=0x6)
agentx_build: packet built okay
agentx/master: agentx master handler starting, mode = 0xa0
agentx/master: request for variable
(NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0)
agentx: sending pdu (req=0x6,trans=0x5,sess=0x6)
agentx_build: packet built okay
agentx/master: agentx master handler starting, mode = 0xa0
agentx/master: request for variable
(NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0)
agentx: sending pdu (req=0x8,trans=0x7,sess=0x6)
agentx_build: packet built okay
agentx/master: agentx master handler starting, mode = 0xa0
agentx/master: request for variable
(NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0)
agentx: sending pdu (req=0xa,trans=0x9,sess=0x6)
agentx_build: packet built okay
agentx/master: agentx master handler starting, mode = 0xa0
agentx/master: request for variable
(NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0)
agentx: sending pdu (req=0xc,trans=0xb,sess=0x6)
agentx_build: packet built okay
SUBAGENT nothing receives:
linux-h110 /root# ./subagent
registered debug token nstAgentSubagentObject, 1
registered debug token snmp_alarm, 1
registered debug token agentx, 1
agentx_register_app_config_handler: registering .conf token for
"agentxsocket"
agentx/subagent: initializing....
agentx/subagent: subagent_init sess 0804f078
agentx/subagent: initializing.... DONE
nstAgentSubagentObject: Initializing the nstAgentSubagentObject module
nstAgentSubagentObject: Initalizing nstAgentSubagentObject scalar integer.
Default value = 123
nstAgentSubagentObject: Done initalizing nstAgentSubagentObject module
agentx/subagent: connecting to master...
agentx/subagent: agentx_reopen_session(0) called
agentx/subagent: opening session...
agentx/subagent: opening session
agentx_build: packet built okay
agentx/subagent: synching input, op 0x01
agentx/subagent: open
agentx/subagent: trap session registered OK
agentx/subagent: registering callbacks for session 0x8053e90
NET-SNMP version 5.4.2.1 AgentX subagent connected
agentx/subagent: opening session... DONE (0x8053e90)
agentx/subagent: registering:
NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0
agentx_build: packet built okay
agentx/subagent: synching input, op 0x01
agentx/subagent: registered
agentx/subagent: register ping alarm every 3600 seconds
snmp_alarm: registered alarm 1, t = 3600.000, flags=0x01
snmp_alarm: no alarms found to schedule
example-demon is up and running.
SNMPD.CONF:
master agentx
agentXSocket udp:192.168.89.130:705
syslocation Server Room
syscontact Sysadmin (r...@localhost)
rocommunity ropublic #localhost 192.168.89.130 192.168.89.129
rwcommunity rwpublic #localhost 192.168.89.130 192.168.89.129
trap2sink 192.168.89.130
trap2sink 192.168.89.129
Let me know please which settings are missed to pass get requests to
subagent?
Notice: if I shutdown subagent and run snmpget -v1 -c rwpublic localhost
nstAgentSubagentObject.0 I get:
linux-h110 /root# snmpget -v1 -c rwpublic localhost nstAgentSubagentObject.0
Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0
--
/BR, Alexander
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users