2012-02-02 03:20 AM
Here is a sample session showing some basic uses of SNMP for remote management of an STM32-based device. This session was run under uClinux on an STM322G-EVAL board with Emraft's STM-MEM add-on. (Refer to www.emcraft.com for further information on that platform.)
After reset, U-boot comes on from embedded Flash and proceeds to boot uClinux onto the board:U-Boot 2010.03-linux-cortexm-1.3.1 (Jan 17 2012 - 16:51:54) CPU : STM32 F2 series (Cortex-M3) Freqs: SYSCLK=120MHz,HCLK=120MHz,PCLK1=30MHz,PCLK2=60MHz Board: STM3220G-EVAL board 1 DRAM: 32 MB Flash: 8 MB ...
♯♯ Booting kernel from Legacy Image at 60020000 ... ... Linux version 2.6.33-arm1 (mailto:psl@ocean.emcraft.com
) (gcc version 4.4.1 (Sourcery G++ Lite 2010q1-188) ) &sharp1 Tue Jan 17 17:28:16 MSK 2012 ..init started: BusyBox v1.17.0 (2012-01-17 17:26:56 MSK) ~ ♯ From the shell prompt, I start an SNMP agent:~ ♯ snmpd -C -c /etc/snmpd.conf -Le -fNET-SNMP version 5.6.1
Now, I am able to query my STM32 device remotely using standard SNMP tools. For instance, here is how this is done from a Linux PC box:[psl@pvr ~]$ snmpget -v1 -c public 172.17.5.100 .1.3.6.1.2.1.1.1.0 SNMPv2-MIB::sysDescr.0 = STRING: Linux stm3220g-eval 2.6.33-arm1 &sharp139 Thu Feb 2 14:19:32 MSK 2012 armv7ml [psl@pvr ~]$
Back to the target, and here is how I send a trap event to remote management tools:~ ♯ snmptrap -v 1 -c public 172.17.0.212 '1.2.3.4.5.6' '192.193.194.195' 6 99 '55' 1.11.12.13.14.15 s ''I'm here''
When I check SNMP traps at the host, the trap from STM32 is reported as appropriate:[root@pvr ~]♯ snmptrapd -C -c /home/work/psl/SF/release/snmptrapd.conf -Le -fNET-SNMP version 5.5 2012-02-02 13:52:55 192.193.194.195(via UDP: [172.17.5.100]:53140->[172.17.0.212]) TRAP, SNMP v1, community public iso.2.3.4.5.6 Enterprise Specific Trap (99) Uptime: 0:00:00.55 iso.11.12.13.14.15 = STRING: ''I'm here''
#uclinux-stm322012-02-05 03:22 PM