====== ZFS Howto ======
===== Replace failed disk =====
# Remove the failed disk and insert a new one
# Initialize Disk
/sbin/sgdisk /dev/sdb -g -U R
# Copy the partition table from /dev/sda to /dev/sdb
sgdisk --replicate=/dev/sdb /dev/sda
sgdisk --randomize-guids /dev/sdb
# Install Grub on the new disk
grub-install /dev/sdb
zpool list
zpool status -x
# Replace the disk in the rpool pool
zpool replace rpool /dev/sdb2
zpool status -x
# Scrub rpool pool
zpool scrub rpool
===== Monitoring ZFS with nagios =====
==== Client ====
#Install sudo:
Debian
apt-get install sudo
CentOS 6/7
yum install sudo
Create /etc/sudoers.d/zfs file or append if file already exist, the following lines:
nagios ALL=NOPASSWD: /sbin/zfs
nagios ALL=NOPASSWD: /sbin/zpool
Create nagios account
addgroup --gid 50310 nagios
adduser --uid 50310 --gid 50310 --home /home/nagios --no-create-home nagios
scp -r :/home/nagios /home
chown -R nagios:nagios /home/nagios
Copy ZFS check script on /usr/local/bin/check_zfs.py from cld-nagios
scp ~/check_zfs.py :/usr/local/bin/
==== Server ====
Edit nagios config file
define service{
use server-ssh-service ; Name of service template to use
host_name
service_description ZFS
check_command check_remote_zfs!rpool
}
===== Monitoring smart with nagios =====
==== Client ====
#Install sudo:
Debian
apt-get install sudo
CentOS 6/7
yum install sudo
Copy smart check script into /usr/local/bin/check_smartmon.py from cld-nagios
scp ~/check_smartmon.py :/usr/local/bin/
Create /etc/sudoers.d/check-smartmon file or append if file already exist, the following lines:
nagios ALL=NOPASSWD: /usr/local/bin/check_smartmon.py
==== Server ====
Edit nagios config file
define service{
use server-ssh-service ; Name of service template to use
host_name
service_description Disk_Smart_sda
check_command check_remote_smartmon!/dev/sda
}