2022-10-03 06:16:26 +02:00
# Linspector System Monitoring
2022-09-25 00:39:51 +02:00
2023-10-13 11:44:14 +02:00
*Linspector is not some program expecting computers to obviously run...*
2023-10-22 13:04:38 +02:00
# *IMPORTANT:*
2023-10-13 11:44:14 +02:00
2023-11-29 04:27:28 +01:00
**Because people are asking... Linspector is actually more some kind of a research project for evaluating stuff, but a lot of the code is used in some private projects. I am working on the API definition mostly and there is a lot of code that must be refactored/rewrited ASAP. (2023.11.29)**
2023-11-29 04:02:28 +01:00
2026-06-19 17:16:09 +02:00
**Linspector is now thread-safe in scheduler thread-mode. Shared mutable state (Environment,
Monitor error counts) is protected by locks and the scheduler starts after daemonization to
avoid fork-with-threads issues. Process-mode (multi-process) is still not supported — that
requires a larger architectural redesign with serializable state and IPC.**
2023-10-22 13:04:38 +02:00
2022-09-29 00:07:38 +02:00
## About
2023-02-12 03:31:52 +01:00
The idea is based on a software I developed around 2010 or so. The name of the software was
2022-10-04 02:31:46 +02:00
[Linspector ](https://linspector.org/ ) but the implementation was just too
2023-02-12 03:31:52 +01:00
complicated. The idea still remains so here is the rebirth of Linspector. First commits
of this rewrite where done as a new project named
2023-02-21 02:33:39 +01:00
[monipy ](https://github.com/linspector/monipy ), but I moved to the name
2023-02-12 03:31:52 +01:00
Linspector because I believe it is the better and cooler name... Old Linspector code is
not available in this repository anymore, you can find it under
2023-02-23 10:46:57 +01:00
[https://github.com/linspector/linspector-old ](https://github.com/linspector/linspector-old ).
2022-09-25 00:39:51 +02:00
2022-09-26 23:37:40 +02:00
Hope this project will become useful for someone at some day and not only for
2022-09-25 00:39:51 +02:00
me. Just give me some amount of time for the first usable release... ;)
2022-09-26 23:37:40 +02:00
**Linspector** contains a daemon and some tools to monitor your infrastructure. It
collects data for statistics and sends alerts in case of errors. When extending Linspector
with plugins it for example can provide a web interface etc.
2022-09-25 00:39:51 +02:00
2022-09-29 00:12:16 +02:00
Since this project is at a very early stage of development it is not ready for usage.
I design the software actually and try to convert my ideas to software.
2022-09-25 00:39:51 +02:00
## Development
2022-09-29 04:58:39 +02:00
### Environment
My development environment is running using a virtual Python environment. I am using
2023-02-12 03:31:52 +01:00
all packages defined in requirements.txt.
2022-09-29 04:58:39 +02:00
2023-02-12 03:31:52 +01:00
Linspector includes a Makefile for executing bin/linspector without writing the full
2022-09-29 04:58:39 +02:00
command with pretended PYTHONPATH. This makes my work a little easier.
2023-02-12 03:31:52 +01:00
The IDE I am using is [IntelliJ IDEA Community Edition ](https://www.jetbrains.com/idea/ )
with Python plugin and / or [PyCharm Community ](https://www.jetbrains.com/pycharm/ ) from
[JetBrains ](https://www.jetbrains.com/ ). I mention the IDE here because I am very thankful
to JetBrains for providing such a nice piece of software. I have never seen such a perfect
2022-09-29 04:58:39 +02:00
development environment.
2022-09-25 00:39:51 +02:00
### To do
2023-02-12 03:31:52 +01:00
- **Everything!** But the progress is fast and after some few days I am not far
2023-10-13 11:44:14 +02:00
away to get a first working codebase. If the core is running I believe adding features
will happen from day to day... ;)
2022-09-25 00:39:51 +02:00
2022-09-29 00:11:00 +02:00
See TODO for internal tasks.
2022-09-25 00:39:51 +02:00
### Ideas
2022-09-25 18:11:04 +02:00
2022-09-28 03:49:32 +02:00
- **Thousands!** For now the goal is to implement most features from the old version
2023-10-13 11:44:14 +02:00
of Linspector. :)
2022-09-25 00:39:51 +02:00
### Manifest
- All of this project **must be MIT licensed ** . When using 3rd party libraries make
2023-10-13 11:44:14 +02:00
sure the license is compatible.
- The core of Linspector should not use 3rd party libraries if possible. Only notifications,
plugins, services and tasks may use other libraries. Copying code into the
source tree is ok when respecting the license. Not using 3rd party libraries
should always be preferred though.
2023-02-24 19:44:55 +01:00
- Inline comments can all be lowercase. Descriptions and documentation comments
2023-10-13 11:44:14 +02:00
must be natural language.
2022-10-06 03:31:40 +02:00
- Arguments to functions must always be in alphabetical order.
2023-02-24 19:42:02 +01:00
- Class member variables must always be in alphabetical order in "\__init__()" or any
2023-10-13 11:44:14 +02:00
function / method.
2023-02-24 19:38:07 +01:00
- Functions must always be in alphabetical order in classes.
2023-02-24 19:40:04 +01:00
- Every commit must be working code without errors even if not being a working version of Linspector.
2022-09-25 00:39:51 +02:00
2022-09-29 08:06:12 +02:00
### Required libraries
2022-09-28 02:21:09 +02:00
2022-09-29 08:09:23 +02:00
Currently, the Linspector core requires the following 3rd party libraries:
2022-09-28 02:21:09 +02:00
2023-10-13 11:44:14 +02:00
- [APScheduler ](https://pypi.org/project/APScheduler/ ) - APScheduler is a Python library that lets you
schedule your Python code to be executed later, either just once or periodically. This is the heart of Linspector for
executing scheduled jobs in intervals.
- [Loguru ](https://pypi.org/project/loguru/ ) - Loguru is a library which aims to bring enjoyable logging in Python.
Linspector uses Loguru for all logging stuff.
- [urwid ](https://pypi.org/project/urwid/ ) - Urwid is a console user interface library for Python. urwid will
become the UI library used for the management TUI of Linspector. CURRENTLY, NOT REQUIRED!
2022-09-28 02:21:09 +02:00
2022-09-28 03:38:56 +02:00
### Other used libraries
2023-08-21 19:18:50 +02:00
databases, monitors, notifications, services or plugins sometimes need to make use of
2023-02-12 03:31:52 +01:00
3rd party libraries, but they are not required to run Linspector properly. Not installing
2022-09-28 03:38:56 +02:00
them may only affect parts of Linspector. Currently used libraries are:
2023-02-12 03:31:52 +01:00
- [CherryPy ](https://cherrypy.dev/ ) - CherryPy is a pythonic, object-oriented HTTP framework.
2023-10-13 11:44:14 +02:00
Used by the HTTPServer plugin.
2023-02-12 03:31:52 +01:00
- [fritzconnection ](https://github.com/kbr/fritzconnection ) - A Python-Tool to communicate with
2023-10-13 11:44:14 +02:00
the AVM Fritz!Box. Uses the TR-064 protocol over UPnP. Used by the FritzboxPhoneStatus and
FritzBoxUplink service.
2023-02-12 03:31:52 +01:00
- [Paramiko ](https://www.paramiko.org/ ) - Paramiko is a pure-Python (2.7, 3.4+) implementation
2023-10-13 11:44:14 +02:00
of the SSHv2 protocol, providing both client and server functionality. Used by the SSH service.
- [PyMySQL ](https://pypi.org/project/pymysql/ ) - This package contains a pure-Python MySQL client library,
based on PEP 249. Used by the MySQL connection module.
2023-02-12 03:31:52 +01:00
- [python-gammu ](https://wammu.eu/python-gammu/ ) - Python bindings for the Gammu library. Used by the
2023-10-13 11:44:14 +02:00
SMS notification.
2023-02-12 03:31:52 +01:00
- [PySNMP ](https://pysnmp.readthedocs.io/en/latest/ ) - PySNMP is a cross-platform, pure-Python
2023-10-13 11:44:14 +02:00
SNMP engine implementation. It features fully-functional SNMP engine capable to act in
Agent/Manager/Proxy roles, talking SNMP v1/v2c/v3 protocol versions over IPv4/IPv6 and other
network transports. Used by the SNMP services (get).
2023-02-12 03:31:52 +01:00
- [requests ](https://requests.readthedocs.io/en/latest/ ) - Requests is an elegant and simple
2023-10-13 11:44:14 +02:00
HTTP library for Python, built for human beings. Used by the Speedtest service.
2022-10-07 03:03:37 +02:00
- [xmpp2 ](https://pypi.org/project/xmpp2/ ) - A XMPP client for Python. Used by the XMPP notification.
2022-09-28 03:38:56 +02:00
2023-02-12 03:31:52 +01:00
These libraries are not being delivered with the Linspector source code and maybe have
2022-09-28 03:38:56 +02:00
different and incompatible licenses. You need to install them using pip, your OS package
2023-02-23 10:46:57 +01:00
manager or by just install everything in requirements.txt (recommended).
2022-09-28 03:38:56 +02:00
2022-09-25 00:39:51 +02:00
### Version numbering
2022-09-29 07:28:34 +02:00
To be compliant to Python packaging guidelines Linspector uses the following versioning
scheme (See: [https://semver.org/ ](https://semver.org/ )):
2022-09-25 00:39:51 +02:00
2022-09-29 07:28:34 +02:00
#### MAJOR.MINOR.MAINTENANCE
2022-09-25 00:39:51 +02:00
2023-02-12 03:31:52 +01:00
- **MAJOR** changes _ can _ change the API. The lesser, the better. It _ expects _ a
complete documentation.
- **MINOR** changes _ must _ not break the API. New features are placed here.
2022-09-29 05:33:54 +02:00
- **MAINTENANCE** changes are "just-in-time" changes or small enhancements which _ should _
2022-09-25 00:39:51 +02:00
not affect the documentation and _ must _ not break the API.
2022-09-29 07:28:34 +02:00
#### Examples:
2022-09-29 05:33:54 +02:00
- 1.2.0.dev1 - Development release
- 1.2.0a1 - Alpha Release
- 1.2.0b1 - Beta Release
- 1.2.0rc1 - Release Candidate
- 1.2.0 - Final Release
- 1.2.0.post1 - Post Release
- 15.10 - Date based release
- 23 - Serial release
2023-02-23 19:06:53 +01:00
(More information: [https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#choosing-a-versioning-scheme ](https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#choosing-a-versioning-scheme ) &
2022-09-29 07:28:34 +02:00
[https://peps.python.org/pep-0440/#public-version-identifiers ](https://peps.python.org/pep-0440/#public-version-identifiers ))
2022-09-29 05:33:54 +02:00
2022-09-26 23:37:40 +02:00
### Configuration file rules
2023-02-23 10:46:57 +01:00
- All configuration options must be documented
- No unused options should be added to the default configuration
2023-02-12 03:31:52 +01:00
- No inline comments so every available character can be used in values
- Values can be overridden in each monitor
2023-02-23 10:46:57 +01:00
- File name case in etc/* is not important but section names and key names
2023-02-12 03:31:52 +01:00
- Comments can be inserted using ';' or '#'
2022-09-26 23:37:40 +02:00
2022-09-28 23:48:21 +02:00
## FAQ
### Is Linspector usable already?
No! Linspector is at a very early stage of development, but I believe it will become
stable until the end of 2022. The old version of Linspector was usable and I ran it for
monitoring a small amount of services for some years.
### Should I try the old version of Linspector?
2023-02-12 03:31:52 +01:00
I recommend not to use the old version of Linspector because the new version will
2022-09-28 23:48:21 +02:00
in no way become backward compatible. Features of the old version will nearly all be
2023-02-12 03:31:52 +01:00
implemented in the new version so if you can wait a little then I recommend to wait
2022-09-28 23:48:21 +02:00
until I release the new version of Linspector.
### Can I use an old configuration of Linspector in the new version?
2023-02-12 03:31:52 +01:00
No! The new configuration does not use JSON files anymore but an INI file syntax based on
2022-09-28 23:48:21 +02:00
a directory tree.
### Why should I use Linspecter even there are other mature and stable tools available already?
2023-02-12 03:31:52 +01:00
Linpector aims to be very small and simple and even should work in home or small
2022-09-28 23:48:21 +02:00
environments. But Linspector also is useful in very large infrastructures for monitoring
thousands of devices and services.
### Can I run multiple instances of the Linspector daemon?
2023-02-12 03:31:52 +01:00
Yes, of course. Since you add a configuration path when running Linspector you can
2022-09-28 23:48:21 +02:00
just pass a different path to a configuration tree to each instance. And since you
2023-02-12 03:31:52 +01:00
can configure the PID file in each configuration you can even can start, stop or
2022-09-28 23:48:21 +02:00
restart each instance in a native way.
2022-09-25 00:39:51 +02:00
## License
2022-10-03 00:38:25 +02:00
Linspector is open-source and completely free and will always be.
2022-09-28 23:49:48 +02:00
### MIT license
2022-09-25 00:39:51 +02:00
2023-02-24 05:14:40 +01:00
Copyright (c) 2013 - 2023 Johannes Findeisen
2022-09-25 00:39:51 +02:00
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.
2024-09-02 03:18:57 +02:00