Refactoring and README update.
This commit is contained in:
parent
72b6fa1cc3
commit
e77af2a7e0
7 changed files with 55 additions and 23 deletions
13
README.md
13
README.md
|
|
@ -3,7 +3,7 @@
|
|||
#### Linspector is not some program expecting computers to obviously run...
|
||||
|
||||
The idea is based on a software I developed around 2010 or so. The name of the software is
|
||||
[Linspector](https://linspector.org/) but the implementation was just too
|
||||
[Linspector](http://linspector.org/) but the implementation was just too
|
||||
complicated. The idea still remains so here is the rebirth of Linspector. First commits
|
||||
of this rewrite where done as a new project named
|
||||
[monipy](https://git.unixpeople.org/linspector/monipy), but I moved to the name
|
||||
|
|
@ -30,16 +30,11 @@ nearly does not exist.
|
|||
at the moment!
|
||||
|
||||
### Ideas
|
||||
|
||||
- MAYBE rename this project to linspector and see it as an update. This is a nice idea
|
||||
because [Linspector](https://linspector.org/) has its GitHub organisation,
|
||||
domain etc. And all I do here is
|
||||
a better Linspector. Even all nice and useful features and ideas from Linspector but
|
||||
also uplink should be reimplemented here. - DONE!
|
||||
|
||||
-
|
||||
- Think about adding [APScheduler](https://pypi.org/project/APScheduler/) for
|
||||
scheduling execution of the monitors instead of a self constructed thread
|
||||
structure... was very nice to get the job done in Linspector.
|
||||
structure... It was very nice to get the jobs done in Linspector using APScheduler
|
||||
in the past.
|
||||
|
||||
### Manifest
|
||||
|
||||
|
|
|
|||
|
|
@ -7,13 +7,14 @@
|
|||
[linspector]
|
||||
; report core errors to the following users
|
||||
error_receivers = admin@example.com
|
||||
log_file = ~/code/linspector/log/uplink.log
|
||||
log_file = ~/code/linspector/log/linspector.log
|
||||
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 = HTTPServer:MariaDB
|
||||
plugins = backend.HTTPServer
|
||||
tasks = database.MariaDB:storage.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
|
||||
run_mode = cron
|
||||
|
|
@ -21,7 +22,7 @@ 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.
|
||||
[notifications]
|
||||
; some values can be overridden in each defined monitor
|
||||
; values can be overridden in each defined monitor
|
||||
sms_receivers = +34324234234:+324242344
|
||||
sms_configuration_file = ~/code/linspector/etc/gammurc
|
||||
; retry to send interval and number of retries if something failed
|
||||
|
|
@ -32,19 +33,16 @@ email_resend = 10
|
|||
; every plugin can be configured in it's own ini file in etc/plugins; there no plugin name as prefix is needed. see
|
||||
; httpserver example.
|
||||
[plugins]
|
||||
mariadb_database = linspector
|
||||
mariadb_host = 10.0.0.254
|
||||
mariadb_password = 3qx7HfrxGNM83lqN
|
||||
mariadb_port": 3306
|
||||
mariadb_user = uplink
|
||||
|
||||
speedtest_interval = 3600
|
||||
speedtest_url = https://go.microsoft.com/fwlink/?Linkid=850641
|
||||
|
||||
; if types can or must be configured before use; for now no use case seen.
|
||||
; every type can be configured in it's own ini file in etc/types; there no type name as prefix is not needed.
|
||||
[services]
|
||||
foo = bar
|
||||
speedtest_interval = 3600
|
||||
speedtest_url = https://go.microsoft.com/fwlink/?Linkid=850641
|
||||
|
||||
[tasks]
|
||||
bar = foo
|
||||
mariadb_database = linspector
|
||||
mariadb_host = 10.0.0.254
|
||||
mariadb_password = 3qx7HfrxGNM83lqN
|
||||
mariadb_port": 3306
|
||||
mariadb_user = uplink
|
||||
|
|
@ -7,8 +7,10 @@ service = Fritzbox
|
|||
interval = 60
|
||||
# default delimiters '=' and ':' should be changed to ',' to be more native
|
||||
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
|
||||
host = 192.168.0.1
|
||||
user = USERNAME
|
||||
password = PASSWORD
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ interval = 60
|
|||
notifications = SMS:Email
|
||||
email_receivers = admin@example.com:fallback@example.com
|
||||
sms_receivers = +329084320984:+39804932409
|
||||
tasks = MariaDB:Logger:Redis
|
||||
host = 192.168.1.1
|
||||
user = USERNAME
|
||||
password = PASSWORD
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ logger = getLogger('linspector')
|
|||
|
||||
|
||||
# TODO: check for all required configuration options and set defaults if needed.
|
||||
class FritzboxMonitor(Service):
|
||||
class FritzboxService(Service):
|
||||
|
||||
def __init__(self, configuration, environment):
|
||||
super().__init__(configuration, environment)
|
||||
|
|
|
|||
36
linspector/services/uptime.py
Normal file
36
linspector/services/uptime.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
"""
|
||||
This file is part of Linspector (https://linspector.org/)
|
||||
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next
|
||||
paragraph) shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
||||
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
"""
|
||||
|
||||
from logging import getLogger
|
||||
from linspector.services.service import Service
|
||||
|
||||
logger = getLogger('linspector')
|
||||
|
||||
|
||||
# TODO: check for all required configuration options and set defaults if needed.
|
||||
class UptimeService(Service):
|
||||
|
||||
def __init__(self, configuration, environment):
|
||||
super().__init__(configuration, environment)
|
||||
self.__configuration = configuration
|
||||
self.__environment = environment
|
||||
0
linspector/tasks/__init__.py
Normal file
0
linspector/tasks/__init__.py
Normal file
Loading…
Add table
Add a link
Reference in a new issue