Observability page for PyNinja
2.5K
Platform Supported
Deployments
Recommendations
python 3.11 or aboveInstall PyObservability
python -m pip install pyobservability
Initiate - IDE
import pyobservability
if __name__ == '__main__':
pyobservability.start()
Initiate - CLI
pyobservability start
Use
pyobservability --helpfor usage instructions.
Containerized Deployment
docker pull thevickypedia/pyobservability:latest
docker run \
--name observability \
-p 8080:80 \
-v /home/user/config:/config \
--restart=no \
thevickypedia/pyobservability
PyObservability can optionally stream metrics through a /metrics endpoint in Prometheus format, which can be scraped by Prometheus and visualized in Grafana.
The dashboard is powered by Prometheus, which is used to scrape the metrics from the targets and store them in a time-series database.
Steps to set up the Grafana dashboard:
config directory in the current working directory to store the configuration files for the server and Grafana containers.config directory and update it with the appropriate values for your environment../docker-launch.sh to start the server and Grafana containers using Docker Compose.
NOTE: Set env variables [OR] update the
docker-compose-*.ymlfiles with the desired port numbers andconfigdirectory location before running the script.
http://localhost:3000 and log in with the credentials specified in the secrets.json file.http://host.docker.internal:9090 (or http://localhost:9090 if running on Linux).By default,
PyObservabilitywill look for a.envfile in the current working directory. JSON file format is also supported with a custom kwarg or env varenv_filepointing to the filepath.
Mandatory
PyNinja in the following format.
TARGETS='[{"name":"node1","base_url":"http://192.168.1.10:8000","apikey":"token1"},{"name":"node2","base_url":"http://192.168.1.11:8000"}]'Defaults
127.0.0.1 or 0.0.0.08080Optional
False, displaying a Grafana like dashboard.Logging
PyObservability uses
uvicornlogger by default. Following options can be used to override the default logger.
file or stdout.False.LOG is set to file.Uptime Kuma
Uptime Kuma integration can be enabled by setting the following environment variables.
GitHub Runners
GitHub Runners integration can be enabled by setting the following environment variables.
read:org permissions.Prometheus Metrics
Enabling prometheus metrics will expose a
/metricsendpoint in Prometheus format, which can be scraped by Prometheus and visualized in Grafana.
This endpoint is automatically secured with the same credentials as the monitoring page if authentication is enabled.
False.Warning
Enabling prometheus metrics will increase the resource usage in all the monitored nodes, as the metrics are constantly streamed as long as the server is running. It is recommended to use this option with a high polling ``interval`` to reduce the resource usage.
© Vignesh Rao
Licensed under the MIT License
Content type
Image
Digest
sha256:578cc694a…
Size
128.4 MB
Last updated
19 days ago
docker pull thevickypedia/pyobservability