Trying to query a ton of devices with a simple output (in this test case; model identification)
My code works fine when running individually; its when I attempt to parallelize it...errors occur
Script file named "get":
\#!/bin/bash
model="$(snmpbulkget -r1 -t1 -v2c -c test_comm $1 1.3.6.1.2.1.47.1.1.1.1.13 | grep -m1 STRING | sed 's/.*://' | sed 's/ "//' | sed 's/"//')" &&
echo "$1,$model"
Using a single test; works with no issue:
./get 10.23.50.117
10.23.50.117,N9K-C93108TC-EX
Trying to parallelize (even with just 10 processes):
xargs -d " " -P 10 --arg-file=check ./get
snmp_build: unknown failure
snmpbulkget: Error building ASN.1 representation (Can't build OID for variable)
Using the -L arg flag in xargs causes each IP in the list to be hit 10x instead of 10 IPs once each.
cat check_out | sort
10.12.0.1,NY-SW1
10.12.0.1,NY-SW1
10.12.0.1,NY-SW1
10.12.0.1,NY-SW1
10.12.0.1,NY-SW1
10.12.0.1,NY-SW1
10.12.0.1,NY-SW1
10.12.0.1,NY-SW1
10.12.0.1,NY-SW1
10.12.0.1,NY-SW1
10.12.0.4,NY-SW2
10.12.0.4,NY-SW2
10.12.0.4,NY-SW2
10.12.0.4,NY-SW2
10.12.0.4,NY-SW2
10.12.0.4,NY-SW2
10.12.0.4,NY-SW2
10.12.0.4,NY-SW2
10.12.0.4,NY-SW2
10.12.0.4,NY-SW2
10.14.14.8,CY-WAN-SW1
10.14.14.8,CY-WAN-SW1
10.14.14.8,CY-WAN-SW1
10.14.14.8,CY-WAN-SW1
10.14.14.8,CY-WAN-SW1
10.14.14.8,CY-WAN-SW1
10.14.14.8,CY-WAN-SW1
10.14.14.8,CY-WAN-SW1
10.14.14.8,CY-WAN-SW1
10.14.14.8,CY-WAN-SW1