Configuration and monitor configuration update.

This commit is contained in:
Johannes Findeisen 2022-10-04 02:19:18 +02:00
commit dfedaa5d2e
14 changed files with 37 additions and 15 deletions

View file

@ -34,7 +34,7 @@ from linspector.core.monitors import Monitors
# i currently only increase the 3rd number because the goal is that 0.19 will become the first # i currently only increase the 3rd number because the goal is that 0.19 will become the first
# stable version. # stable version.
__version__ = '0.19.26.dev1' __version__ = '0.19.27.dev1'
__author__ = 'Johannes Findeisen <you@hanez.org>' __author__ = 'Johannes Findeisen <you@hanez.org>'
logger = logging.getLogger('linspector') logger = logging.getLogger('linspector')
@ -101,13 +101,24 @@ def main():
log_file_formatter = \ log_file_formatter = \
logging.Formatter('[%(asctime)s]:[%(levelname)s]:[%(name)s]:%(message)s') logging.Formatter('[%(asctime)s]:[%(levelname)s]:[%(name)s]:%(message)s')
if configuration.get_option('linspector', 'log_file_size'):
log_file_size_mb = float(configuration.get_option('linspector', 'log_file_size'))
b = 1000000
log_file_size_bytes = log_file_size_mb * b
else:
# default log file size is 10MB
log_file_size_bytes = 10485760
if configuration.get_option('linspector', 'log_file_count'):
log_file_count = configuration.get_option('linspector', 'log_file_count')
else:
# default log file count is 1.
log_file_count = 1
log_file_handler = logging.handlers.RotatingFileHandler(log_file, log_file_handler = logging.handlers.RotatingFileHandler(log_file,
maxBytes=int( maxBytes=int(log_file_size_bytes),
configuration.get_option( backupCount=int(log_file_count))
'linspector', 'log_size')),
backupCount=int(
configuration.get_option(
'linspector', 'log_count')))
log_file_handler.setFormatter(log_file_formatter) log_file_handler.setFormatter(log_file_formatter)
logger.addHandler(log_file_handler) logger.addHandler(log_file_handler)

View file

@ -2,11 +2,13 @@
[linspector] [linspector]
; report core errors to the following users ; report core errors to the following users
error_receivers = admin@example.com error_receivers = admin@example.com
log_file = ~/code/linspector/linspector/log/linspector.log
; available log levels are: "error", "warning", "info" and "debug". ; available log levels are: "error", "warning", "info" and "debug".
log_level= debug log_level= debug
log_count = 5 log_file = ~/code/linspector/linspector/log/linspector.log
log_size = 10485760 ; number of log files to be kept.
log_file_count = 50
; log file size in megabytes as float.
log_file_size = 1.00
pid_file = /var/run/user/1000/linspector.pid pid_file = /var/run/user/1000/linspector.pid
; plugins separated by ','. no whitespaces allowed. not case sensitive. ; plugins separated by ','. no whitespaces allowed. not case sensitive.
plugins = Lish,HTTPServer plugins = Lish,HTTPServer

View file

@ -1,7 +1,8 @@
; required options: ; required options:
[monitor] [monitor]
; currently i get errors when the service option is not spelled correct. error handling need to fix this. same for ; The description must not but should be a unique description of the monitor for better identifying it in the database
; notifications and tasks. ; if a data storage tasks is being used.
description = Cable Provider
service = net.fritzboxuplink service = net.fritzboxuplink
hosts = 192.168.0.1,192.168.23.24,@group1,@testgroup1 hosts = 192.168.0.1,192.168.23.24,@group1,@testgroup1
interval = 60 interval = 60
@ -27,6 +28,5 @@ tasks = redis
hostgroups = group1 hostgroups = group1
user = USERNAME user = USERNAME
password = PASSWORD password = PASSWORD
info = Cable Provider
; only alert when the error reaches the threshold ; only alert when the error reaches the threshold
threshold = 3 threshold = 3

View file

@ -1,5 +1,5 @@
[monitor] [monitor]
identifier = dsl description = Cable Provider
service = Net.FritzboxUplink service = Net.FritzboxUplink
interval = 60 interval = 60
hosts = 192.168.1.1 hosts = 192.168.1.1
@ -11,5 +11,4 @@ sms_receivers = +number1,+number2
tasks = mariadb,filelogger tasks = mariadb,filelogger
user = USERNAME user = USERNAME
password = PASSWORD password = PASSWORD
info = Cable Provider
hostgroups = group1 hostgroups = group1

View file

@ -1,5 +1,6 @@
; requireed options ; requireed options
[monitor] [monitor]
description = Test1
service = misc.dummy service = misc.dummy
hosts = 192.168.10.10 hosts = 192.168.10.10
interval = 60 interval = 60

View file

@ -1,4 +1,5 @@
[monitor] [monitor]
description = Test10
service = misc.dummy service = misc.dummy
interval = 60 interval = 60
hosts = 192.168.10.10 hosts = 192.168.10.10

View file

@ -1,4 +1,5 @@
[monitor] [monitor]
description = Test2
service = misc.dummy service = misc.dummy
interval = 10 interval = 10
hosts = 192.168.10.10 hosts = 192.168.10.10

View file

@ -1,4 +1,5 @@
[monitor] [monitor]
description = Test3
service = misc.dummy service = misc.dummy
interval = 120 interval = 120
hosts = 192.168.10.10 hosts = 192.168.10.10

View file

@ -1,4 +1,5 @@
[monitor] [monitor]
description = Test4
service = misc.dummy service = misc.dummy
interval = 50 interval = 50
hosts = 192.168.10.10 hosts = 192.168.10.10

View file

@ -1,4 +1,5 @@
[monitor] [monitor]
description = Test5
service = net.FritzboxUplink service = net.FritzboxUplink
interval = 62 interval = 62
hosts = 192.168.10.10 hosts = 192.168.10.10

View file

@ -1,4 +1,5 @@
[monitor] [monitor]
description = Test6
service = misc.dummy service = misc.dummy
interval = 30 interval = 30
hosts = 192.168.10.10 hosts = 192.168.10.10

View file

@ -1,4 +1,5 @@
[monitor] [monitor]
description = Test7
service = misc.dummy service = misc.dummy
interval = 20 interval = 20
hosts = 192.168.10.10 hosts = 192.168.10.10

View file

@ -1,4 +1,5 @@
[monitor] [monitor]
description = Test8
service = misc.dummy service = misc.dummy
interval = 15 interval = 15
hosts = 192.168.10.10 hosts = 192.168.10.10

View file

@ -1,4 +1,5 @@
[monitor] [monitor]
description = Test9
service = misc.dummy service = misc.dummy
interval = 240 interval = 240
hosts = 192.168.10.10 hosts = 192.168.10.10