Addresses issue #14

This commit is contained in:
Thomas Williams 2024-07-04 14:07:33 +01:00
parent 1cfbc3d1c6
commit 2e6157e8ec
Signed by: thomas
GPG key ID: EB8F975CF60BCBFF
2 changed files with 12 additions and 7 deletions

View file

@ -1,11 +1,14 @@
#!/usr/bin/python3 #!/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 urlMonitoringPeriod = 10
urls = ["https://www.bootlesshacker.com"] urls = [""]
urlTimeout = 10 urlTimeout = 10
maxWorkers = 4 maxWorkers = 4
forceNonPOSIXCPU = False # this will force the custom cpu monintor to run instead if set to True forceNonPOSIXCPU = True
loggingMode = ''
sqlServer = '' sqlServer = ''
sqlDatabase = '' sqlDatabase = ''
sqlUsername = '' sqlUsername = ''

10
main.py
View file

@ -159,13 +159,15 @@ def monitorUrls(stop_event):
def logHostLog(hostname, logTime, cpu, memory): def logHostLog(hostname, logTime, cpu, memory):
manager = logsManager(config.sqlServer, config.sqlDatabase, config.sqlUsername, config.sqlPassword) if not config.loggingMode == 'none':
manager.insertHostLog(hostname, socket.gethostbyname(socket.gethostname()), logTime, cpu, memory) 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): def logURLLog(hostname, logTime, url, responseTime):
manager = logsManager(config.sqlServer, config.sqlDatabase, config.sqlUsername, config.sqlPassword) if not config.loggingMode == 'none':
manager.insertURLLog(hostname, socket.gethostbyname(socket.gethostname()), logTime, url, responseTime) manager = logsManager(config.sqlServer, config.sqlDatabase, config.sqlUsername, config.sqlPassword)
manager.insertURLLog(hostname, socket.gethostbyname(socket.gethostname()), logTime, url, responseTime)
def main(): def main():