mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Python wrapper sql cleanup (#11628)
* Clean up wrapp mysql connect a bit * fix typo
This commit is contained in:
@@ -183,20 +183,6 @@ if __name__ == '__main__':
|
||||
poller_path = config['install_dir'] + '/poller.php'
|
||||
log_dir = config['log_dir']
|
||||
|
||||
# TODO: Use LibreNMS.DB
|
||||
db_username = config['db_user']
|
||||
db_password = config['db_pass']
|
||||
db_port = int(config['db_port'])
|
||||
|
||||
if config['db_socket']:
|
||||
db_server = config['db_host']
|
||||
db_socket = config['db_socket']
|
||||
else:
|
||||
db_server = config['db_host']
|
||||
db_socket = None
|
||||
|
||||
db_dbname = config['db_name']
|
||||
|
||||
if 'rrd' in config and 'step' in config['rrd']:
|
||||
step = config['rrd']['step']
|
||||
else:
|
||||
@@ -292,7 +278,7 @@ if __name__ == '__main__':
|
||||
query = 'select device_id from devices where disabled = 0 order by last_polled_timetaken desc'
|
||||
# EOC2
|
||||
|
||||
db = LNMS.db_open(db_socket, db_server, db_port, db_username, db_password, db_dbname)
|
||||
db = LNMS.db_open(config['db_socket'], config['db_host'], config['db_port'], config['db_user'], config['db_pass'], config['db_name'])
|
||||
cursor = db.cursor()
|
||||
cursor.execute(query)
|
||||
devices = cursor.fetchall()
|
||||
@@ -366,7 +352,7 @@ if __name__ == '__main__':
|
||||
|
||||
show_stopper = False
|
||||
|
||||
db = LNMS.db_open(db_socket, db_server, db_port, db_username, db_password, db_dbname)
|
||||
db = LNMS.db_open(config['db_socket'], config['db_host'], config['db_port'], config['db_user'], config['db_pass'], config['db_name'])
|
||||
cursor = db.cursor()
|
||||
query = "update pollers set last_polled=NOW(), devices='%d', time_taken='%d' where poller_name='%s'" % (
|
||||
polled_devices,
|
||||
|
Reference in New Issue
Block a user