Hi There,
I have the following code:
import time
import paramiko
node_list = ['oj_msp_ts1', 'oj_msp_ts2', 'oj_msp_ts3', 'oj_msp_ts4', 'oj_msp_ts5', 'oj_msp_ts6', 'oj_msp_ts7', 'oj_msp_ts8', 'oj_msp_ts9', 'oj_msp_ts10', 'oj_msp_ts11', 'oj_msp_ts12', 'oj_msp_ts13']
for node in node_list:
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(node, username='lord', password='xxxx')
variables = {}
stdin, stdout, stderr = ssh.exec_command("snmpwalk -v1 localhost -c public .1.3.6.1.4.1.193.126.3.6.1.1.1.1.7.5 | awk '{print $NF}'")
variables[node + "_pull_first"] = stdout.read().strip()
print str(oj_msp_ts1_pull_first)
ssh.close()
But for some reason which I have been thinking about for 2 days now, it keeps giving the following error:
NameError: name 'oj_msp_ts1_pull_first' is not defined
This is quite funny to figure out and am somehow surprised that am having issue with (it should be easy to figure out, it's just a couple of lines).
Any input will be appreciated.