Added dynamic loading of tasks and services, refactoring and fixes.

This commit is contained in:
Johannes Findeisen 2022-09-27 07:00:17 +02:00
commit 8d9ec5c73b
18 changed files with 51 additions and 236 deletions

View file

@ -7,8 +7,12 @@ log_level= verbose
log_count = 5
log_size = 10485760
pid_file = /var/run/user/1000/linspector.pid
; default delimiters '=' and ':' should be changed to ',' to be more native
; plugins separated by ','. no whitespaces allowed
plugins = HTTPServer
; globally configured tasks will always run on all monitors when no task is configured there. if tasks are configured in
; a monitor then maybe only run tasks from the dedicated monitor. maybe it is a good idea to run global tasks in every
; monitor and the monitor can add tasks to the global settings... need to think about it.
; tasks separated by ','. no whitespaces allowed
tasks = MariaDB,Logger
; maybe the run_mode is obsolete because this will be a daemon but maybe it is useful for one time execution?
; in uplink the available run_modes were cron, daemon and foreground
@ -18,7 +22,7 @@ run_mode = cron
; is needed. see email example.
[notifications]
; values can be overridden in each defined monitor
sms_receivers = +number1:+number2
sms_receivers = +number1,+number2
sms_configuration_file = ~/linspector/etc/gammurc
; retry to send interval and number of retries if something failed
sms_resend = 10

View file

@ -1,11 +1,18 @@
[monitor]
; currently i get errors when the service option is not spelled correct. error handling need to fix this. same for
; notifications and tasks.
service = FritzboxUplink
interval = 60
; notifications separated by ','. no whitespaces allowed
notifications = SMS,Email
; values from main configuration can be overridden for each defined monitor
email_receivers = admin@example.com:fallback@example.com
sms_receivers = +329084320984:+39804932409
tasks = None
; email_receivers separated by ','. no whitespaces allowed
email_receivers = admin@example.com,fallback@example.com
; sms_receivers separated by ','. no whitespaces allowed
sms_receivers = +329084320984,+39804932409
; setting to None fails. just do not set this option. currently i get an error when tasks is not set here. need to be
; fixed. setting it like below works but is no good design for optional options. same for notifications.
tasks = Redis
host = 192.168.0.1
user = USERNAME
password = PASSWORD

View file

@ -2,11 +2,10 @@
identifier = dsl
service = FritzboxUplink
interval = 60
# default delimiters '=' and ':' should be changed to ',' to be more native
notifications = SMS,Email
email_receivers = admin@example.com:fallback@example.com
sms_receivers = +329084320984:+39804932409
tasks = MariaDB:Logger:Redis
email_receivers = admin@example.com,fallback@example.com
sms_receivers = +329084320984,+39804932409
tasks = MariaDB
host = 192.168.1.1
user = USERNAME
password = PASSWORD