https://github.com/thevickypedia/pyninja
Service monitoring API
https://github.com/thevickypedia/pyninja
fastapi javascript jinja2-templates lightweight-framework monitoring-tool pie-chart progress-bar pyninja realtime-tracking realtime-updates
Last synced: 2 months ago
JSON representation
Service monitoring API
- Host: GitHub
- URL: https://github.com/thevickypedia/pyninja
- Owner: thevickypedia
- License: mit
- Created: 2024-08-10T18:54:50.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-01-07T22:32:32.000Z (5 months ago)
- Last Synced: 2025-03-16T21:35:30.130Z (2 months ago)
- Topics: fastapi, javascript, jinja2-templates, lightweight-framework, monitoring-tool, pie-chart, progress-bar, pyninja, realtime-tracking, realtime-updates
- Language: Python
- Homepage: https://thevickypedia.github.io/PyNinja/
- Size: 642 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PyNinja
Lightweight OS-agnostic service monitoring API![Python][label-pyversion]
**Platform Supported**
![Platform][label-platform]
**Deployments**
[![pages][label-actions-pages]][gha_pages]
[![pypi][label-actions-pypi]][gha_pypi]
[![markdown][label-actions-markdown]][gha_md_valid][![Pypi][label-pypi]][pypi]
[![Pypi-format][label-pypi-format]][pypi-files]
[![Pypi-status][label-pypi-status]][pypi]## Kick off
**Recommendations**
- Install `python` [3.11] or above
- Use a dedicated [virtual environment]**Install PyNinja**
```shell
python -m pip install pyninja
```**Initiate - IDE**
```python
import pyninjaif __name__ == '__main__':
pyninja.start()
```**Initiate - CLI**
```shell
pyninja start
```> Use `pyninja --help` for usage instructions.
## Environment Variables
Sourcing environment variables from an env file
> _By default, `PyNinja` will look for a `.env` file in the current working directory._
**Basic API**
- **APIKEY** - API Key for authentication.
- **SWAGGER_UI_PARAMETERS** - Dictionary of parameters to be included in the Swagger UI.
- **NINJA_HOST** - Hostname for the API server.
- **NINJA_PORT** - Port number for the API server.**Functional improvements**
- **RATE_LIMIT** - List of dictionaries with `max_requests` and `seconds` to apply as rate limit.
- **LOG_CONFIG** - Logging configuration file path.**Remote execution and FileIO**
- **REMOTE_EXECUTION** - Boolean flag to enable remote execution.
- **API_SECRET** - Secret access key for running commands on server remotely.
- **DATABASE** - FilePath to store the auth database that handles the authentication errors.⚠️ Enabling remote execution can be extremely risky and poses a major security threat.
So use **caution** and set the **API_SECRET** to a strong value.**Monitoring UI**
- **MONITOR_USERNAME** - Username to authenticate the monitoring page.
- **MONITOR_PASSWORD** - Password to authenticate the monitoring page.
- **MONITOR_SESSION** - Session timeout for the monitoring page.
- **DISK_REPORT** - Boolean flag to enable disk report feature using [PyUdisk].
- **MAX_CONNECTIONS** - Maximum number of monitoring sessions allowed in parallel.
- **NO_AUTH** - Boolean flag to disable authentication for monitoring page.
- **PROCESSES** - List of process names to include in the monitor page.
- **SERVICES** - List of service names to include in the monitor page.
- **SERVICE_LIB** - Library path to retrieve service info.
- **SMART_LIB** - Library path for S.M.A.R.T metrics using [PyUdisk].
- **GPU_LIB** - Library path to retrieve GPU names using [PyArchitecture].
- **DISK_LIB** - Library path to retrieve disk info using [PyArchitecture].
- **PROCESSOR_LIB** - Library path to retrieve processor name using [PyArchitecture].> Certain environment variables like `SERVICES` and `PROCESSS` are case-sensitive
> Refer [samples] directory for examples.
## Coding Standards
Docstring format: [`Google`][google-docs]
Styling conventions: [`PEP 8`][pep8] and [`isort`][isort]## [Release Notes][release-notes]
**Requirement**
```shell
python -m pip install gitverse
```**Usage**
```shell
gitverse-release reverse -f release_notes.rst -t 'Release Notes'
```## Linting
`pre-commit` will ensure linting, run pytest, generate runbook & release notes, and validate hyperlinks in ALL
markdown files (including Wiki pages)**Requirement**
```shell
python -m pip install sphinx==5.1.1 pre-commit recommonmark
```**Usage**
```shell
pre-commit run --all-files
```## Pypi Package
[![pypi-module][label-pypi-package]][pypi-repo][https://pypi.org/project/PyNinja/][pypi]
## Runbook
[![made-with-sphinx-doc][label-sphinx-doc]][sphinx][https://thevickypedia.github.io/PyNinja/][runbook]
## License & copyright
© Vignesh Rao
Licensed under the [MIT License][license]
[//]: # (Labels)
[label-actions-markdown]: https://github.com/thevickypedia/PyNinja/actions/workflows/markdown.yaml/badge.svg
[label-pypi-package]: https://img.shields.io/badge/Pypi%20Package-pyninja-blue?style=for-the-badge&logo=Python
[label-sphinx-doc]: https://img.shields.io/badge/Made%20with-Sphinx-blue?style=for-the-badge&logo=Sphinx
[label-pyversion]: https://img.shields.io/badge/python-3.11%20%7C%203.12-blue
[label-platform]: https://img.shields.io/badge/Platform-Linux|macOS|Windows-1f425f.svg
[label-actions-pages]: https://github.com/thevickypedia/PyNinja/actions/workflows/pages/pages-build-deployment/badge.svg
[label-actions-pypi]: https://github.com/thevickypedia/PyNinja/actions/workflows/python-publish.yaml/badge.svg
[label-pypi]: https://img.shields.io/pypi/v/PyNinja
[label-pypi-format]: https://img.shields.io/pypi/format/PyNinja
[label-pypi-status]: https://img.shields.io/pypi/status/PyNinja[3.11]: https://docs.python.org/3/whatsnew/3.11.html
[virtual environment]: https://docs.python.org/3/tutorial/venv.html
[release-notes]: https://github.com/thevickypedia/PyNinja/blob/main/release_notes.rst
[gha_pages]: https://github.com/thevickypedia/PyNinja/actions/workflows/pages/pages-build-deployment
[gha_pypi]: https://github.com/thevickypedia/PyNinja/actions/workflows/python-publish.yaml
[gha_md_valid]: https://github.com/thevickypedia/PyNinja/actions/workflows/markdown.yaml
[google-docs]: https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings
[pep8]: https://www.python.org/dev/peps/pep-0008/
[isort]: https://pycqa.github.io/isort/
[sphinx]: https://www.sphinx-doc.org/en/master/man/sphinx-autogen.html
[pypi]: https://pypi.org/project/PyNinja
[pypi-files]: https://pypi.org/project/PyNinja/#files
[pypi-repo]: https://packaging.python.org/tutorials/packaging-projects/
[license]: https://github.com/thevickypedia/PyNinja/blob/main/LICENSE
[runbook]: https://thevickypedia.github.io/PyNinja/
[samples]: https://github.com/thevickypedia/PyNinja/tree/main/samples
[PyUdisk]: https://github.com/thevickypedia/PyUdisk
[PyArchitecture]: https://github.com/thevickypedia/PyArchitecture