Add option to disable Healthchecks ping on soft failure #1031

Closed
opened 2025-03-17 21:44:42 +00:00 by error4o4 · 3 comments

What I'd like to do and why

In #842 a change was made to ping Healtchecks/monitoring with "finish" in the case of soft failure.

That makes sense in some cases, but not always.

I have two config files : one backups to a cloud service, and one to a USB disk. In the config for the USB disk, i use a before_backup hook to run findmnt and generate a soft failure (exit 75) if the USB disk is not mounted.
With borgmatic 1.9.13, it sends a ping to Healthchecks so the backup status is OK on Healthchecks, even though the backup didn't run.
I would like to be able to configure an option to make it revert to the old logic : only send the start ping to Healthchecks, no end ping, so Healthchecks will warn me if no backups finished successfully within the specified timeframe.

I guess I could achieve this with the backup_everything hook, but I can't because I still need borgmatic to run my other config file (cloud backup).

PS : the before: configuration hook, planned for borgmatic 2, should solve my problem. I don't know if it is going to be released soon, but this feature request will probably be obsolete with borgmatic 2.

Other notes / implementation ideas

No response

### What I'd like to do and why In https://projects.torsion.org/borgmatic-collective/borgmatic/issues/842 a change was made to ping Healtchecks/monitoring with "finish" in the case of soft failure. That makes sense in some cases, but not always. I have two config files : one backups to a cloud service, and one to a USB disk. In the config for the USB disk, i use a `before_backup` hook to run findmnt and generate a soft failure (`exit 75`) if the USB disk is not mounted. With borgmatic 1.9.13, it sends a ping to Healthchecks so the backup status is OK on Healthchecks, even though the backup didn't run. I would like to be able to configure an option to make it revert to the old logic : only send the start ping to Healthchecks, no end ping, so Healthchecks will warn me if no backups finished successfully within the specified timeframe. I guess I could achieve this with the `backup_everything` hook, but I can't because I still need borgmatic to run my other config file (cloud backup). PS : the `before: configuration` hook, planned for borgmatic 2, should solve my problem. I don't know if it is going to be released soon, but this feature request will probably be obsolete with borgmatic 2. ### Other notes / implementation ideas _No response_
Owner

Thanks for filing this. borgmatic 2 should be released within the next few weeks, and at minimum it is planned to be the next borgmatic release. So that should hopefully satisfy this need. But just to make sure: How do you envision the new before: configuration command hook solving this need? Is the ideas that you'd move your findmnt soft failure call to the before: configuration level?

Thanks for filing this. borgmatic 2 *should* be released within the next few weeks, and at minimum it is planned to be the next borgmatic release. So that should hopefully satisfy this need. But just to make sure: How do you envision the new `before: configuration` command hook solving this need? Is the ideas that you'd move your `findmnt` soft failure call to the `before: configuration` level?
Author

Yes, if I move the findmnt soft failure call to the before: configuration level, the whole config for the USB disk will not run, so Healthchecks will get no ping for it, which is right : no backup happened.

My other config file (cloud backup) will run as usual and ping its own Healthchecks URL, so I will still know if it happened and completed successfully or not.

I tried the backup_everything hook with 1.9.13, its logic would be good for me if I had only the USB backup config, but I can't use it because it also skips my cloud backup. I guess this will be solved by the new before: configuration hook.

Yes, if I move the `findmnt` soft failure call to the `before: configuration` level, the whole config for the USB disk will not run, so Healthchecks will get no ping for it, which is right : no backup happened. My other config file (cloud backup) will run as usual and ping its own Healthchecks URL, so I will still know if it happened and completed successfully or not. I tried the `backup_everything` hook with 1.9.13, its logic would be good for me if I had only the USB backup config, but I can't use it because it also skips my cloud backup. I guess this will be solved by the new `before: configuration` hook.
Owner

Gotcha. Yes, looking at the code in main, before: configuration does respect the soft failure exit code and therefore won't ping any monitoring hooks like Healthchecks (for that configuration file) in that situation. So given that I think this satisfies your need, I'll close this ticket for now. But please let me know if it turns out the new hook does not meet your needs in practice. Thanks!

Gotcha. Yes, looking at the code in main, `before: configuration` does respect the soft failure exit code and therefore won't ping any monitoring hooks like Healthchecks (for that configuration file) in that situation. So given that I think this satisfies your need, I'll close this ticket for now. But please let me know if it turns out the new hook does not meet your needs in practice. Thanks!
Sign in to join this conversation.
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
borgmatic-collective/borgmatic#1031
No description provided.