Lightweight OS-agnostic service monitoring API
Platform Supported
Deployments
Recommendations
- Install
python
3.11 or above - Use a dedicated virtual environment
Install PyNinja
python -m pip install pyninja
Initiate - IDE
import pyninja
if __name__ == '__main__':
pyninja.start()
Initiate - CLI
pyninja start
Use
pyninja --help
for usage instructions.
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
andseconds
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.
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
andPROCESSS
are case-sensitive
Refer samples directory for examples.
Docstring format: Google
Styling conventions: PEP 8
and isort
Requirement
python -m pip install gitverse
Usage
gitverse-release reverse -f release_notes.rst -t 'Release Notes'
pre-commit
will ensure linting, run pytest, generate runbook & release notes, and validate hyperlinks in ALL
markdown files (including Wiki pages)
Requirement
python -m pip install sphinx==5.1.1 pre-commit recommonmark
Usage
pre-commit run --all-files
https://pypi.org/project/PyNinja/
https://thevickypedia.github.io/PyNinja/
© Vignesh Rao
Licensed under the MIT License