#!/bin/bash #Roy Cohen :roy@wondercohen.nl #objective :igenerate Gluster output for Nagios checks #First line of code :15/01/2019 #last update :28/01/2019 #version :1.1 #info: #This script needs to be added to cron and run every 3 min #Some general vars STORAGE_IP=$(ip -4 addr show dev storage | grep -oP '(?<=inet\s)\d+(\.\d+){3}') ######START OF SCRIPT####### #check status of the varous volumes /usr/sbin/gluster volume status all > /tmp/brick_status #check peer status /usr/sbin/gluster peer status > /tmp/peer_status # get volume heal status and redirect it to a tmp file for volume in $(/usr/sbin/gluster volume info|grep $STORAGE_IP | cut -d "/" -f3) do echo "volume, $volume" /usr/sbin/gluster v heal $volume info |grep entries|cut -d ":" -f2 done > /tmp/gluster_monitoring_heal