Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux:zfs [2024/06/23 21:42] – [ZFS move - recompress] adminlinux:zfs [2025/02/05 12:49] (current) – [ZFS - notification] admin
Line 1: Line 1:
 ====== Linux ZFS ====== ====== Linux ZFS ======
 +https://lepkov.ru/zfs-cheatsheet/ backup https://habr.com/ru/companies/macloud/articles/547056/ \\
 <https://denisbondar.github.io/post/zfs-manual-rus/> - manual <https://xakep.ru/2014/07/08/zfs-at-home/#toc07.> old one\\ <https://denisbondar.github.io/post/zfs-manual-rus/> - manual <https://xakep.ru/2014/07/08/zfs-at-home/#toc07.> old one\\
 <code BASH> <code BASH>
Line 62: Line 63:
 </code> </code>
 ++++ ++++
 +
 +
 +===== ZFS - notification =====
 +++++ telegram notification zfs|
 +<code BASH>
 + # https://github.com/leovp/telegram_notifications
 +nano /etc/zfs/zed.d/zed-telegram.sh
 +
 +#!/bin/bash
 +TELEGRAM_BOT_TOKEN="righttoken" # put your token here
 +TELEGRAM_CHAT_ID="chatid" # your chat_id for sending notification
 +
 +subject="$1"
 +details="$2"
 +
 +MESSAGE="🚨 ZFS Alert on $(hostname) 🚨
 +Event: $subject
 +Details:
 +$details"
 +
 +curl -s -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage" \
 +     -d "chat_id=$TELEGRAM_CHAT_ID" \
 +     -d "text=$MESSAGE"
 +
 +chmod +x /etc/zfs/zed.d/zed-telegram.sh
 +
 +# zed-functions.sh Modified zed_notify function
 +zed_notify()
 +{
 +    zed_notify_email "${subject}" "${pathname}"; rv=$?
 +    [ "${rv}" -eq 0 ] && num_success=$((num_success + 1))
 +    [ "${rv}" -eq 1 ] && num_failure=$((num_failure + 1))
 +
 +    # Execute external Telegram script if it exists
 +    if [ -x "/etc/zfs/zed.d/zed-telegram.sh" ]; then
 +        /etc/zfs/zed.d/zed-telegram.sh "${subject}" "$(cat "${pathname}")"; rv=$?
 +        [ "${rv}" -eq 0 ] && num_success=$((num_success + 1))
 +        [ "${rv}" -eq 1 ] && num_failure=$((num_failure + 1))
 +    fi
 +}
 +</code>
 +++++
 +
 +
  
  
 ===== ZFS backup ===== ===== ZFS backup =====
  
-< code bash>+<code bash>
 # create file  20 gb # create file  20 gb
 dd if=/dev/zero of=/mnt/sdb3/zpool_test bs=1G count=20 dd if=/dev/zero of=/mnt/sdb3/zpool_test bs=1G count=20
Line 85: Line 130:
 zpool remove rpool /mnt/sdb3/zpool_mirror1_1 zpool remove rpool /mnt/sdb3/zpool_mirror1_1
 </code> </code>
 +
 +===== ZFS monitoring =====
 +https://blog.roberthallam.org/2022/09/monitoring-zfs-with-influxdb-grafana-publishing-and-reflection-part-5/ \\
 +https://github.com/richardelling/zpool_influxdb \\
 +
 +
  
  
  • linux/zfs.1719178969.txt.gz
  • Last modified: 2024/06/23 21:42
  • by admin