#!/bin/bash k=`df -i | grep fs[3-6]\/vol1 | awk '{if ($3 < 20000) print $5}'`; if [ "$k" != "" ]; then echo "vol $k ALMOST OUT OF INODES" | mail <verizonnumber>@vtext.com; fi;
monitor NFS volumes inode usage
Reply
#!/bin/bash k=`df -i | grep fs[3-6]\/vol1 | awk '{if ($3 < 20000) print $5}'`; if [ "$k" != "" ]; then echo "vol $k ALMOST OUT OF INODES" | mail <verizonnumber>@vtext.com; fi;
#!/bin/bash
# FILE: df_space_check.sh
# AUTHOR: ForDoDone
# DATE: 2013/08/16
# NOTES:
#
j=`df | grep nfs0[3-6]\/vol1 | awk '{if ($3 < 100000000) print $5}'`; if [ "$j" != "" ]; then echo "vol $j ALMOST FULL" | mail <verizonnumber>@vtext.com; fi;
Sometimes, you want to be notified if a host goes up or down. Usually Nagios is perfect for this, but in this case I had an internet circuit, and all I cared about was knowing when the ISP deactivated it. Use ping in a loop, make 1 request every second, if ping doesn’t get a response, then send a text message (Verizon number) and stop the loop.
while true; do ping -nc 1 -W 1 5.6.7.8 | grep -q icmp; if [ "$?" == "1" ]; then echo "circuit is down" | mail <10-digit phone number no spaces>@vtext.com; break; fi; sleep 1s; done;
I also use the converse of this method when I want to know when a new circuit comes up.