import easysnmp, schedule, csv
from easysnmp import Session
def poll(host, com, ver, mib):
session = Session(hostname='host', community='com', version=ver)
output = session.get(mib)
print(output)
with open ('aircon-hosts.csv' 'w') as inventory:
invcsv = csv.reader(inventory)
for row in invcsv:
host = row[0]
frequency = int(row[1])
com = row[2]
ver = int(row[3])
mib = row[4:]
schedule.every(frequency).seconds.do(poll(host, com, ver, mib))
while True:
schedule.run_pending()
time.sleep(1)
10.0.0.55 | 5 | string | 2 | sysName.0 |