cron-mon-io / cron-mon

A tool for monitoring cronjobs, written in Rust
MIT License
2 stars 0 forks source link

CronMon Logo

A simple tool for monitoring cronjobs

CI Docker Rust Beta

CronMon is a tool for monitoring cronjobs (or tasks of a similar nature), written in Rust. It was created for two reasons:

  1. Curiosity as to whether or not Rust was a good choice of language for building web services and APIs, and how well Domain Driven Design could be applied in that context.
  2. A need to monitor numerous cronjobs, but nothing to justify spending money on one of the pre-existing soloutions.

Further to the second point, note that there isn't anything novel about CronMon; there are plenty of existing solutions in this space already, such as Cronitor.io, Healthchecks.io, Cronhub.io, and Sentry’s Cron Monitoring, to name but a few.

Current status

CronMon is currently still under development, but it does support basic usage.

Basic design

CronMon is designed around Monitors and Jobs. A Monitor is responsible for monitoring the execution of a specific cronjob or task and reporting any issues or failures, and contains Jobs, which are a record of a single execution of the cronjob or task being monitored.

CronMon is comprised of two key components; a RESTful API for creating and managing Monitors, and recording their Jobs; and a microservice that detects when jobs are late and notifies the owner of the Monitor.

Note that CronMon currently doesn't have the ability to notify when Jobs are late, but this is coming soon.

There is also a frontend application for CronMon, which you'll find at https://github.com/cron-mon-io/cron-mon-app.

Getting started

All you need to setup a development environment for CronMon is Docker and your IDE of choice. A Makefile is provided to make driving the project quick and simple. The easiest way to get setup is to simply clone the project and then run make install from the root of the project to build the containers. From here you can run the projects (unit) tests by running make test, and you can run the API application via make run, after which the API will be available to you locally at http://127.0.0.1:8000, which you'll be able to confirm by hitting the healthcheck endpoint.

Running the API

You'll probably want to also run make run-monitor in a separate terminal/ tab to run the background service that monitors for late jobs (this is purely to avoid cluttering the same terminal/ tab with logs from the API and the background serice). When this is running you should see something similar to this in the terminal its running in.

Running the monitor

A Development container configuration file is also provided to ensure your IDE can use your local containers' environments and to provide a pre-setup, consistent and reliable debug configuration (this is tried and tested on Visual Studio Code).

Makefile

Deployment

CronMon currently isn't deployed anywhere, but this may change in the future.