Skip to main content

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_watchdog will look for a configuration file under the $ARB_CONFIGS_PATH directory. ($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:

Example arb_watchdog_cli

Running Tests

To run the tests for the arb_watchdog package, use the following command:

python -m unittest discover -s tests

Release files for arb-watchdog 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for arb-watchdog 1.0.0
File Size Uploaded
arb_watchdog-1.0.0.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for arb-watchdog 1.0.0
File Interpreter ABI Platform
arb_watchdog-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.2 kB

Release files / arb_watchdog-1.0.0.tar.gz

Download URL arb_watchdog-1.0.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
835dc4dc31aebf39529bdf797e6d9794b2c4624bbf871c1817e22de24bb94a5d
BLAKE2b-256 checksum
How to use checksums
5eccbf0c616af5ebb5416ec9a3556a283fcda5e17a58e87353989125f29921f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release files / arb_watchdog-1.0.0-py3-none-any.whl

Download URL arb_watchdog-1.0.0-py3-none-any.whl
Size 2.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d1f4465c4bad5fba74f3ba07e1ccab9aa11a862f055140a6bc36ba4751d04582
BLAKE2b-256 checksum
How to use checksums
132024df3d0f607b66c8b067a687d76cbbac0abeffd8a58ba875896d513194d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release history Release notifications | RSS feed

1.0.1

2 release files

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page