borgmatic

Zabbix

πŸ”

New in version 1.9.0 Zabbix is an open-source monitoring tool used for tracking and managing the performance and availability of networks, servers, and applications in real-time.

This hook does not do any notifications on its own. Instead, it relies on your Zabbix instance to notify and perform escalations based on the Zabbix configuration. The states defined in the configuration determine which states will trigger the hook. The value defined in the configuration of each state is used to populate the data of the configured Zabbix item. If none are provided, it defaults to a lower-case string of the state.

Here's an example configuration:

zabbix:
    server: http://cloud.zabbix.com/zabbix/api_jsonrpc.php
    
    username: myuser
    password: secret

    host: "borg-server"
    key: borg.status

    fail:
        value: "ERROR"
    states:
        - fail

This hook requires the Zabbix server be running version 7.0.

New in version 1.9.3 Zabbix 7.2+ is supported as well.

Authentication methods

Authentication can be accomplished via api_key or both username and password. If all three are declared, only api_key is used.

Items

borgmatic writes its monitoring updates to a particular Zabbix item, which you'll need to create in advance. In the Zabbix web UI, make a new item with a Type of "Zabbix trapper" and a named Key. The "Type of information" for the item should be "Text", and "History" designates how much data you want to retain.

When configuring borgmatic with this item to be updated, you can either declare the itemid or both host and key. If all three are declared, only itemid is used.

Keep in mind that host refers to the "Host name" on the Zabbix server and not the "Visual name".

Full configuration

zabbix:
    # The ID of the Zabbix item used for collecting data.
    # Unique across the entire Zabbix system.
    itemid: 55105

    # Host name where the item is stored. Required if "itemid"
    # is not set.
    host: borg-server

    # Key of the host where the item is stored. Required if
    # "itemid" is not set.
    key: borg.status

    # The API endpoint URL of your Zabbix instance, usually ending
    # with "/api_jsonrpc.php". Required.
    server: https://zabbix.your-domain.com

    # The username used for authentication. Not needed if using
    # an API key. Supports the "{credential ...}" syntax.
    username: testuser

    # The password used for authentication. Not needed if using
    # an API key. Supports the "{credential ...}" syntax.
    password: fakepassword

    # The API key used for authentication. Not needed if using an
    # username/password. Supports the "{credential ...}" syntax.
    api_key: fakekey

    start:
        # The value to set the item to on start.
        value: STARTED

    finish:
        # The value to set the item to on finish.
        value: FINISH

    fail:
        # The value to set the item to on fail.
        value: ERROR

    # 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!