File: testtraps.sh

package info (click to toggle)
snmptrapfmt 1.11
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 136 kB
  • ctags: 88
  • sloc: ansic: 1,330; sh: 90; makefile: 27
file content (44 lines) | stat: -rwxr-xr-x 1,301 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
#
# Send some test traps

if [ $# -eq 0 ]; then
  echo "usage: $(basename $0) target-host"
  exit 1
fi


# V1 Traps
echo "Send V1 Trap ..."
snmptrap -v 1 -c trap-comm $1 \
            .1.3.6.1.4.1.11.2.17.1 \
            192.168.0.1 \
            6 123456 18012202 \
            .1.3.6.1.4.1.11.2.17.2.1 s "First \"Arg\" (with quotes)" \
            .1.3.6.1.4.1.11.2.17.2.2 i 504 \
	    .1.3.6.1.4.1.11.2.17.2.3 a 192.168.0.78 \
	    .1.3.6.1.4.1.11.2.17.2.4 s "String with hash (#)"

snmptrap -v 1 -c trap-comm $1 \
            .1.3.6.1.4.1.11.2.17.1 \
            192.168.0.1 \
            1 0 18012203

echo "Send V2 Trap ..."
snmptrap -v2c -c geheim $1 \
	    18012204 \
            .1.3.6.1.4.1.11.2.17.1.0.123457 \
	    .1.3.6.1.6.3.18.1.3.0 a 192.168.0.1 \
	    .1.3.6.1.6.3.18.1.4.0 s geheim \
	    .1.3.6.1.6.3.1.1.4.3.0 o .1.3.6.1.4.1.11.2.17.1 \
            .1.3.6.1.4.1.11.2.17.2.1 s "First \"Arg\" (with quotes)" \
            .1.3.6.1.4.1.11.2.17.2.2 i 504 \
	    .1.3.6.1.4.1.11.2.17.2.3 a 192.168.0.78 \
	    .1.3.6.1.4.1.11.2.17.2.4 s "String with hash (#)"

snmptrap -v2c -c geheim $1 \
	    18012205 \
            .1.3.6.1.6.3.1.1.5.2 \
	    .1.3.6.1.6.3.18.1.3.0 a 192.168.0.1 \
	    .1.3.6.1.6.3.18.1.4.0 s geheim \
	    .1.3.6.1.6.3.1.1.4.3.0 o .1.3.6.1.4.1.11.2.17.1