Lot of new ideas defined in configuration files and tons of refactoring.

This commit is contained in:
Johannes Findeisen 2022-09-28 02:04:50 +02:00
commit 3de67966f4
49 changed files with 307 additions and 76 deletions

0
etc/hostgroups/.gitkeep Normal file
View file

View file

@ -0,0 +1,2 @@
[hostgroups]
testgroup1 = host1,host2,host3,192.168.2.1>192.168.2.127

View file

@ -7,20 +7,38 @@ log_level= verbose
log_count = 5
log_size = 10485760
pid_file = /var/run/user/1000/linspector.pid
; plugins separated by ','. no whitespaces allowed
plugins = lish,httpserver
; plugins separated by ','. no whitespaces allowed. not case sensitive.
plugins = Lish,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 = sqlite
tasks = SQLite
notification = SMS
; 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
run_mode = cron
; every notification can be configured in it's own ini file in etc/notifications; there no notification name as prefix
; is needed. see email example.
; a flexible way to define groups of hosts which can be used by monitors as target for monitoring for easily monitor
; groups without adding a monitor for each host. for some more information see the "hosts" section in gateway.conf.
; hostgroups can be defined in separate files in etc/hostgroups to be more flexible.
[hostgroups]
; add single hosts
group1 = host1,host2,host3
; add a range of ip addresses. maybe a different range operator should be chosen but for now i think ">" is sexy... :)
group2 = 192.168.1.1>192.168.1.127
; add a combination of hosts and ranges
group3 = host1,host2,host3,192.168.1.1>192.168.1.127
; just an idea taken from the old Linspector design. not tried but seems a good idea to add global options to monitor
; groups. no idea of an implementation yet.
[monitorgroups]
; members of monitors to automatically send notifications to all without need to set them in each monitor. members can
; be added to monitors in the configuration of each monitor though.
network1_members = admin1@example.com,admin2@example.com,admin3@example.com
; every notification can be configured in it's own configuration file in etc/notifications; there no notification
; name as prefix is needed. see email example.
[notifications]
; values can be overridden in each defined monitor
sms_receivers = +number1,+number2

View file

@ -1,10 +1,10 @@
[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
service = net.FritzboxUplink
interval = 60
; notifications separated by ','. no whitespaces allowed. the case is not important.
notifications = sMs,Email
notifications = sMs,EmaiL
; values from main configuration can be overridden for each defined monitor
; email_receivers separated by ','. no whitespaces allowed
email_receivers = admin@example.com,fallback@example.com
@ -13,11 +13,12 @@ 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
; maybe this should be some kind of range too, for example for the ping service like: 10.0.0.1-10.0.0.42 or more
; maybe this should be some kind of range too, for example for the ping service like: 10.0.0.1>10.0.0.42 or more
; sophisticated kind of ranges... i will find a solution for that... like host groups in the old version of Linspector
; so we don't need to add a monitor for each host... but it would be a good idea to expose these hosts to become a
; monitor for each host internally. ;)
host = 192.168.0.1
; so we don't need to add a monitor for each host... but it would be a good idea to expose these to hostgroups
; internally to single hosts to become a monitor for each host internally. some more ideas are in ;)
; hosts with added hostgroup defined in main configuration file
hosts = 192.168.0.1,192.168.23.24,@group1,@testgroup1
user = USERNAME
password = PASSWORD
info = Cable Provider

View file

@ -1,12 +1,12 @@
[monitor]
identifier = dsl
service = FritzboxUplink
service = Net.FritzboxUplink
interval = 60
notifications = Email
email_receivers = admin@example.com,fallback@example.com
sms_receivers = +329084320984,+39804932409
tasks = MariaDB,FileLogger
host = 192.168.1.1
hosts = 192.168.1.1
user = USERNAME
password = PASSWORD
info = Cable Provider

View file

@ -0,0 +1 @@
this file should not raise an error because it does has the .conf suffix. only .conf files should be processed.

View file

@ -0,0 +1,2 @@
[monitor]
service = misc.dummy