From 2e6157e8ec1fb6b929ba86c4db7c77dbbe65be56 Mon Sep 17 00:00:00 2001 From: Thomas Williams Date: Thu, 4 Jul 2024 14:07:33 +0100 Subject: [PATCH] Addresses issue #14 --- config.py | 9 ++++++--- main.py | 10 ++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/config.py b/config.py index 100ff28..8bf2bf4 100644 --- a/config.py +++ b/config.py @@ -1,11 +1,14 @@ #!/usr/bin/python3 -hostMonitoringPeriod = 1 # on posix systems, it is suggested this is a minimum of 5 unless forceNonPOSIXCPU is true +# See README before changing any of these options. + +hostMonitoringPeriod = 1 urlMonitoringPeriod = 10 -urls = ["https://www.bootlesshacker.com"] +urls = [""] urlTimeout = 10 maxWorkers = 4 -forceNonPOSIXCPU = False # this will force the custom cpu monintor to run instead if set to True +forceNonPOSIXCPU = True +loggingMode = '' sqlServer = '' sqlDatabase = '' sqlUsername = '' diff --git a/main.py b/main.py index a1bd85c..735755d 100755 --- a/main.py +++ b/main.py @@ -159,13 +159,15 @@ def monitorUrls(stop_event): def logHostLog(hostname, logTime, cpu, memory): - manager = logsManager(config.sqlServer, config.sqlDatabase, config.sqlUsername, config.sqlPassword) - manager.insertHostLog(hostname, socket.gethostbyname(socket.gethostname()), logTime, cpu, memory) + if not config.loggingMode == 'none': + manager = logsManager(config.sqlServer, config.sqlDatabase, config.sqlUsername, config.sqlPassword) + manager.insertHostLog(hostname, socket.gethostbyname(socket.gethostname()), logTime, cpu, memory) def logURLLog(hostname, logTime, url, responseTime): - manager = logsManager(config.sqlServer, config.sqlDatabase, config.sqlUsername, config.sqlPassword) - manager.insertURLLog(hostname, socket.gethostbyname(socket.gethostname()), logTime, url, responseTime) + if not config.loggingMode == 'none': + manager = logsManager(config.sqlServer, config.sqlDatabase, config.sqlUsername, config.sqlPassword) + manager.insertURLLog(hostname, socket.gethostbyname(socket.gethostname()), logTime, url, responseTime) def main():