healthchecks ping_url support replacement with variables #756

Open
opened 2023-09-15 14:07:06 +00:00 by marcohald · 2 comments

What I'd like to do and why

It would be great if Variables would get replaced in the healthchecks ping_url
I do not use healthchecks but a self written Application that consume the Logs.
My Use Case is the FQDN that I would like to replace in the URL ?host={fqdn}

Other notes / implementation ideas

No response

### What I'd like to do and why It would be great if Variables would get replaced in the healthchecks ping_url I do not use healthchecks but a self written Application that consume the Logs. My Use Case is the FQDN that I would like to replace in the URL ?host={fqdn} ### Other notes / implementation ideas _No response_
Owner

So to clarify, you're wanting borgmatic to support Borg placeholders? One challenge with that I can think of would be that it could be ambiguous whether you wanted borgmatic or Borg to do the substitution for any given placeholder. Although I guess if they really were identical, it wouldn't matter.

It's not quite the same as Borg placeholders, but have you seen borgmatic's constants feature? That lets you define your own values like fqdn or whatever else. Another alternative would be to use an environment variable, either an existing variable or one you set explicitly for this purpose. Example:

healthchecks:
    ping_url: https://hc-ping.com/addffa72-da17-40ae-be9c-ff591afb942a?host=${HOSTNAME}

Let me know your thoughts.

So to clarify, you're wanting borgmatic to support [Borg placeholders](https://borgbackup.readthedocs.io/en/stable/usage/help.html#borg-help-placeholders)? One challenge with that I can think of would be that it could be ambiguous whether you wanted borgmatic or Borg to do the substitution for any given placeholder. Although I guess if they really were identical, it wouldn't matter. It's not quite the same as Borg placeholders, but have you seen borgmatic's [constants](https://torsion.org/borgmatic/docs/how-to/make-per-application-backups/#constant-interpolation) feature? That lets you define your own values like `fqdn` or whatever else. Another alternative would be to use an [environment variable](https://torsion.org/borgmatic/docs/how-to/provide-your-passwords/), either an existing variable or one you set explicitly for this purpose. Example: ```yaml healthchecks: ping_url: https://hc-ping.com/addffa72-da17-40ae-be9c-ff591afb942a?host=${HOSTNAME} ``` Let me know your thoughts.
Author

So to clarify, you're wanting borgmatic to support Borg placeholders? One challenge with that I can think of would be that it could be ambiguous whether you wanted borgmatic or Borg to do the substitution for any given placeholder. Although I guess if they really were identical, it wouldn't matter.

Yes that looks like the best solution for my Problem at the Moment.

It's not quite the same as Borg placeholders, but have you seen borgmatic's constants feature? That lets you define your own values like fqdn or whatever else. Another alternative would be to use an environment variable, either an existing variable or one you set explicitly for this purpose. Example:

healthchecks:
    ping_url: https://hc-ping.com/addffa72-da17-40ae-be9c-ff591afb942a?host=${HOSTNAME}

Let me know your thoughts.

I would like to deploy the same config to a few Servers as a Debian Package, when possible without modifying the config file or the Environment itself.
I also tried the constants feature to read a the Hostname from a File.

constants:
    fqdn: !include /etc/hostname

which is working but contains only the hostname and not the fqdn, which is ok but not the best solution for me.
I hope it is more understandable now

> So to clarify, you're wanting borgmatic to support [Borg placeholders](https://borgbackup.readthedocs.io/en/stable/usage/help.html#borg-help-placeholders)? One challenge with that I can think of would be that it could be ambiguous whether you wanted borgmatic or Borg to do the substitution for any given placeholder. Although I guess if they really were identical, it wouldn't matter. > Yes that looks like the best solution for my Problem at the Moment. > It's not quite the same as Borg placeholders, but have you seen borgmatic's [constants](https://torsion.org/borgmatic/docs/how-to/make-per-application-backups/#constant-interpolation) feature? That lets you define your own values like `fqdn` or whatever else. Another alternative would be to use an [environment variable](https://torsion.org/borgmatic/docs/how-to/provide-your-passwords/), either an existing variable or one you set explicitly for this purpose. Example: > > ```yaml > healthchecks: > ping_url: https://hc-ping.com/addffa72-da17-40ae-be9c-ff591afb942a?host=${HOSTNAME} > ``` > > Let me know your thoughts. I would like to deploy the same config to a few Servers as a Debian Package, when possible without modifying the config file or the Environment itself. I also tried the constants feature to read a the Hostname from a File. ``` constants: fqdn: !include /etc/hostname ``` which is working but contains only the hostname and not the fqdn, which is ok but not the best solution for me. I hope it is more understandable now
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#756
No description provided.