Simple backup status
Table of Contents
Simple backup status #
Currently running Back in time to backup one desktop machine at home. Smooth run, efficient, but have to check daily if the backup is ok or else. This is the problem to solve.
Architecture #
To start small I’m using Gatus,a developer-oriented health dashboard that gives you the ability to monitor your services using HTTP and other simple methods. Just let it know how often to call the endpoint and what values expect from the response body
|
|
On the backup side Back in time offers user callbacks, basically a script that is called after or before each backup phase (backup start, backup end, on error and so), being it an interesting integration point
Given that Gatus erquires a REST to query for status and Back in time has no server to store it, the proposed solution is to make user callback save the last status for Gatus retrieval. Why saving last status only instead of results history? this will allow to check the point of failure and revert any change that caused it. Remember the simple solution goal. Back in time has its own log, then on error the GUI can be opened and checked, also Gatus maintains a status log (green on success, red otherwise). Then saving status is a waste of resources like development time (have to save data in store, make depuration process, and so)
Now the server part for status storing. Another simple solution I’m working with is n8n, a workflow automation platform for technical teams. A mix of point and click workflow builder with a lot of integration nodes plus glue logic to make it work the way you want. The proposed implementation contains two enpoints, one for Back in time status reporting (and saving) and a second one for status querying by Gatus
Implementation #
Let’s start with n8n and status reporting and querying
The Status report endpoint receives a POST request where the backup status and message is expected (as especified by Back in time user callbacks) and stores them plus the current timestamp (Save last execution node). To keep it simple no database is used but storing the results in memory. In case n8n is restarted and data is lost the verification will fail (no data). Checking for backup failure in this case is my B plan. I can live with this design flaw
For status querying the Status query webhook is used which calls Get last execution code which verifies that the backup has been taken in the last 24 hours and status code is 3 (everything is fine)
Going to Back in time implemented a simple script that call the n8n endpoint on each backup phase to report status
|
|
Finally the Gatus configuration. Just add the new endpoint query to the configuration and let the magic begin! 🎇 🪄
|
|