Many cleanups, additions and new ideas.

This commit is contained in:
Johannes Findeisen 2023-02-12 06:31:35 +01:00
commit 484ad6e3b3
13 changed files with 104 additions and 358 deletions

View file

@ -1,5 +1,41 @@
all: PYTHON_VERSION=3.10
PYTHONPATH=$(shell pwd) ./bin/linspector -s ./etc #PYTHON_VERSION = $(shell python -V | awk -F ' ' '{print $2}' | awk -F '.' '{print $1 "." $2}')
help:
# Getting started using this Makefile.
# It should help you to go on fast and easy.
#
# First edit this Makefile and add your Python version:
# -----------------------------------------------------
# Set PYTHON_VERSION to MAJOR.MINOR version of your
# current installed Python version. E.g.: 3.10 (default).
# Get the Python version with: python -V
#
# Create virtual environment:
# ---------------------------
# python -m venv ./venv
# source ./venv/bin/activate
# pip install -r requirements.txt
#
# Activate virtual environment when not already done:
# ---------------------------------------------------
# source ./venv/bin/activate
#
# Deactivate virtual environment:
# -------------------------------
# deactivate
#
# Run Linspector:
# ---------------
# make run
#
# Run Linspector in daemon mode:
# ------------------------------
# make daemon
run:
PYTHONPATH=$(shell pwd):$(shell pwd)/venv/lib/python$(PYTHON_VERSION)/site-packages/ bin/linspector -s ./etc
daemon: daemon:
PYTHONPATH=$(shell pwd) ./bin/linspector -d ./etc PYTHONPATH=$(shell pwd):$(shell pwd)/venv/lib/python$(PYTHON_VRESION)/site-packages/ bin/linspector -d ./etc

View file

@ -14,11 +14,10 @@ import logging.handlers
import os import os
import sys import sys
from linspector.core.helpers import log
from linspector.core.configuration import Configuration from linspector.core.configuration import Configuration
from linspector.core.environment import Environment from linspector.core.environment import Environment
from linspector.core.linspector import Linspector from linspector.core.linspector import Linspector
from linspector.core.logger import Log
from linspector.core.monitors import Monitors from linspector.core.monitors import Monitors
logger = logging.getLogger('linspector') logger = logging.getLogger('linspector')

4
etc/plugins/api.conf Normal file
View file

@ -0,0 +1,4 @@
[api]
host = 127.0.0.1
port = 4242
type = thread

4
etc/plugins/httpd.conf Normal file
View file

@ -0,0 +1,4 @@
[httpserver]
host = 127.0.0.1
port = 8080
type = thread

View file

@ -1,4 +0,0 @@
[httpserver]
ip = 127.0.0.1
port = 4242
type = thread

3
etc/tasks/splunk.conf Normal file
View file

@ -0,0 +1,3 @@
[splunk]
host = splunk.example.org
port = 3333

3
etc/tasks/syslog.conf Normal file
View file

@ -0,0 +1,3 @@
[syslog]
host = log.example.org
port = 514

View file

@ -1,3 +1,4 @@
""" """
This file is part of Linspector (https://linspector.org/) This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved. Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.

View file

@ -6,6 +6,7 @@ See LICENSE.txt (MIT license).
# TODO: Make this a backend API using the modern FastAPI framework as a replacement for the # TODO: Make this a backend API using the modern FastAPI framework as a replacement for the
# traditional RPC plugin. Maybe it makes sense to maintain the RPC plugin too for simple usage by # traditional RPC plugin. Maybe it makes sense to maintain the RPC plugin too for simple usage by
# the Lish but I believe it makes sense to only create one backend for all clients. # the Lish but I believe it makes sense to only create one backend for all clients.
from fastapi import FastAPI
from linspector.core.plugin import Plugin from linspector.core.plugin import Plugin

View file

@ -11,11 +11,11 @@ from linspector.core.plugin import Plugin
def create(configuration, environment, linspector, log): def create(configuration, environment, linspector, log):
return HTTPServerPlugin(configuration, environment, linspector, log) return HTTPDPlugin(configuration, environment, linspector, log)
# TODO: check for all required configuration options and set defaults if needed. # TODO: check for all required configuration options and set defaults if needed.
class HTTPServerPlugin(Plugin): class HTTPDPlugin(Plugin):
def __init__(self, configuration, environment, linspector, log): def __init__(self, configuration, environment, linspector, log):
super().__init__(configuration, environment, linspector, log) super().__init__(configuration, environment, linspector, log)

View file

@ -0,0 +1,26 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
See LICENSE.txt (MIT license).
"""
# TODO: This plugin should become the internal Lish implemented as a plugin which does not use the
# API plugin but loads at the end when starting Linspector in interactive mode as a terminal like
# interface to the core of Linspector.
from linspector.core.plugin import Plugin
def create(configuration, environment, linspector, log):
return LishPlugin(configuration, environment, linspector, log)
# TODO: check for all required configuration options and set defaults if needed.
class LishPlugin(Plugin):
def __init__(self, configuration, environment, linspector, log):
super().__init__(configuration, environment, linspector, log)
self.__configuration = configuration
self.__environment = environment
self.__linspector = linspector
self.__log = log
def run(self):
return

View file

@ -12,7 +12,6 @@ def create(configuration, environment, log):
# TODO: check for all required configuration options and set defaults if needed. # TODO: check for all required configuration options and set defaults if needed.
class FileTask(Task): class FileTask(Task):
def __init__(self, configuration, environment, log): def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log) super().__init__(configuration, environment, log)
self.__configuration = configuration self.__configuration = configuration

View file

@ -1,384 +1,58 @@
adafruit-ampy==1.1.0
aiofiles==22.1.0
aiohttp==3.8.3
aiohttp-cors==0.7.0
aiosignal==1.3.1
alabaster==0.7.13
ansible==7.2.0
ansible-core==2.14.2
anyio==3.6.2 anyio==3.6.2
anytree==2.8.0 APScheduler==3.10.0
appdirs==1.4.4
apsw==3.40.0.0
arandr==0.1.11
argcomplete==2.0.0
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
asciidoc==10.2.0
asciinema==2.2.0
asgiref==3.5.2
astroid==2.13.3
asttokens==2.2.1
async-generator==1.10
async-timeout==4.0.2
attrs==22.2.0
autocommand==2.2.2 autocommand==2.2.2
Automat==22.10.0
Babel==2.11.0
backcall==0.2.0
bcrypt==4.0.1 bcrypt==4.0.1
beautifulsoup4==4.11.1
binwalk==2.3.3
bitstring==3.1.9
black==22.12.0
bleach==6.0.0
blessed==1.20.0
blinker==1.5
bottle==0.12.23
bpython==0.23
Brotli==1.0.9
brotlicffi==1.0.9.2
btrfsutil==6.1.3
cairocffi==1.4.0
CairoSVG==2.5.2
cchardet==2.1.7
certifi==2022.12.7 certifi==2022.12.7
cffi==1.15.1 cffi==1.15.1
chardet==5.1.0
charset-normalizer==3.0.1 charset-normalizer==3.0.1
cheroot==9.0.0 cheroot==9.0.0
CherryPy==18.8.0 CherryPy==18.8.0
click==8.1.3 click==8.1.3
click-plugins==1.1.1
cloudpickle==2.2.0
colorama==0.4.6
constantly==15.1.0
construct==2.10.68
contourpy==1.0.7
crc32c==2.3
cryptography==39.0.1 cryptography==39.0.1
css-parser==1.0.8 fastapi==0.91.0
cssselect==1.2.0 fritzconnection==1.11.0
cssselect2==0.7.0
cupshelpers==1.0
curtsies==0.4.1
cwcwidth==0.1.8
cycler==0.11.0
Cython==0.29.33
decorator==5.1.1
defusedxml==0.7.1
dill==0.3.6
distlib==0.3.6
distro==1.8.0
Django==4.1.5
dnspython==2.2.1
docutils==0.19
doit==0.36.0
ecdsa==0.18.0
email-validator==1.3.1
esptool==4.4
evdev==1.6.1
executing==1.2.0
fastapi==0.89.1
fastjsonschema==2.16.2
feedparser==6.0.10
fido2==1.1.0
filelock==3.8.2
Flask==2.2.2
flickr-api==0.7.5
fonttools==4.38.0
FoxDot==0.8.12
frozenlist==1.3.3
fusepy==3.0.1
future==0.18.2
gajim==1.6.1
ghp-import==1.1.0
gns3-gui==2.2.37
gns3-server==2.2.37
gps==3.25
greenlet==2.0.2
gssapi==1.8.2
gufw==22.4.0
gunicorn==20.1.0
h11==0.14.0 h11==0.14.0
hiredis==2.0.0
html2text==2020.1.16
html5-parser==0.4.10
html5lib==1.1
httpcore==0.16.3
httplib2==0.21.0
httptools==0.5.0
httpx==0.23.3
hurry.filesize==0.9
husl==4.0.3
hyperlink==21.0.0
idna==3.4 idna==3.4
ifaddr==0.2.0 importlib-metadata==4.13.0
imagesize==1.4.1
importlib-metadata==5.0.0
importlib-resources==5.10.2
incremental==22.10.0
inflate64==0.3.1
inflect==6.0.2 inflect==6.0.2
intelhex==2.3.0
iotop==0.6
ipython==8.9.0
isodate==0.6.1
isort==5.12.0
itsdangerous==2.1.2
jaraco.classes==3.2.3 jaraco.classes==3.2.3
jaraco.collections==3.5.2 jaraco.collections==3.8.0
jaraco.context==4.3.0 jaraco.context==4.3.0
jaraco.functools==3.5.2 jaraco.functools==3.5.2
jaraco.text==3.11.1 jaraco.text==3.11.1
jedi==0.18.2 loguru==0.6.0
jeepney==0.8.0
jimner==1.2.3
Jinja2==3.1.2
jsonschema==4.17.3
keyring==23.11.0
Kivy==2.1.0
kiwisolver==1.4.4
lazy-object-proxy==1.9.0
lensfun==0.3.3
libfdt==1.6.1
libsigrok==0.5.2
libvirt-python==9.0.0
lit==15.0.7.dev0
lockfile==0.12.2
Logbook==1.5.3
louis==3.24.0
lxml==4.9.2
Mako==1.2.4
mallard-ducktype==1.0.2
Markdown==3.3.7
markdown-it-py==2.1.0 markdown-it-py==2.1.0
Markups==3.1.3
MarkupSafe==2.1.2
matplotlib==3.6.2
matplotlib-inline==0.1.6
mccabe==0.7.0
mdurl==0.1.2 mdurl==0.1.2
mechanize==0.4.8
mercurial==6.3.2
meson==1.0.0
micawber==0.5.4
more-itertools==9.0.0 more-itertools==9.0.0
mpy-utils==0.1.11 nanoid==2.0.0
msgpack==1.0.4 paramiko==3.0.0
multidict==6.0.3
multivolumefile==0.2.3
mutagen==1.46.0
mypy==0.991
mypy-extensions==0.4.3
namcap==3.3.1
natsort==8.2.0
nbxmpp==4.0.1
nemo-audio-tab==5.6.0
nemo-pastebin==5.6.0
netaddr==0.8.0
netifaces==0.11.0
netsnmp-python==1.0a1
nftables==0.1
Nikola==8.2.3
Nuitka==1.4
numpy==1.24.1
oauth2==1.9.0.post1
ordered-set==4.1.0
orjson==3.8.5
packaging==23.0
paramiko==2.11.1
parso==0.8.3
pass-import==3.4
pathspec==0.11.0
pdftotext==2.2.2
pexpect==4.8.0
pickleshare==0.7.5
piexif==1.1.3
Pillow==9.4.0
pkginfo==1.9.6
platformdirs==2.6.2
ply==3.11 ply==3.11
pmbootstrap==1.50.1
pooch==1.6.0
portend==3.1.0 portend==3.1.0
powerline-status==2.8.3
precis-i18n==1.0.4
prompt-toolkit==3.0.36
protobuf==4.21.12
psutil==5.9.4
ptyprocess==0.7.0
pudb==2022.1.3
pure-eval==0.2.2
pwquality==1.4.5
py-cpuinfo==9.0.0
py7zr==0.20.2
pyaes==1.6.1
pyalpm==0.10.6
pyaml==21.10.1
pyasn1==0.4.8 pyasn1==0.4.8
pyasn1-modules==0.2.8
pybcj==1.0.1
pybind11==2.10.3
pycairo==1.23.0
pychm==0.8.6
pycparser==2.21 pycparser==2.21
pycryptodome==3.17 pycryptodomex==3.17
pycryptodomex==3.12.0
pycups==2.0.1
pycurl==7.45.2
pydantic==1.10.4 pydantic==1.10.4
pyelftools==0.29
pyenchant==3.2.2
pygal==3.0.0
Pygments==2.14.0 Pygments==2.14.0
PyGObject==3.42.2 PyNaCl==1.5.0
PyGObject-stubs==2.2.0
pyinotify==0.9.6
pykeepass==4.0.3
pylint==2.16.1
PyMySQL==1.0.2
PyNaCl==1.4.0
PyOpenGL==3.1.6
pyOpenSSL==23.0.0
pyparsing==3.0.9
pyppmd==1.0.0
Pypubsub==4.0.3
PyQt5==5.15.9
PyQt5-sip==12.11.1
PyQt6==6.4.2
PyQt6-sip==13.4.1
PyQt6-WebEngine==6.4.0
pyqtgraph==0.13.1
pyroute2==0.7.3
pyrsistent==0.19.3
PyRSS2Gen==1.1
pyscard==2.0.5
pyserial==3.5
PySide2==5.15.8
pysmi==0.3.4 pysmi==0.3.4
pysnmp==4.4.12 pysnmp==4.4.12
python-axolotl==0.2.3
python-axolotl-curve25519==0.4.1.post2
python-daemon==2.3.0
python-dateutil==2.8.2
python-dotenv==0.21.1
python-gammu==3.2.4 python-gammu==3.2.4
python-magic==0.4.27 pytz==2022.7.1
python-markdown-math==0.8
python-multipart==0.0.5
python-yubico==1.3.3
pytz==2022.7
pytz-deprecation-shim==0.1.0.post0 pytz-deprecation-shim==0.1.0.post0
pyudev==0.24.0 requests==2.28.2
pyusb==1.2.1
pyxdg==0.28
PyYAML==6.0
pyzmq==24.0.1
pyzstd==0.15.3
qrcode==7.3.1
rangehttpserver==1.2.0
rdflib==6.2.0
readme-renderer==37.3
redis==4.4.0
reedsolo==1.7.0
Reflector==2021.11.20.2.41.3
regex==2022.10.31
requests==2.28.1
requests-toolbelt==0.10.1
resolvelib==0.8.1
ReText==8.0.0
rfc3986==1.5.0
rich==13.3.1 rich==13.3.1
rjsmin==1.2.1
rrdtool==0.1.10
rshell==0.0.31
ruamel.yaml==0.17.21
ruamel.yaml.clib==0.2.7
s-tui==1.1.4
scipy==1.10.0
SCons==4.4.0
SecretStorage==3.3.3
Send2Trash==1.8.0
sentry-sdk==1.15.0
service-identity==21.1.0
setproctitle==1.3.2
sgmllib3k==1.0.0
shiboken2==5.15.8
shiv==1.0.3
six==1.16.0 six==1.16.0
skia-python @ file:///var/tmp/python-skia/src/skia_python-87.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
smartypants==2.0.1
sniffio==1.3.0 sniffio==1.3.0
snowballstemmer==2.2.0 starlette==0.24.0
soupsieve==2.3.2.post1 syslog2==0.5.0
speedtest-cli==2.1.3 tempora==5.2.1
Sphinx==5.3.0 textual==0.10.1
sphinxcontrib-applehelp==1.0.4 typer==0.7.0
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
SQLAlchemy==1.4.44
sqlparse==0.4.3
stack-data==0.6.2
starlette==0.22.0
stevedore==4.1.1
supervisor==4.2.5
sysmon==1.0.0
tasklib==2.5.1
TBB==0.2
tempora==5.2.0
texttable==1.6.7
thonny==4.0.2
thrift==0.17.0
tinycss2==1.2.1
toml==0.10.2
tomli==2.0.1
tomlkit==0.11.6
tornado==6.2
traitlets==5.9.0
trash-cli==0.22.10.20
trove-classifiers==2023.2.9
twine==4.0.2
Twisted==22.10.0
typing_extensions==4.4.0 typing_extensions==4.4.0
typogrify==2.0.7
tzdata==2022.7 tzdata==2022.7
tzlocal==4.2 tzlocal==4.2
uc-micro-py==1.0.1 urllib3==1.26.14
ufw==0.36.1
ujson==5.7.0
Unidecode==1.3.6
unrardll==0.1.5
urh==2.9.4
urllib3==1.26.12
urwid==2.1.2
uvicorn==0.20.0 uvicorn==0.20.0
uvloop==0.17.0 xmpp2==0.4
validate-pyproject==0.12.1
virtualenv==20.17.1
virtualenv-clone==0.5.7
virtualenvwrapper==4.8.4
vit==2.2.0
watchdog==2.2.1
watchfiles==0.18.1
wcwidth==0.2.5
webencodings==0.5.1
websockets==10.4
Werkzeug==2.2.2
wrapt==1.14.1
wxGlade==1.0.4
wxPython==4.2.0
xcffib==1.2.0
Yapsy==1.12.2
yarl==1.8.2
youtube-dl==2021.12.17
yt-dlg==1.8.4
yubikey-manager==4.0.9
zc.lockfile==2.0 zc.lockfile==2.0
zeroconf==0.39.4 zipp==3.13.0
zipp==3.12.0
zope.interface==5.5.2
zxcvbn==4.4.28