Difference between revisions of "Talk:TUT:Simple Application"
From Net-SNMP Wiki
Line 43: | Line 43: | ||
SNMPv2-MIB::sysDescr.0 = STRING: FreeBSD snmptest.netsec.tislabs.com 5.4-RELEASE-p9 FreeBSD 5.4-RELEASE-p9 #0: Thu Jan 12 05:31:33 UTC 2006 root@zathras.netsec.tislabs.com:/usr/obj/usr/src/sys/GENERIC i386 | SNMPv2-MIB::sysDescr.0 = STRING: FreeBSD snmptest.netsec.tislabs.com 5.4-RELEASE-p9 FreeBSD 5.4-RELEASE-p9 #0: Thu Jan 12 05:31:33 UTC 2006 root@zathras.netsec.tislabs.com:/usr/obj/usr/src/sys/GENERIC i386 | ||
value #1 is a string: FreeBSD snmptest.netsec.tislabs.com 5.4-RELEASE-p9 FreeBSD 5.4-RELEASE-p9 #0: Thu Jan 12 05:31:33 UTC 2006 root@zathras.netsec.tislabs.com:/usr/obj/usr/src/sys/GENERIC i386 | value #1 is a string: FreeBSD snmptest.netsec.tislabs.com 5.4-RELEASE-p9 FreeBSD 5.4-RELEASE-p9 #0: Thu Jan 12 05:31:33 UTC 2006 root@zathras.netsec.tislabs.com:/usr/obj/usr/src/sys/GENERIC i386 | ||
+ | |||
[igor@ ~/snmp_client_00]$ uname -a | [igor@ ~/snmp_client_00]$ uname -a | ||
FreeBSD 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jan 12 10:40:27 UTC 2007 root@dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 | FreeBSD 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jan 12 10:40:27 UTC 2007 root@dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 | ||
[igor@ ~/snmp_client_00]$ | [igor@ ~/snmp_client_00]$ | ||
+ | |||
+ | [igor@ ~/snmp_client_00]$ snmpwalk -Os -c igorbuchmueller -v 1 10.211.55.3 system.sysDescr.0 | ||
+ | sysDescr.0 = STRING: FreeBSD 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jan 12 10:40:27 UTC 2007 | ||
+ | root@dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 |
Revision as of 19:38, 13 September 2007
The example Makefile is a little big. The following worked for me:
Makefile:
# # Warning: you may need more libraries than are included here on the # build line. The agent frequently needs various libraries in order # to compile pieces of it, but is OS dependent and we can't list all # the combinations here. Instead, look at the libraries that were # used when linking the snmpd master agent and copy those to this # file. # CC=gcc OBJS1=snmpdemoapp.o TARGETS=snmpdemoapp CFLAGS=-I. `net-snmp-config --cflags` BUILDLIBS=`net-snmp-config --libs` BUILDAGENTLIBS=`net-snmp-config --agent-libs` # shared library flags (assumes gcc) DLFLAGS=-fPIC -shared all: $(TARGETS) snmpdemoapp: $(OBJS1) $(CC) -o snmpdemoapp $(OBJS1) $(BUILDLIBS) clean: rm $(TARGETS)
Output:
[igor@ ~/snmp_client_00]$ make gcc -I. `net-snmp-config --cflags` -c snmpdemoapp.c gcc -o snmpdemoapp snmpdemoapp.o `net-snmp-config --libs` [igor@ ~/snmp_client_00]$ ./snmpdemoapp SNMPv2-MIB::sysDescr.0 = STRING: FreeBSD snmptest.netsec.tislabs.com 5.4-RELEASE-p9 FreeBSD 5.4-RELEASE-p9 #0: Thu Jan 12 05:31:33 UTC 2006 root@zathras.netsec.tislabs.com:/usr/obj/usr/src/sys/GENERIC i386 value #1 is a string: FreeBSD snmptest.netsec.tislabs.com 5.4-RELEASE-p9 FreeBSD 5.4-RELEASE-p9 #0: Thu Jan 12 05:31:33 UTC 2006 root@zathras.netsec.tislabs.com:/usr/obj/usr/src/sys/GENERIC i386
[igor@ ~/snmp_client_00]$ uname -a FreeBSD 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jan 12 10:40:27 UTC 2007 root@dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 [igor@ ~/snmp_client_00]$
[igor@ ~/snmp_client_00]$ snmpwalk -Os -c igorbuchmueller -v 1 10.211.55.3 system.sysDescr.0 sysDescr.0 = STRING: FreeBSD 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jan 12 10:40:27 UTC 2007 root@dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386