Update main.py to remove unused schedule import, enhance logging, and ensure server collector starts correctly; update telegraf.conf for MongoDB connection details and add authentication; include beautifulsoup4 in requirements.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import schedule
|
||||
import signal
|
||||
import json
|
||||
import time
|
||||
@@ -31,8 +30,7 @@ def setupLogger():
|
||||
|
||||
def interrupt_handler(signum, driver: webdriver.Chrome):
|
||||
logger.log(logging.INFO, f'Handling signal {signum} ({signal.Signals(signum).name}).')
|
||||
|
||||
schedule.clear()
|
||||
|
||||
driver.quit()
|
||||
raise SystemExit
|
||||
|
||||
@@ -49,6 +47,8 @@ def setupChromeDriver():
|
||||
chrome_options.add_argument(f"--load-extension={os.path.abspath(os.path.join(os.path.dirname(__file__), 'webrtc-internals-exporter'))}")
|
||||
chrome_options.add_experimental_option('prefs', {'intl.accept_languages': 'en,en_US'})
|
||||
|
||||
logger.info(f"{os.path.abspath(os.path.join(os.path.dirname(__file__), 'webrtc-internals-exporter'))}")
|
||||
|
||||
driver = webdriver.Chrome(options=chrome_options)
|
||||
#driver = webdriver.Remote(command_executor='http://localhost:4444', options=chrome_options)
|
||||
logger.log(logging.INFO, 'Chrome driver setup complete.')
|
||||
@@ -187,8 +187,5 @@ if __name__ == '__main__':
|
||||
|
||||
logger.log(logging.INFO, 'Starting server collector.')
|
||||
httpd = HTTPServer(('localhost', 9092), partial(Handler, downloadStats, driver, logger))
|
||||
httpd.serve_forever()
|
||||
|
||||
#schedule.every(2).seconds.do(downloadStats, driver)
|
||||
#while True:
|
||||
#schedule.run_pending()
|
||||
logger.info('Server collector started.')
|
||||
httpd.serve_forever()
|
Reference in New Issue
Block a user