Lifeguard DocsAdded a new hot reload feature 🔥
Read nowAn Opined Monitoring And Self Healing System
Quickly create scripts to perform validations to monitor systems, applications or infrastructure. Easily take action when behavior changes or when a problem is detected!
import lifeguard_mongodb
from lifeguard.settings import SettingsManager
from lifeguard.auth import BASIC_AUTH_METHOD
PLUGINS = [lifeguard_mongodb
]
def setup(lifeguard_context):
lifeguard_context.auth_method = BASIC_AUTH_METHOD
lifeguard_context.users = [
{
"username": "user",
"password": "pass"
}
]
import lifeguard_mongodb
PLUGINS = [
lifeguard_mongodb,
# other plugins
]
# You can execute code in the lifeguard startup process
def setup(_lifeguard_context):
pass
Plugins Based
Like other frameworks, Lifeguard was built with mechanisms that facilitate the creation of plugins, separating what is essential from what is optional. Example: The core must know when or not to notify, but we dont need to load the MS Teams notification routines if we are going to use Google Chat.
Proactive Validations
Most monitoring systems work reactively, like the Grafana Alertmanager solution, that is, based on things (in many cases, errors) that have already happened that alerts are triggered. Lifeguards focus is on making it easy to create proactive validations that can look for errors and send easily understandable alerts.
Deploy and Scale Easily
Lifeguard consists of two fundamental elements. A web server that provides some APIs where you can provide a GUI (the GUI also works based on plugins) and a queue, or queues, to perform validations. Both can run together or not and can scale independently as needed. Validations can be performed on specific instances of queues. This organization makes it much easier to scale resources depending on the type of use.
Starting a project
To start a project, you need to install the Lifeguard package using pip:
Create a new directory and create a main settings file used for Lifeguard:
The -g parameter will create a new file called lifeguard_settings.py with the initial structure. The example in the right side is a example.
import lifeguard_mongodb
from lifeguard.settings import SettingsManager
from lifeguard.auth import BASIC_AUTH_METHOD
PLUGINS = [lifeguard_mongodb
]
def setup(lifeguard_context):
lifeguard_context.auth_method = BASIC_AUTH_METHOD
lifeguard_context.users = [
{
"username": "user",
"password": "pass"
}
]
Are any pods not running?
There are 1 pod(s) not running:
1. gallery-7474d49d68-x120n:
The root cause of this error is that the file /file/not/exists.log does not exist. The tail command is trying to read the file, butit . cannot find it because it does not exist.
Open AI
We use the OpenAI API to generate an explanation of the root cause of a given trace.
A complete example can be found in this validation. In this example the function pods_validation investigates de problem in the events of pods or in the pods logs and put problem in the details of validation_response. The action in the lifeguard-openai plugins use the tracebacks to generate the explanation.
Built Plugins
Integrate with the main technologies on the market
MongoDB
This plugin is used to store the results of validations in a MongoDB database.
TinyDB
This plugin is used to store the results of validations in a TinyDB database. TinyDB produces a single json file with data.
Google Chat Notification
This plugin is used to send notifications to Google Chat.
MS Teams Notification
This plugin is used to send notifications to MS Teams.
Telegram
This plugin is used to send notifications to Telegram. The plugin provides a simple way to integrate bot commands with Lifeguard.
RabbitMQ
This plugin contains some common validations for RabbitMQ queues.
Simple Dashboard
This plugin is used to create a simple dashboard with the results of validations. Used as example to build a simple GUI.
OpenAI
This plugin provides actions to interact with OpenAI API. The first action created is used to analize a traceback and explains what is the problem.