User Tools

Site Tools


progetti:cloud-veneto:operations:zfs_howto

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
progetti:cloud-veneto:operations:zfs_howto [2019/11/05 10:57] cresce@infn.itprogetti:cloud-veneto:operations:zfs_howto [2019/12/20 12:12] (current) cresce@infn.it
Line 1: Line 1:
 +====== ZFS Howto ======
 +
 +===== Replace failed disk =====
 +# Remove the failed disk and insert a new one
 +
 +# Initialize Disk
 +<code bash>
 +/sbin/sgdisk /dev/sdb -g -U R
 +</code>
 +# Copy the partition table from /dev/sda to /dev/sdb
 +<code bash>
 +sgdisk --replicate=/dev/sdb /dev/sda
 +sgdisk --randomize-guids /dev/sdb
 +</code>
 +# Install Grub on the new disk
 +<code bash>
 +grub-install /dev/sdb
 +
 +zpool list
 +zpool status -x
 +</code>
 +# Replace the disk in the rpool pool
 +<code bash>
 +zpool replace rpool /dev/sdb2
 +zpool status -x
 +</code>
 +# Scrub rpool pool
 +<code bash>
 +zpool scrub rpool
 +</code>
 +
 +===== Monitoring ZFS with nagios =====
 +==== Client ====
 +#Install sudo:
 +
 +Debian
 +<code bash>
 +apt-get install sudo 
 +</code>
 +CentOS 6/7
 +<code bash>
 +yum install sudo
 +</code>
 +
 +Create /etc/sudoers.d/zfs file or append if file already exist, the following lines:
 +<code bash>
 +nagios ALL=NOPASSWD: /sbin/zfs
 +nagios ALL=NOPASSWD: /sbin/zpool
 +</code>
 +
 +Create nagios account
 +<code bash>
 +addgroup --gid 50310 nagios
 +adduser --uid 50310 --gid 50310 --home /home/nagios --no-create-home nagios
 +scp -r <template_host>:/home/nagios /home
 +chown -R nagios:nagios /home/nagios
 +</code>
 +Copy ZFS check script on /usr/local/bin/check_zfs.py from cld-nagios
 +<code bash>
 +scp ~/check_zfs.py <hostname>:/usr/local/bin/
 +</code>
 +
 +==== Server ====
 +
 +Edit nagios config file
 +<code bash>
 +define service{
 +       use                             server-ssh-service         ; Name of service template to use
 +       host_name                       <hostname>
 +       service_description             ZFS
 +       check_command                   check_remote_zfs!rpool
 +       }
 +</code>
 +
 +===== Monitoring smart with nagios =====
 +==== Client ====
 +#Install sudo:
 +
 +Debian
 +<code bash>
 +apt-get install sudo 
 +</code>
 +CentOS 6/7
 +<code bash>
 +yum install sudo
 +</code>
 +
 +Copy smart check script into /usr/local/bin/check_smartmon.py from cld-nagios
 +<code bash>
 +scp ~/check_smartmon.py <hostname>:/usr/local/bin/
 +</code>
 +Create /etc/sudoers.d/check-smartmon file or append if file already exist, the following lines:
 +<code bash>
 +nagios ALL=NOPASSWD: /usr/local/bin/check_smartmon.py
 +</code>
 +
 +==== Server ====
 +
 +Edit nagios config file
 +<code bash>
 +define service{
 +        use                             server-ssh-service         ; Name of service template to use
 +        host_name                       <hostname>
 +        service_description             Disk_Smart_sda
 +        check_command                   check_remote_smartmon!/dev/sda
 +        }
 +</code>
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki