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
# stable version.
__version__ = '0.19.26.dev1'
__version__ = '0.19.27.dev1'
__author__ = 'Johannes Findeisen <you@hanez.org>'
logger = logging.getLogger('linspector')
@ -101,13 +101,24 @@ def main():
log_file_formatter = \
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,
maxBytes=int(
configuration.get_option(
'linspector', 'log_size')),
backupCount=int(
configuration.get_option(
'linspector', 'log_count')))
maxBytes=int(log_file_size_bytes),
backupCount=int(log_file_count))
log_file_handler.setFormatter(log_file_formatter)
logger.addHandler(log_file_handler)

View file

@ -2,11 +2,13 @@
[linspector]
; report core errors to the following users
error_receivers = admin@example.com
log_file = ~/code/linspector/linspector/log/linspector.log
; available log levels are: "error", "warning", "info" and "debug".
log_level= debug
log_count = 5
log_size = 10485760
log_file = ~/code/linspector/linspector/log/linspector.log
; 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
; plugins separated by ','. no whitespaces allowed. not case sensitive.
plugins = Lish,HTTPServer

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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