Skip to main content

A process monitoring and alerting tool that keeps an up-to-date status of processes in Redis

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arb_watchdog-1.0.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

arb_watchdog-1.0.0-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file arb_watchdog-1.0.0.tar.gz.

File metadata

  • Download URL: arb_watchdog-1.0.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for arb_watchdog-1.0.0.tar.gz
Algorithm Hash digest
SHA256 835dc4dc31aebf39529bdf797e6d9794b2c4624bbf871c1817e22de24bb94a5d
MD5 e52a23577a03b1c1dfe53d3d146fa2f1
BLAKE2b-256 5eccbf0c616af5ebb5416ec9a3556a283fcda5e17a58e87353989125f29921f3

See more details on using hashes here.

File details

Details for the file arb_watchdog-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: arb_watchdog-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 2.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for arb_watchdog-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d1f4465c4bad5fba74f3ba07e1ccab9aa11a862f055140a6bc36ba4751d04582
MD5 af1fb173d9da4e8848f7dd5783dc88cf
BLAKE2b-256 132024df3d0f607b66c8b067a687d76cbbac0abeffd8a58ba875896d513194d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page