simple snmp poller from a flat file

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.555string2sysName.0

Leave a Reply

Your email address will not be published. Required fields are marked *