arb_watchdog
arb_watchdog is a Python package designed to monitor and manage the status of specified processes. It uses Redis as a backend for storing process data and provides a simple API for interacting with this data. The package is highly configurable and can be used to monitor and manage a wide range of processes.
Features
- Monitor the status of specified processes
- Store process data in Redis
- Configurable process monitoring interval
- Automatically reloads configuration when the config file is updated
- Supports multiple processes
- Provides a simple API for interacting with process data
Installation
To install the arb_watchdog package, you can use pip:
pip install arb_watchdog
Config File
First, create a configuration file in JSON format with the following keys:
redis_host: The hostname of your Redis server (e.g., "localhost")redis_port: The port number of your Redis server (e.g., 6379)interval: The interval (in seconds) at which the processes will be monitored (e.g., 60)processes: A list of process names to monitor (e.g., ["fake_process", "another_fake_process"])
Example configuration file (config.json):
{
"redis_host": "localhost",
"redis_port": 6379,
"interval": 60,
"processes": ["fake_process", "another_fake_process"]
}
By default,
arb_watchdogwill look for a configuration file under the$ARB_CONFIGS_PATHdirectory. ($ARB_CONFIGS_PATH/arb_watchdog_config.json). If this variable is not set, it will use./arb_watchdog_config.json.
Usage
To use arb_watchdog, import the package and create a ProcessWatcher instance with the path to your configuration file:
from arb_watchdog.process_watcher import ProcessWatcher
config_file = "config.json"
process_watcher = ProcessWatcher(config_file=config_file)
You can then use the ProcessWatcher instance to perform various operations, such as getting the process list, updating process data, and getting process data for specified processes:
# Get the list of processes to monitor
process_list = process_watcher.get_process_list()
# Update process data
process_data = ProcessData(name="fake_process", pid=12345, status="UP")
process_watcher.update_process_data(process_data)
# Get process data for a specified process
process_data = process_watcher.get_process_data("fake_process")
Console Scripts
arb_watchdog provides two console scripts for easy interaction with the package: arb_watchdog and arb_watchdog_cli.
arb_watchdog
arb_watchdog is a console script that runs the arb_watchdog process in the background, continuously monitoring the specified processes and updating their data in Redis. To run the script, simply execute the following command in your terminal, replacing <config_file> with the path to your configuration file:
arb_watchdog -f <config_file>
arb_watchdog_cli
arb_watchdog_cli is a console script that shows data stored in the Redis database based on the config.json file
To run the script, execute the following command in your terminal, replacing <config_file> with the path to your configuration file:
arb_watchdog_cli -f <config_file>
Example output:
Running Tests
To run the tests for the arb_watchdog package, use the following command:
python -m unittest discover -s tests
Metadata
Release files for arb-watchdog 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| arb_watchdog-1.0.1.tar.gz | 5.5 kB | Without provenance | Details for arb_watchdog-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| arb_watchdog-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for arb_watchdog-1.0.1-py3-none-any.whl |
Total release size: 12.4 kB
Release files / arb_watchdog-1.0.1.tar.gz
| Download URL | arb_watchdog-1.0.1.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d6b4ad207c22d347dbc667b5941cf706bf8f2e5f6a7965b7c4c52b3f4950980c
|
|
BLAKE2b-256 checksum How to use checksums |
1547a8682a4dba04214e71abd7333d0a265f0c0a6936903b19c98af280dd03fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Release files / arb_watchdog-1.0.1-py3-none-any.whl
| Download URL | arb_watchdog-1.0.1-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c66d11166080c554e4add2a24b791166b0c41485c55626b908a49acaaff932da
|
|
BLAKE2b-256 checksum How to use checksums |
44eecad7b0b2e264a7e9b66dbb10525c785a35a1e6915900e38bf48afaba6db8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Security for arb-watchdog 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.