Proxmox ZFS Pool Status Webhook

There’s other ways to implement this, but I already use Proxmox webhooks for warning/error and package-updates notification. I discovered ZFS pool status was not included. Fortunately, ZFS includes ZED for event notification. I found a configuration for Slack webhooks, but it turns out I could use this for HA.

On my Proxmox server, I modified /etc/zfs/zed.d/zed.rc
replace:

ZED_EMAIL_ADDR="root"

with:

#ZED_EMAIL_ADDR="root"

replace:

#ZED_SLACK_WEBHOOK_URL=""

with:

ZED_SLACK_WEBHOOK_URL="http://ha-ip-address:8123/api/webhook/my-webhook-id”

systemctl restart zfs-zed.service

In Home Assistant, I created an automation to create persistent notification:

triggers:
  - trigger: webhook
    allowed_methods:
      - POST
      - PUT
    local_only: true
    webhook_id: my-webhook-id
actions:
  - action: notify.persistent_notification
    data:
      message: >-
        {{ trigger['json']['text'] }}
      title: NAS

As a test, I yanked out a drive from the ZFS pool and received a notification! I’m sure someone could expand on this and make template sensors from the JSON data, but this is good enough for my use case. Hopefully, someone finds this useful.