tl;dr -
Go here.
I've been doing a lot of SNMP polling through Groovy lately. One of the methods I use most often is Snmp.walkAsMap(), which returns a map that looks like this:
[8.6:2, 4.10:1500, 8.7:1, 8.8:1, 4.12:1500, 4.14:1500, 4.16:1500, 3.44:6, 22.5:0.0, 22.4:0.0,
22.3:0.0, 22.2:0.0, 22.1:0.0, 22.8:0.0, 22.7:0.0, 22.6:0.0, 17.16:164136, 16.44:6639007, 17.12:8634086,
18.8:0, 17.14:8745523, 18.7:0, 17.10:21076, 10.6:0, 10.5:0, 10.4:0, 10.3:0, 10.2:3968863511, 10.1:8980402,
22.44:0.0, 18.6:0, 18.5:0, 7.1:1, 18.4:0, 7.2:1, 18.3:0, 7.3:1, 18.2:0, 7.4:1, 18.1:0, 7.5:1, 10.8:1684285,
7.6:2, 10.7:4181064938, 7.7:1, 7.8:1, 15.44:0, 16.12:2114735865, 16.10:4077101, 16.16:16467729,
16.14:2361323502, 22.14:0.0, 22.16:0.0, 9.44:2 days, 14:54:42.04, 21.6:0, 21.5:0, 21.4:0, 21.3:0,
21.2:0, 21.1:0, 22.10:0.0, 22.12:0.0, 21.44:0, 21.8:0, 21.7:0, 5.10:4294967295, 4.44:1500, 5.12:4294967295,
5.14:4294967295, 11.10:0, 5.16:4294967295, 10.44:1620014, 11.12:12487957, 17.8:30812, 11.14:12673362,
17.7:17502386, 6.1:, 17.6:0, 6.2:90:e6:ba:59:1b:18, 11.16:136053, 17.5:0, 6.3:00:50:56:c0:00:01,
17.4:20226, 6.4:00:50:56:c0:00:08, 17.3:20229, 6.5:52:54:00:9b:4b:e0, 17.2:37200831, 6.6:52:54:00:9b:4b:e0,
17.1:44466, 6.7:02:42:39:1b:cc:e3, 6.8:02:42:55:44:3f:06, 10.10:0, 20.7:0, 20.6:0, 20.5:0, 20.4:0, 20.3:0,
20.2:0, 20.1:0, 10.12:30849041, 10.14:131456967, 10.16:77954842, 20.8:0, 5.1:10000000, 16.8:17045376,
5.2:100000000, 16.7:189459674, 5.3:0, 16.6:0, 5.4:0, 16.5:0, 5.5:0, 16.4:0, 5.6:10000000, 16.3:0, 5.7:0,
16.2:1009509757, 5.8:0, 16.1:8980402, 6.12:4e:c1:4e:e6:07:90, 5.44:4294967295, 6.14:0a:2c:4f:3a:eb:5c,
6.16:12:db:e0:82:ca:a2, 19.44:0, 6.10:06:31:50:31:a5:fb, 15.12:0, 14.44:0, 15.10:0, 21.16:0, 15.16:0,
21.14:0, 15.14:0, 20.44:0, 21.12:0, 1.12:12, 1.10:10, 15.1:0, 4.1:65536, 4.2:1500, 4.3:1500, 15.8:0,
21.10:0, 4.4:1500, 15.7:0, 4.5:1500, 15.6:0, 4.6:1500, 15.5:0, 4.7:1500, 15.4:0, 4.8:1500, 15.3:0,
15.2:0, 14.10:0, 20.16:0, 14.14:0, 20.14:0, 13.44:0, 14.12:0, 20.12:0, 1.16:16, 1.14:14, 20.10:0, 14.16:0,
6.44:62:d0:3f:14:ef:85, 7.12:1, 7.14:1, 7.16:1, 7.10:1, 14.2:0, 14.1:0, 3.1:24, 3.2:6, 3.3:6, 3.4:6, 3.5:6,
14.8:0, 3.6:6, 14.7:0, 3.7:6, 14.6:0, 3.8:6, 14.5:0, 14.4:0, 14.3:0, 2.14:veth9a64fa1, 2.12:veth2bc8fbd,
1.44:44, 2.10:veth92ca0b0, 19.14:0, 19.16:0, 19.10:0, 19.12:0, 18.44:0, 13.3:0, 13.2:0, 13.1:0, 2.1:lo,
2.2:NVIDIA Corporation MCP77 Ethernet, 2.16:veth497df7f, 2.3:vmnet1, 2.4:vmnet8, 2.5:virbr0, 2.6:virbr0-nic,
2.7:br-6a2604a91ac1, 13.8:0, 2.8:docker0, 13.7:0, 13.6:0, 13.5:0, 13.4:0, 18.16:0, 8.16:1, 8.14:1,
17.44:18857, 18.12:0, 18.14:0, 18.10:0, 8.12:1, 7.44:1, 8.10:1, 13.10:0, 12.44:0, 13.14:0, 13.12:0,
3.14:6, 2.44:vethd608288, 3.12:6, 3.10:6, 12.4:0, 12.3:0, 12.2:2662, 12.1:0, 1.1:1, 1.2:2, 1.3:3, 1.4:4,
1.5:5, 1.6:6, 1.7:7, 1.8:8, 13.16:0, 9.1:0:00:00.00, 12.8:0, 9.2:0:00:00.00, 12.7:0, 9.3:0:00:06.31, 12.6:0,
9.4:0:00:06.31, 12.5:0, 9.5:0:00:09.32, 9.6:0:00:12.32, 9.7:3:03:43.67, 9.8:0:00:18.32, 12.10:0, 11.44:4506,
12.12:0, 3.16:6, 12.14:0, 12.16:0, 9.16:3:03:43.67, 9.14:3:03:43.67, 19.8:0, 19.7:0, 19.6:0, 8.44:1,
9.12:3:03:43.67, 9.10:0:00:18.32, 11.5:0, 11.4:0, 11.3:0, 11.2:28692938, 11.1:44466, 19.5:0, 19.4:0,
19.3:0, 8.1:1, 19.2:0, 8.2:1, 19.1:0, 8.3:1, 11.8:6882, 8.4:1, 11.7:25297372, 8.5:2, 11.6:0]
This great and usable, but I found myself constantly wanting to display the data easier. I also wanted the data to be structured a little more hierarchically, grouping by row in the SNMP table. I also wanted to make it easier to address individual pieces of the data. I built a couple helper functions that transform the data and make it easier to address. They can be found
here.
The output of the snmpMapToTable() function looks like this:
[6:[8:2, 22:0.0, 10:0, 18:0, 7:2, 21:0, 17:0, 6:52:54:00:9b:4b:e0, 20:0, 16:0, 5:10000000, 15:0, 4:1500,
3:6, 14:0, 2:virbr0-nic, 13:0, 1:6, 12:0, 9:0:00:12.32, 19:0, 11:0], 10:[4:1500, 17:21076, 16:4077101, 22:0.0,
5:4294967295, 11:0, 10:0, 6:06:31:50:31:a5:fb, 15:0, 1:10, 21:0, 14:0, 20:0, 7:1, 2:veth92ca0b0, 19:0, 18:0,
8:1, 13:0, 3:6, 12:0, 9:0:00:18.32], 7:[8:1, 22:0.0, 18:0, 10:4181064938, 7:1, 21:0, 17:17502386,
6:02:42:39:1b:cc:e3, 20:0, 16:189459674, 5:0, 15:0, 4:1500, 14:0, 3:6, 2:br-6a2604a91ac1, 13:0, 1:7,
12:0, 9:3:03:43.67, 19:0, 11:25297372], 8:[8:1, 22:0.0, 18:0, 10:1684285, 7:1, 21:0, 17:30812,
6:02:42:55:44:3f:06, 20:0, 16:17045376, 5:0, 15:0, 4:1500, 14:0, 3:6, 13:0, 2:docker0, 1:8, 12:0,
9:0:00:18.32, 19:0, 11:6882], 12:[4:1500, 17:8634086, 16:2114735865, 22:0.0, 5:4294967295,
11:12487957, 10:30849041, 6:4e:c1:4e:e6:07:90, 15:0, 21:0, 1:12, 14:0, 20:0, 7:1, 2:veth2bc8fbd,
19:0, 18:0, 8:1, 13:0, 3:6, 12:0, 9:3:03:43.67], 14:[4:1500, 17:8745523, 16:2361323502, 22:0.0,
5:4294967295, 11:12673362, 10:131456967, 6:0a:2c:4f:3a:eb:5c, 21:0, 15:0, 14:0, 20:0, 1:14, 7:1,
2:veth9a64fa1, 19:0, 8:1, 18:0, 13:0, 3:6, 12:0, 9:3:03:43.67], 16:[4:1500, 17:164136, 16:16467729,
22:0.0, 5:4294967295, 11:136053, 10:77954842, 6:12:db:e0:82:ca:a2, 21:0, 15:0, 20:0, 1:16, 14:0,
7:1, 19:0, 2:veth497df7f, 18:0, 8:1, 13:0, 3:6, 12:0, 9:3:03:43.67], 44:[3:6, 16:6639007, 22:0.0,
15:0, 9:2 days, 14:54:42.04, 21:0, 4:1500, 10:1620014, 5:4294967295, 19:0, 14:0, 20:0,
13:0, 6:62:d0:3f:14:ef:85, 1:44, 18:0, 17:18857, 7:1, 12:0, 2:vethd608288, 11:4506, 8:1], 5:[22:0.0,
10:0, 18:0, 7:1, 21:0, 17:0, 6:52:54:00:9b:4b:e0, 20:0, 16:0, 5:0, 4:1500, 15:0, 3:6, 14:0, 2:virbr0,
13:0, 1:5, 12:0, 9:0:00:09.32, 11:0, 19:0, 8:2], 4:[22:0.0, 10:0, 18:0, 7:1, 21:0, 17:20226,
6:00:50:56:c0:00:08, 20:0, 5:0, 16:0, 4:1500, 15:0, 3:6, 14:0, 2:vmnet8, 13:0, 12:0, 1:4, 9:0:00:06.31,
11:0, 19:0, 8:1], 3:[22:0.0, 10:0, 18:0, 7:1, 21:0, 6:00:50:56:c0:00:01, 17:20229, 20:0, 5:0, 16:0,
4:1500, 15:0, 3:6, 14:0, 13:0, 2:vmnet1, 12:0, 1:3, 9:0:00:06.31, 11:0, 19:0, 8:1], 2:[22:0.0,
10:3968863511, 7:1, 18:0, 21:0, 6:90:e6:ba:59:1b:18, 17:37200831, 20:0, 5:100000000, 16:1009509757,
4:1500, 15:0, 14:0, 3:6, 13:0, 2:NVIDIA Corporation MCP77 Ethernet, 12:2662, 1:2, 9:0:00:00.00,
11:28692938, 19:0, 8:1], 1:[22:0.0, 10:8980402, 7:1, 18:0, 21:0, 6:, 17:44466, 20:0, 5:10000000,
16:8980402, 15:0, 4:65536, 14:0, 3:24, 13:0, 2:lo, 12:0, 1:1, 9:0:00:00.00, 11:44466, 8:1, 19:0]]
It may not look much better, but if you add some carriage returns and tabs you get this:
[
6:[
8:2, 22:0.0, 10:0, 18:0, 7:2, 21:0, 17:0, 6:52:54:00:9b:4b:e0,
20:0, 16:0, 5:10000000, 15:0, 4:1500, 3:6, 14:0, 2:virbr0-nic,
13:0, 1:6, 12:0, 9:0:00:12.32, 19:0, 11:0],
10:[
4:1500, 17:21076, 16:4077101, 22:0.0, 5:4294967295, 11:0, 10:0,
6:06:31:50:31:a5:fb, 15:0, 1:10, 21:0, 14:0, 20:0, 7:1, 2:veth92ca0b0,
19:0, 18:0, 8:1, 13:0, 3:6, 12:0, 9:0:00:18.32],
7:[
8:1, 22:0.0, 18:0, 10:4181064938, 7:1, 21:0, 17:17502386, 6:02:42:39:1b:cc:e3,
20:0, 16:189459674, 5:0, 15:0, 4:1500, 14:0, 3:6, 2:br-6a2604a91ac1, 13:0, 1:7,
12:0, 9:3:03:43.67, 19:0, 11:25297372],
8:[
8:1, 22:0.0, 18:0, 10:1684285, 7:1, 21:0, 17:30812, 6:02:42:55:44:3f:06, 20:0,
16:17045376, 5:0, 15:0, 4:1500, 14:0, 3:6, 13:0, 2:docker0, 1:8, 12:0, 9:0:00:18.32,
19:0, 11:6882],
12:[
4:1500, 17:8634086, 16:2114735865, 22:0.0, 5:4294967295, 11:12487957, 10:30849041,
6:4e:c1:4e:e6:07:90, 15:0, 21:0, 1:12, 14:0, 20:0, 7:1, 2:veth2bc8fbd, 19:0, 18:0, 8:1,
13:0, 3:6, 12:0, 9:3:03:43.67],
14:[
4:1500, 17:8745523, 16:2361323502, 22:0.0, 5:4294967295, 11:12673362, 10:131456967,
6:0a:2c:4f:3a:eb:5c, 21:0, 15:0, 14:0, 20:0, 1:14, 7:1, 2:veth9a64fa1, 19:0, 8:1, 18:0,
13:0, 3:6, 12:0, 9:3:03:43.67],
16:[
4:1500, 17:164136, 16:16467729, 22:0.0, 5:4294967295, 11:136053, 10:77954842,
6:12:db:e0:82:ca:a2, 21:0, 15:0, 20:0, 1:16, 14:0, 7:1, 19:0, 2:veth497df7f, 18:0,
8:1, 13:0, 3:6, 12:0, 9:3:03:43.67],
44:[
3:6, 16:6639007, 22:0.0, 15:0, 9:2 days, 14:54:42.04, 21:0, 4:1500, 10:1620014,
5:4294967295, 19:0, 14:0, 20:0, 13:0, 6:62:d0:3f:14:ef:85, 1:44, 18:0, 17:18857,
7:1, 12:0, 2:vethd608288, 11:4506, 8:1],
5:[
22:0.0, 10:0, 18:0, 7:1, 21:0, 17:0, 6:52:54:00:9b:4b:e0, 20:0, 16:0, 5:0, 4:1500,
15:0, 3:6, 14:0, 2:virbr0, 13:0, 1:5, 12:0, 9:0:00:09.32, 11:0, 19:0, 8:2],
4:[
22:0.0, 10:0, 18:0, 7:1, 21:0, 17:20226, 6:00:50:56:c0:00:08, 20:0, 5:0, 16:0,
4:1500, 15:0, 3:6, 14:0, 2:vmnet8, 13:0, 12:0, 1:4, 9:0:00:06.31, 11:0, 19:0, 8:1],
3:[
22:0.0, 10:0, 18:0, 7:1, 21:0, 6:00:50:56:c0:00:01, 17:20229, 20:0, 5:0, 16:0, 4:1500,
15:0, 3:6, 14:0, 13:0, 2:vmnet1, 12:0, 1:3, 9:0:00:06.31, 11:0, 19:0, 8:1],
2:[
22:0.0, 10:3968863511, 7:1, 18:0, 21:0, 6:90:e6:ba:59:1b:18, 17:37200831, 20:0,
5:100000000, 16:1009509757, 4:1500, 15:0, 14:0, 3:6, 13:0,
2:NVIDIA Corporation MCP77 Ethernet, 12:2662, 1:2, 9:0:00:00.00, 11:28692938, 19:0, 8:1],
1:[
22:0.0, 10:8980402, 7:1, 18:0, 21:0, 6:, 17:44466, 20:0, 5:10000000, 16:8980402, 15:0,
4:65536, 14:0, 3:24, 13:0, 2:lo, 12:0, 1:1, 9:0:00:00.00, 11:44466, 8:1, 19:0]
]
As you can see, it's getting easier to see what's going on. At this point, it'd be nice to order by instance ID and also order by metric ID. One of the helper functions I built does just that, pprintSnmpWalkTable:
Wildvalue: 1:
Data sorted by column ID
1.##WILDVALUE##: 1
2.##WILDVALUE##: lo
3.##WILDVALUE##: 24
4.##WILDVALUE##: 65536
5.##WILDVALUE##: 10000000
6.##WILDVALUE##:
7.##WILDVALUE##: 1
8.##WILDVALUE##: 1
9.##WILDVALUE##: 0:00:00.00
10.##WILDVALUE##: 8980402
11.##WILDVALUE##: 44466
12.##WILDVALUE##: 0
13.##WILDVALUE##: 0
14.##WILDVALUE##: 0
15.##WILDVALUE##: 0
16.##WILDVALUE##: 8980402
17.##WILDVALUE##: 44466
18.##WILDVALUE##: 0
19.##WILDVALUE##: 0
20.##WILDVALUE##: 0
21.##WILDVALUE##: 0
22.##WILDVALUE##: 0.0
Wildvalue: 2:
Data sorted by column ID
1.##WILDVALUE##: 2
2.##WILDVALUE##: NVIDIA Corporation MCP77 Ethernet
3.##WILDVALUE##: 6
4.##WILDVALUE##: 1500
5.##WILDVALUE##: 100000000
6.##WILDVALUE##: 90:e6:ba:59:1b:18
7.##WILDVALUE##: 1
8.##WILDVALUE##: 1
9.##WILDVALUE##: 0:00:00.00
10.##WILDVALUE##: 3968863511
11.##WILDVALUE##: 28692938
12.##WILDVALUE##: 2662
13.##WILDVALUE##: 0
14.##WILDVALUE##: 0
15.##WILDVALUE##: 0
16.##WILDVALUE##: 1009509757
17.##WILDVALUE##: 37200831
18.##WILDVALUE##: 0
19.##WILDVALUE##: 0
20.##WILDVALUE##: 0
21.##WILDVALUE##: 0
22.##WILDVALUE##: 0.0
Wildvalue: 3:
Data sorted by column ID
1.##WILDVALUE##: 3
2.##WILDVALUE##: vmnet1
3.##WILDVALUE##: 6
4.##WILDVALUE##: 1500
5.##WILDVALUE##: 0
6.##WILDVALUE##: 00:50:56:c0:00:01
7.##WILDVALUE##: 1
8.##WILDVALUE##: 1
9.##WILDVALUE##: 0:00:06.31
10.##WILDVALUE##: 0
11.##WILDVALUE##: 0
12.##WILDVALUE##: 0
13.##WILDVALUE##: 0
14.##WILDVALUE##: 0
15.##WILDVALUE##: 0
16.##WILDVALUE##: 0
17.##WILDVALUE##: 20229
18.##WILDVALUE##: 0
19.##WILDVALUE##: 0
20.##WILDVALUE##: 0
21.##WILDVALUE##: 0
22.##WILDVALUE##: 0.0
Wildvalue: 4:
Data sorted by column ID
1.##WILDVALUE##: 4
2.##WILDVALUE##: vmnet8
3.##WILDVALUE##: 6
4.##WILDVALUE##: 1500
5.##WILDVALUE##: 0
6.##WILDVALUE##: 00:50:56:c0:00:08
7.##WILDVALUE##: 1
8.##WILDVALUE##: 1
9.##WILDVALUE##: 0:00:06.31
10.##WILDVALUE##: 0
11.##WILDVALUE##: 0
12.##WILDVALUE##: 0
13.##WILDVALUE##: 0
14.##WILDVALUE##: 0
15.##WILDVALUE##: 0
16.##WILDVALUE##: 0
17.##WILDVALUE##: 20226
18.##WILDVALUE##: 0
19.##WILDVALUE##: 0
20.##WILDVALUE##: 0
21.##WILDVALUE##: 0
22.##WILDVALUE##: 0.0
Wildvalue: 5:
Data sorted by column ID
1.##WILDVALUE##: 5
2.##WILDVALUE##: virbr0
3.##WILDVALUE##: 6
4.##WILDVALUE##: 1500
5.##WILDVALUE##: 0
6.##WILDVALUE##: 52:54:00:9b:4b:e0
7.##WILDVALUE##: 1
8.##WILDVALUE##: 2
9.##WILDVALUE##: 0:00:09.32
10.##WILDVALUE##: 0
11.##WILDVALUE##: 0
12.##WILDVALUE##: 0
13.##WILDVALUE##: 0
14.##WILDVALUE##: 0
15.##WILDVALUE##: 0
16.##WILDVALUE##: 0
17.##WILDVALUE##: 0
18.##WILDVALUE##: 0
19.##WILDVALUE##: 0
20.##WILDVALUE##: 0
21.##WILDVALUE##: 0
22.##WILDVALUE##: 0.0
Wildvalue: 6:
Data sorted by column ID
1.##WILDVALUE##: 6
2.##WILDVALUE##: virbr0-nic
3.##WILDVALUE##: 6
4.##WILDVALUE##: 1500
5.##WILDVALUE##: 10000000
6.##WILDVALUE##: 52:54:00:9b:4b:e0
7.##WILDVALUE##: 2
8.##WILDVALUE##: 2
9.##WILDVALUE##: 0:00:12.32
10.##WILDVALUE##: 0
11.##WILDVALUE##: 0
12.##WILDVALUE##: 0
13.##WILDVALUE##: 0
14.##WILDVALUE##: 0
15.##WILDVALUE##: 0
16.##WILDVALUE##: 0
17.##WILDVALUE##: 0
18.##WILDVALUE##: 0
19.##WILDVALUE##: 0
20.##WILDVALUE##: 0
21.##WILDVALUE##: 0
22.##WILDVALUE##: 0.0
Wildvalue: 7:
Data sorted by column ID
1.##WILDVALUE##: 7
2.##WILDVALUE##: br-6a2604a91ac1
3.##WILDVALUE##: 6
4.##WILDVALUE##: 1500
5.##WILDVALUE##: 0
6.##WILDVALUE##: 02:42:39:1b:cc:e3
7.##WILDVALUE##: 1
8.##WILDVALUE##: 1
9.##WILDVALUE##: 3:03:43.67
10.##WILDVALUE##: 4181064938
11.##WILDVALUE##: 25297372
12.##WILDVALUE##: 0
13.##WILDVALUE##: 0
14.##WILDVALUE##: 0
15.##WILDVALUE##: 0
16.##WILDVALUE##: 189459674
17.##WILDVALUE##: 17502386
18.##WILDVALUE##: 0
19.##WILDVALUE##: 0
20.##WILDVALUE##: 0
21.##WILDVALUE##: 0
22.##WILDVALUE##: 0.0
Wildvalue: 8:
Data sorted by column ID
1.##WILDVALUE##: 8
2.##WILDVALUE##: docker0
3.##WILDVALUE##: 6
4.##WILDVALUE##: 1500
5.##WILDVALUE##: 0
6.##WILDVALUE##: 02:42:55:44:3f:06
7.##WILDVALUE##: 1
8.##WILDVALUE##: 1
9.##WILDVALUE##: 0:00:18.32
10.##WILDVALUE##: 1684285
11.##WILDVALUE##: 6882
12.##WILDVALUE##: 0
13.##WILDVALUE##: 0
14.##WILDVALUE##: 0
15.##WILDVALUE##: 0
16.##WILDVALUE##: 17045376
17.##WILDVALUE##: 30812
18.##WILDVALUE##: 0
19.##WILDVALUE##: 0
20.##WILDVALUE##: 0
21.##WILDVALUE##: 0
22.##WILDVALUE##: 0.0
Wildvalue: 10:
Data sorted by column ID
1.##WILDVALUE##: 10
2.##WILDVALUE##: veth92ca0b0
3.##WILDVALUE##: 6
4.##WILDVALUE##: 1500
5.##WILDVALUE##: 4294967295
6.##WILDVALUE##: 06:31:50:31:a5:fb
7.##WILDVALUE##: 1
8.##WILDVALUE##: 1
9.##WILDVALUE##: 0:00:18.32
10.##WILDVALUE##: 0
11.##WILDVALUE##: 0
12.##WILDVALUE##: 0
13.##WILDVALUE##: 0
14.##WILDVALUE##: 0
15.##WILDVALUE##: 0
16.##WILDVALUE##: 4077101
17.##WILDVALUE##: 21076
18.##WILDVALUE##: 0
19.##WILDVALUE##: 0
20.##WILDVALUE##: 0
21.##WILDVALUE##: 0
22.##WILDVALUE##: 0.0
Wildvalue: 12:
Data sorted by column ID
1.##WILDVALUE##: 12
2.##WILDVALUE##: veth2bc8fbd
3.##WILDVALUE##: 6
4.##WILDVALUE##: 1500
5.##WILDVALUE##: 4294967295
6.##WILDVALUE##: 4e:c1:4e:e6:07:90
7.##WILDVALUE##: 1
8.##WILDVALUE##: 1
9.##WILDVALUE##: 3:03:43.67
10.##WILDVALUE##: 30849041
11.##WILDVALUE##: 12487957
12.##WILDVALUE##: 0
13.##WILDVALUE##: 0
14.##WILDVALUE##: 0
15.##WILDVALUE##: 0
16.##WILDVALUE##: 2114735865
17.##WILDVALUE##: 8634086
18.##WILDVALUE##: 0
19.##WILDVALUE##: 0
20.##WILDVALUE##: 0
21.##WILDVALUE##: 0
22.##WILDVALUE##: 0.0
Wildvalue: 14:
Data sorted by column ID
1.##WILDVALUE##: 14
2.##WILDVALUE##: veth9a64fa1
3.##WILDVALUE##: 6
4.##WILDVALUE##: 1500
5.##WILDVALUE##: 4294967295
6.##WILDVALUE##: 0a:2c:4f:3a:eb:5c
7.##WILDVALUE##: 1
8.##WILDVALUE##: 1
9.##WILDVALUE##: 3:03:43.67
10.##WILDVALUE##: 131456967
11.##WILDVALUE##: 12673362
12.##WILDVALUE##: 0
13.##WILDVALUE##: 0
14.##WILDVALUE##: 0
15.##WILDVALUE##: 0
16.##WILDVALUE##: 2361323502
17.##WILDVALUE##: 8745523
18.##WILDVALUE##: 0
19.##WILDVALUE##: 0
20.##WILDVALUE##: 0
21.##WILDVALUE##: 0
22.##WILDVALUE##: 0.0
Wildvalue: 16:
Data sorted by column ID
1.##WILDVALUE##: 16
2.##WILDVALUE##: veth497df7f
3.##WILDVALUE##: 6
4.##WILDVALUE##: 1500
5.##WILDVALUE##: 4294967295
6.##WILDVALUE##: 12:db:e0:82:ca:a2
7.##WILDVALUE##: 1
8.##WILDVALUE##: 1
9.##WILDVALUE##: 3:03:43.67
10.##WILDVALUE##: 77954842
11.##WILDVALUE##: 136053
12.##WILDVALUE##: 0
13.##WILDVALUE##: 0
14.##WILDVALUE##: 0
15.##WILDVALUE##: 0
16.##WILDVALUE##: 16467729
17.##WILDVALUE##: 164136
18.##WILDVALUE##: 0
19.##WILDVALUE##: 0
20.##WILDVALUE##: 0
21.##WILDVALUE##: 0
22.##WILDVALUE##: 0.0
Wildvalue: 44:
Data sorted by column ID
1.##WILDVALUE##: 44
2.##WILDVALUE##: vethd608288
3.##WILDVALUE##: 6
4.##WILDVALUE##: 1500
5.##WILDVALUE##: 4294967295
6.##WILDVALUE##: 62:d0:3f:14:ef:85
7.##WILDVALUE##: 1
8.##WILDVALUE##: 1
9.##WILDVALUE##: 2 days, 14:54:42.04
10.##WILDVALUE##: 1620014
11.##WILDVALUE##: 4506
12.##WILDVALUE##: 0
13.##WILDVALUE##: 0
14.##WILDVALUE##: 0
15.##WILDVALUE##: 0
16.##WILDVALUE##: 6639007
17.##WILDVALUE##: 18857
18.##WILDVALUE##: 0
19.##WILDVALUE##: 0
20.##WILDVALUE##: 0
21.##WILDVALUE##: 0
22.##WILDVALUE##: 0.0
For me, this is pretty easy to read and find individual values that I'm looking for. The three lines that resulted in the above output were these:
walkResult = Snmp.walkAsMap(host, Oid, props, timeout)
entryRaw = snmpMapToTable(walkResult)
pprintSnmpWalkTable(entryRaw)
Accessing the data is pretty easy now:
ifEntryRaw.each {wildvalue, data ->
println("""Interface ${wildvalue}:
ifAlias: ${ifXEntryRaw[wildvalue]["1"]}
ifDescr: ${data["2"]}
ifType: ${data["3"]}
""")
}
This gives us the following output:
Interface 6:
ifAlias: virbr0-nic
ifDescr: virbr0-nic
ifType: 6
Interface 10:
ifAlias: veth92ca0b0
ifDescr: veth92ca0b0
ifType: 6
Interface 7:
ifAlias: br-6a2604a91ac1
ifDescr: br-6a2604a91ac1
ifType: 6
Interface 8:
ifAlias: docker0
ifDescr: docker0
ifType: 6
Interface 12:
ifAlias: veth2bc8fbd
ifDescr: veth2bc8fbd
ifType: 6
Interface 14:
ifAlias: veth9a64fa1
ifDescr: veth9a64fa1
ifType: 6
Interface 16:
ifAlias: veth497df7f
ifDescr: veth497df7f
ifType: 6
Interface 44:
ifAlias: vethd608288
ifDescr: vethd608288
ifType: 6
Interface 5:
ifAlias: virbr0
ifDescr: virbr0
ifType: 6
Interface 4:
ifAlias: vmnet8
ifDescr: vmnet8
ifType: 6
Interface 3:
ifAlias: vmnet1
ifDescr: vmnet1
ifType: 6
Interface 2:
ifAlias: enp0s10
ifDescr: NVIDIA Corporation MCP77 Ethernet
ifType: 6
Interface 1:
ifAlias: lo
ifDescr: lo
ifType: 24