#!/bin/bash # # PRO-Admin 2017 # Notyfication to @ # last edit: 2017/04/25 # changelog: # - pierwsza wersja # - dodane adres IP oraz hostname (pełny) do wiadomości # ADMIN="kp@pro-admin.pl,bok@ittmedia.pl" # set alert-level 90 % standard ALERT=90 df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $6 }' | while read output; do usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 ) partition=$(echo $output | awk '{ print $2 }' ) if [ $usep -ge $ALERT ]; then echo "Mało miejsca na partycji: \"$partition ($usep%)\" Serwer (host): $(hostname -f) Serwer (IP): $(ifconfig |grep "inet addr" |awk '{print $2}' |awk '{print $1; exit}' |awk '{print substr($1,6); }' ) Problem wygenerowany: $(date)" | mutt -s "Alert [$(hostname -f)]: Mało miejsca, $usep % na $partition" $ADMIN fi done