Skip to main content

A simple application to monitor the health of multiple applications and send notifications to Discord.

Project description

Pynitor Logo

Pynitor

Pynitor is a simple Python application to monitor the health of multiple applications and send notifications to a Discord channel if any of them become unhealthy. It supports specifying individual webhooks for each application to allow for targeted notifications.

Installation

First, clone the repository and navigate into the directory:

git clone https://github.com/na0495/pynitor.git
cd pynitor

Then, install the package:

pip install .

Usage

After installation, you can run the monitor using the command:

pynitor

Configuration

The configuration is defined in app/config.py. This file contains a list of applications to monitor, along with their health check URLs and optional webhook URLs for notifications. Here's a breakdown of the configuration options:

  • APPLICATIONS: A list of dictionaries where each dictionary represents an application to monitor. Each dictionary can have:

    • name: A name for the application (used in notifications).
    • url: The health check URL for the application.
    • webhook_url (optional): The Discord webhook URL for notifications specific to this application.
  • DEFAULT_WEBHOOK_URL: The default webhook URL to use if an application doesn't specify its own webhook.

  • CHECK_INTERVAL: How often (in seconds) to check the health of the applications.

Example Configuration

In app/config.py, you can define your applications like this:

APPLICATIONS = [
    {
        "name": "App1",
        "url": "https://yourapp1.com/health/",
        "webhook_url": "https://discord.com/api/webhooks/your-webhook-id-1"
    },
    {
        "name": "App2",
        "url": "https://yourapp2.com/health/",
        "webhook_url": "https://discord.com/api/webhooks/your-webhook-id-2"
    },
    # Add more applications as needed
]

# Default webhook URL if none is specified for an application
DEFAULT_WEBHOOK_URL = "https://discord.com/api/webhooks/default-webhook-id"

CHECK_INTERVAL = 300  # Check interval in seconds (e.g., 300 seconds = 5 minutes)

Adding Applications

To monitor more applications, simply add them to the APPLICATIONS list in app/config.py. Each application can have its own webhook_url. If no webhook_url is provided, the DEFAULT_WEBHOOK_URL will be used.

Deployment

  • Running Periodically: To run pynitor periodically, you can set up a cron job (Linux/macOS) or use Task Scheduler (Windows). For example, to run the script every 5 minutes, add this to your crontab:
    */5 * * * * /path/to/python /path/to/pynitor
    
    Replace /path/to/python with the path to the Python executable and /path/to/pynitor with the path to the pynitor command.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Contributing

If you want to contribute to this project, feel free to create a pull request or open an issue in the GitHub repository.

Author

Saad Mrabet
Email: saad.mrabet@kubicbits.com

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

pynitor-0.2.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pynitor-0.2.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file pynitor-0.2.0.tar.gz.

File metadata

  • Download URL: pynitor-0.2.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for pynitor-0.2.0.tar.gz
Algorithm Hash digest
SHA256 adb1ce3e48051a88b144a287ede50b826077176bbcaaa84493eb87519541b2ed
MD5 cba69125627f5075b4db34174ba2ef74
BLAKE2b-256 ae8680c1cbd076f31ba96547eaccdc622b8df401ed32e7ce57fa3dc87d6fcf0d

See more details on using hashes here.

File details

Details for the file pynitor-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pynitor-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for pynitor-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bd6c468f1a31731d6d2c2ca9fe2ada96a110e4917ee12ea8cc7025e0519eb605
MD5 acad86d1018d8c6c036a8680b0260a45
BLAKE2b-256 ee7dd38be1fef12919425cb948d69f831586e1e50aefe034b4d6588a8c80433a

See more details on using hashes here.

Supported by

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