Greetings,
I am looking at:
http://www.net-snmp.org/wiki/index.php/TUT:Writing_a_Subagent
and am having some trouble making it work.
I've downloaded the code:
the NET-SNMP-TUTORIAL-MIB MIB, and the example mib module and it's header file.
I've built the subagent:
$ net-snmp-config --compile-subagent mysubagent nstAgentSubagentObject.c
generating the temporary code file: netsnmptmp.5644.c
void init_nstAgentSubagentObject(void);
checking for init_nstAgentSubagentObject in nstAgentSubagentObject.c
init_nstAgentSubagentObject(void)
checking for shutdown_nstAgentSubagentObject in nstAgentSubagentObject.c
running: gcc -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -g -O2
-fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
-DNETSNMP_USE_INLINE -Ulinux -Dlinux=linux -D_REENTRANT -D_GNU_SOURCE -DDEBIAN
-fstack-protector -fno-strict-aliasing -pipe -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/perl/5.18/CORE -I.
-I/usr/include -o mysubagent netsnmptmp.5644.c nstAgentSubagentObject.c
-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -L/usr/lib/x86_64-linux-gnu
-lnetsnmpmibs -lnetsnmpagent -lnetsnmp -lnetsnmpmibs -lsensors -ldl
-lnetsnmpagent -lwrap -Wl,-E -lnetsnmp -lcrypto
nstAgentSubagentObject.c: In function ‘init_nstAgentSubagentObject’:
nstAgentSubagentObject.c:47:5: warning: format ‘%d’ expects argument of type
‘int’, but argument 3 has type ‘long int’ [-Wformat=]
DEBUGMSGTL(("nstAgentSubagentObject",
^
nstAgentSubagentObject.c:47:5: warning: format ‘%d’ expects argument of type
‘int’, but argument 3 has type ‘long int’ [-Wformat=]
removing the temporary code file: netsnmptmp.5644.c
subagent program mysubagent created
peter@Asset-507:~/src/netsnmpdemo$ net-snmp-config --compile-subagent
mysubagent nstAgentSubagentObject.c
generating the temporary code file: netsnmptmp.5675.c
void init_nstAgentSubagentObject(void);
checking for init_nstAgentSubagentObject in nstAgentSubagentObject.c
init_nstAgentSubagentObject(void)
checking for shutdown_nstAgentSubagentObject in nstAgentSubagentObject.c
running: gcc -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -g -O2
-fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
-DNETSNMP_USE_INLINE -Ulinux -Dlinux=linux -D_REENTRANT -D_GNU_SOURCE -DDEBIAN
-fstack-protector -fno-strict-aliasing -pipe -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/perl/5.18/CORE -I.
-I/usr/include -o mysubagent netsnmptmp.5675.c nstAgentSubagentObject.c
-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -L/usr/lib/x86_64-linux-gnu
-lnetsnmpmibs -lnetsnmpagent -lnetsnmp -lnetsnmpmibs -lsensors -ldl
-lnetsnmpagent -lwrap -Wl,-E -lnetsnmp -lcrypto
nstAgentSubagentObject.c: In function ‘init_nstAgentSubagentObject’:
nstAgentSubagentObject.c:47:5: warning: format ‘%d’ expects argument of type
‘int’, but argument 3 has type ‘long int’ [-Wformat=]
DEBUGMSGTL(("nstAgentSubagentObject",
^
nstAgentSubagentObject.c:47:5: warning: format ‘%d’ expects argument of type
‘int’, but argument 3 has type ‘long int’ [-Wformat=]
removing the temporary code file: netsnmptmp.5675.c
subagent program mysubagent created
I've started the daemon
$ snmpd -f -Lo -C --rwcommunity=public --master=agentx
--agentXSocket=tcp:localhost:1705 udp:1161
Turning on AgentX master support.
[init_smux] bind failed: Permission denied
Cannot rename /var/lib/snmp/snmpd.conf to /var/lib/snmp/snmpd.0.conf
Cannot unlink /var/lib/snmp/snmpd.conf
read_config_store open failure on /var/lib/snmp/snmpd.conf
read_config_store open failure on /var/lib/snmp/snmpd.conf
read_config_store open failure on /var/lib/snmp/snmpd.conf
read_config_store open failure on /var/lib/snmp/snmpd.conf
read_config_store open failure on /var/lib/snmp/snmpd.conf
read_config_store open failure on /var/lib/snmp/snmpd.conf
read_config_store open failure on /var/lib/snmp/snmpd.conf
read_config_store open failure on /var/lib/snmp/snmpd.conf
read_config_store open failure on /var/lib/snmp/snmpd.conf
read_config_store open failure on /var/lib/snmp/snmpd.conf
read_config_store open failure on /var/lib/snmp/snmpd.conf
read_config_store open failure on /var/lib/snmp/snmpd.conf
read_config_store open failure on /var/lib/snmp/snmpd.conf
read_config_store open failure on /var/lib/snmp/snmpd.conf
NET-SNMP version 5.7.2
And started the subagent:
$ ./mysubagent -f -Lo -x tcp:localhost:1705
NET-SNMP version 5.7.2 AgentX subagent connected
Up to this point, everything appear copacetic
So, now I try to run the snmpget:
$ snmpget localhost NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0
snmpget: Timeout
In case it is important, I am using ubuntu 14.04 and the bundled net-snmp
software:
Start-Date: 2015-01-30 16:03:01
Commandline: aptdaemon role='role-commit-packages' sender=':1.227'
Install: snmp:amd64 (5.7.2~dfsg-8.1ubuntu3)
End-Date: 2015-01-30 16:03:02
Start-Date: 2015-01-30 16:03:30
Commandline: apt-get install libsnmp-dev
Install: libsnmp-dev:amd64 (5.7.2~dfsg-8.1ubuntu3), libwrap0-dev:amd64
(7.6.q-25, automatic), libssl-dev:amd64 (1.0.1f-1ubuntu2.8, automatic),
libssl-doc:amd64 (1.0.1f-1ubuntu2.8, automatic), libsensors4-dev:amd64
(3.3.4-2ubuntu1, automatic)
End-Date: 2015-01-30 16:03:33
Start-Date: 2015-01-30 16:09:30
Commandline: apt-get install libnet-snmp-perl
Install: libnet-snmp-perl:amd64 (6.0.1-2)
End-Date: 2015-01-30 16:09:32
Start-Date: 2015-01-30 16:09:59
Commandline: apt-get install libsnmp-mib-compiler-perl
Install: libsnmp-mib-compiler-perl:amd64 (0.06-2)
End-Date: 2015-01-30 16:10:00
Start-Date: 2015-01-30 16:10:36
Commandline: apt-get install libsnmp-multi-perl libsnmp-perl
Install: libsnmp-perl:amd64 (5.7.2~dfsg-8.1ubuntu3), libsnmp-multi-perl:amd64
(2.1-4)
End-Date: 2015-01-30 16:10:38
Start-Date: 2015-02-02 09:24:29
Commandline: aptdaemon role='role-commit-packages' sender=':1.97'
Install: snmp-mibs-downloader:amd64 (1.1), smistrip:amd64
(0.4.8+dfsg2-8ubuntu2, automatic)
End-Date: 2015-02-02 09:24:37
Start-Date: 2015-02-04 10:33:18
Commandline: apt-get install snmpd
Install: snmpd:amd64 (5.7.2~dfsg-8.1ubuntu3), mysql-common:amd64
(5.5.41-0ubuntu0.14.04.1, automatic), libmysqlclient18:amd64
(5.5.41-0ubuntu0.14.04.1, automatic)
End-Date: 2015-02-04 10:33:20
Any guesses as to the failure?
Peter.
?
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
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