Skip to main content

Caduceus notifies you if your scheduled tasks/cron jobs did not run.

Project description

Caduceus

pipeline status

What is Caduceus?

Caduceus is that long stick with the intertwined snakes that Hermes used to carry around. It is also a service that will notify you if your scheduled tasks/cronjobs fail to run.

Motivation

You know how you set all these cronjobs to run, and added fancy error reporting and things, only to realize too late that this doesn't help you at all when the server has been down for a month and nobody noticed? Caduceus won't let this happen again.

Rather than trigger on failure, Caduceus triggers on absence of success. Services have to actively check in (by visiting a URL), and, if they don't, Caduceus notifies you by email that the task has failed. If the service starts working again, Caduceus will notify you of that as well.

Installation

To install Caduceus, you can just get it from PyPI:

pip install caduceus

Alternatively, you can pull the Docker image:

docker pull registry.gitlab.com/stavros/caduceus:latest

Usage

To run Caduceus, you need to configure it. This is done by placing a file called caduceus.toml in the directory you want to run Caduceus in. That directory is where the Caduceus SQLite database will be created.

If you installed Caduceus from the repo or with pip, just run it:

caduceus

It will load the configuration from the file, create its database and start running on http://localhost:5000/.

To run it via Docker:

docker run -v (pwd):/caduceus registry.gitlab.com/stavros/caduceus:latest

Configuration

Here's a sample configuration file (which is also available as caduceus.toml.example in the repository):

[alerting]
# Where you want the notification emails sent if services don't check in.
recipient_emails = [ "notifyme@example.com", "otherdev@example.com" ]
# An optional secret key to use for checking in.
secret_key = "somelongkey"

[alerting.smtp]
# SMTP server configuration, for sending email.
from_addr = "caduceus@example.com"
hostname = "example.com"
port = 25
username = "myuser"
password = "mypassword"

[alerts]
# Your alerts go here.
# This is the top-level alerts section, you can add as many alerts as you want here.

# An alert needs a short name (here, `raidscrub`), and an interval it needs to check in by.
[alerts.raidscrub]
every = "1h"

[alerts.backups]
every = "1d"

[alerts.alwaysfail]
every = "1s"

The above config defines three services, raidscrub, backups and alwaysfail. raidscrub needs to check in every hour, backups needs to check in every day, and alwaysfail needs to check in every second. That's why it was called that.

Checking in

Checking in is done by retrieving a URL on the server. The URL for checking in and resetting the alert timer is /reset/<alert name>/. For example, to check in to backups if you haven't specified a secret_key (and if Caduceus is running on example.com), you'd simply do:

curl http://example.com/reset/backups/

If you did specify a secret key, just include it:

curl http://example.com/reset/backups/?key=<your secret_key>

If your alert is set up for, say, one hour, and your task does not check in, you will get an email one hour after its last checkin, saying "your task has not checked in". If it still doesn't check in, you'll get another email an hour after that, then an hour after that, etc, until it does, at which point you'll get an email saying that the job is now fine.

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

caduceus-0.0.7.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

caduceus-0.0.7-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file caduceus-0.0.7.tar.gz.

File metadata

  • Download URL: caduceus-0.0.7.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for caduceus-0.0.7.tar.gz
Algorithm Hash digest
SHA256 5b040bf36194c01ca062d31f339eb0fef75831ff2fcb9fe3dcc3a8dbf51e3ca6
MD5 9e122d2d9eb7008cf06402e0934450eb
BLAKE2b-256 340b76d519f040b1b9a182cf8458fdc12d888406e954f6c796e124163309bc0e

See more details on using hashes here.

File details

Details for the file caduceus-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for caduceus-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 6d0da40f9672595325562ccf6049ecb4ce9d182b7688d14385795eb9763a88ba
MD5 f0bae76f7a7668a28f78ff013c8b1324
BLAKE2b-256 a903bcfaf8b2cbaa6a6a1b66c7cf13720715d0e62a53c36140c3d6fa4435f195

See more details on using hashes here.

Supported by

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