diff --git a/etc/monitors/network2/gateway.conf b/etc/monitors/network2/gateway.conf index 7f6b3d6..436b75c 100644 --- a/etc/monitors/network2/gateway.conf +++ b/etc/monitors/network2/gateway.conf @@ -8,7 +8,7 @@ interval = 60 notifications = email email_receivers = admin@example.com,fallback@example.com sms_receivers = +number1,+number2 -tasks = mariadb,filelogger +tasks = mariadb,file user = USERNAME password = PASSWORD hostgroups = group1 \ No newline at end of file diff --git a/linspector/core/logger.py b/linspector/core/logger.py index d325cea..d7a1037 100644 --- a/linspector/core/logger.py +++ b/linspector/core/logger.py @@ -29,6 +29,10 @@ logger = getLogger('linspector') # next 3rd party library in the core (need to discover features because i want log rotating): # https://pypi.org/project/loguru/ # maybe subclass it from logging.Logger...? +# TODO: Make the logging format using key=value pairs to make it easy to evaluate log data using +# Splunk. +# TODO: Make logging possible to syslog! Maybe not implement it here and just use the syslog task +# with a format optimized for Splunk or create a Splunk task for this. class Log: def __init__(self, configuration, stdout, verbose): self.__configuration = configuration diff --git a/linspector/tasks/splunk.py b/linspector/tasks/splunk.py new file mode 100644 index 0000000..979ac06 --- /dev/null +++ b/linspector/tasks/splunk.py @@ -0,0 +1,19 @@ +""" +This file is part of Linspector (https://linspector.org/) +Copyright (c) 2023 Johannes Findeisen . All Rights Reserved. +See LICENSE (MIT license) +""" +from linspector.core.task import Task + + +def create(configuration, environment, log): + return SplunkTask(configuration, environment, log) + + +# TODO: check for all required configuration options and set defaults if needed. +class SplunkTask(Task): + def __init__(self, configuration, environment, log): + super().__init__(configuration, environment, log) + self.__configuration = configuration + self.__environment = environment + self.__log = log diff --git a/requirements.txt b/requirements.txt index 1948afc..afd63eb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,14 @@ -APScheduler~=3.9.1 -CherryPy~=18.8.0 -fritzconnection~=1.10.3 -loguru~=0.6.0 -python-gammu~=3.2.4 -paramiko~=2.11.0 -pysnmp~=4.4.12 -requests~=2.28.1 -xmpp2~=0.4 \ No newline at end of file +APScheduler==3.10.0 +CherryPy==18.8.0 +fastapi==0.89.1 +fritzconnection==1.11.0 +loguru==0.6.0 +pydantic==1.10.4 +python-gammu==3.2.4 +paramiko==3.0.0 +pysnmp==4.4.12 +requests==2.28.2 +rich==13.3.1 +textual==0.10.1 +typer==0.7.0 +xmpp2==0.4 \ No newline at end of file