Healthchecks integration for independent operations #366
Labels
No labels
blocked
breaking
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No milestone
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
borgmatic-collective/borgmatic#366
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
(This is related to witten/borgmatic#255)
I have 2 cron jobs, one that runs the
pruneandcreateoperations multiple times a day and acheckjob that runs once a week at a given time.I'd like to monitor both using the healthchecks integration.
Steps to reproduce (if a bug)
The healthchecks integration pings the healthchecks URL for both these cron jobs but it is impossible to set a schedule on a single healthchecks monitor that covers the expected starting times of both these cron jobs.
If I set the schedule of the monitor to match the multiple-times-a-day cron job, pings from the
checkjob will be extraneous and will not trigger alerts when missed and vice-versa if I use the schedule of the 2nd cron job.While I could stop using the integration and use manual
curlcommands to make it work, I then lose the benefits of the integration which provides more than just pinging URLs.Actual behavior (if a bug)
See the previous section
Expected behavior (if a bug)
TBD as this is a feature request but it will be helpful to have a way to override/specify the healthchecks URL for specific actions.
Other notes / implementation ideas
Environment
borgmatic version: 1.5.10
borgmatic installation method: Installed in a
virtualenvenvironment from PyPI.Borg version: 1.1.14
Python version: 3.7.3
operating system and version: Debian 10 Buster
Thank you for taking the time to file this! A couple of thoughts here..
One way I could see to satisfy this need would be to expand the existing Healthchecks configuration schema to encompass different ping URLs per action. Made-up example:
Another idea is to leave the existing configuration schema as-is, but then override the ping URL on the command-line when running each action in a cron job. And use a separate ping URL / Healthchecks monitor for each cron job. Example:
This approach has the benefit of working today without any changes to borgmatic. The downside of course is you need to put the ping URL in your cron job.
Let me know your thoughts!
@witten, thanks for the very quick response 🙂
I'm perfectly fine with using this solution for my needs if a lot of effort and thought has to be put into implementing the former. It will be good to document this scenario and solution.
It might be easier to declare a default URL and override only the ones that have to be different.
#518 is a very similar change on the Cronitor monitoring hook. It's possible that work there could apply to Healthchecks as well.
Subscribing since I have the same issue!
Is anybody currently working on this? If not, I'm thinking about taking a look at it, because I would be really interested in having this.
As far as I know, nobody is currently working on this! Please let me know if you have any questions as you dig into this.
Thanks @witten. I will give it a try and get back to your offer if needed.
One thing I would already like to clarify. I would like to have the ping for check only trigger, if a check was actually executed (i.e. not skipped due to frequency). I think this would allow for a more accurate health monitoring, e.g. if the check frequency is wrongly configured.
Do you think this makes sense in general? Would this be too complicated from an implementation perspective?
Here are some thoughts on that:
ping_monitor()that takes several arguments—but none of them contain the current borgmatic actions.checkif no checks actually ran? I'm not sure how you'd do that since at the pointping_monitor()first runs (the ping start), checks haven't even attempted to run yet. All we know is thatcheckis among the actions to run. And on the other side (ping finish), you presumably wouldn't have any access to the check results.So my recommendation would be to call the
checkping URL regardless of which check(s) do or don't run. And then if you need more details about what specific checks ran, that'll show up in both your borgmatic system logs and your Healtchecks logs. I realize though that that won't allow for easy programmatic checking that a check's frequency is configured correctly.However this is just a recommendation based on what I remember of the code; if you find a decent way to accomplish this anyway, I'd be happy to hear about it.