borgmatic

ntfy

πŸ”

New in version 1.6.3 ntfy is a free, simple, service (either cloud-hosted or self-hosted) which offers simple pub/sub push notifications to multiple platforms including web, Android and iOS.

Since push notifications for regular events might soon become quite annoying, this hook only fires on any errors by default in order to instantly alert you to issues. The states list can override this. Each state can have its own custom messages, priorities and tags or, if none are provided, will use the default.

Here's a basic configuration that notifies on failure:

ntfy:
    topic: my-unique-topic
    server: https://ntfy.my-domain.com
    username: myuser
    password: secret

    fail:
        title: A borgmatic backup failed
        message: You should probably fix it
        tags: borgmatic,-1,skull
        priority: max
    states:
        - fail

Prior to version 1.8.0 Put the ntfy: option in the hooks: section of your configuration.

New in version 1.8.9 Instead of username/password, you can specify an ntfy access token:

ntfy:
    topic: my-unique-topic
    server: https://ntfy.my-domain.com
    access_token: tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2

Full configuration

Here's an example configuration with all of the available options for this feature in the most recent version of borgmatic. If you're using an older version, some of these options may not work, and you should instead generate a sample configuration file specific to your borgmatic version.

The options here include priorities and tags.

ntfy:
    # The topic to publish to. See https://ntfy.sh/docs/publish/
    # for details.
    topic: topic

    # The address of your self-hosted ntfy.sh instance.
    server: https://ntfy.your-domain.com

    # The username used for authentication. Supports the
    # "{credential ...}" syntax.
    username: testuser

    # The password used for authentication. Supports the
    # "{credential ...}" syntax.
    password: fakepassword

    # An ntfy access token to authenticate with instead of
    # username/password. Supports the "{credential ...}" syntax.
    access_token: tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2

    start:
        # The title of the message.
        title: Ping!

        # The message body to publish.
        message: Your backups have started.

        # The priority to set.
        priority: min

        # Tags to attach to the message.
        tags: borgmatic

    finish:
        # The title of the message.
        title: Ping!

        # The message body to publish.
        message: Your backups have finished.

        # The priority to set.
        priority: min

        # Tags to attach to the message.
        tags: borgmatic,+1

    fail:
        # The title of the message.
        title: Ping!

        # The message body to publish.
        message: Your backups have failed.

        # The priority to set.
        priority: max

        # Tags to attach to the message.
        tags: borgmatic,-1,skull

    # List of one or more monitoring states to ping for: "start",
    # "finish", and/or "fail". Defaults to pinging for failure
    # only.
    states:
        - start
        - finish

Improve this documentation

Have an idea on how to make this documentation even better? Use our issue tracker to send your feedback!