I have the following code to re-iterate through a IP address list to find the SNMP string:
INPUT:
import os
import subprocess
ip_list = ['10.10.10.10','10.10.10.11']
snmp = "snmpget -v1 -c public "
for x in ip_list:
command = os.system(str(snmp + x))
OUTPUT: ... = STRING: "11/15/2017"
This code works fine, but I need to replace os.system with subprocess.call as os.system is very limited and can not be stored in a variable.
I tried to plug in subprocess.call in but i keep getting the error:
results = subprocess.call(os.system(str(snmp + r + static_oid + z)), shell=True)
TypeError: 'int' object is not iterable
Any help would be much appreciated, thanks!