Tuesday 26 July 2016

Describing various protocols NAT DHCP DNS Proxy Server and TCP IP



To Any Queries Send the Mail Click here..
BY


Network troubleshooting and Testing

To Any Queries Send the Mail Click here..
BY


disk space monitoring script


       Most of the environments (small environments) they are not effort to buy a monitoring tools in this case, scripting will come handy to monitor your environment. I hope this disk space monitoring script will help to monitor the disk space.
#!/bin/bash
# AUTHOR: Ravi Kumar (http://www.arkit.co.in/)
# DATE: 19th December 2015
# Shell script to monitor or watch the low-disk space
# It will send an email to $ADMIN, if the (free available) percentage
# of space is >= 90%
#### Script START here ###
## You can change your threshold value whatever you want ##
THRESHOLD=90
PATHS=/
AWK=/bin/awk
DU=`/usr/bin/du -ks`
GREP=/bin/grep
SED=/bin/sed
CAT=/bin/cat
MAILFILE=/tmp/mailviews$$
MAILER=/bin/mail
## Change ADMIN Mail address as per the requirement ##
mailto=aravikumar48@gmail.com
for path in $PATHS
do
## Validate the Percentage of Disk space ##
DISK_AVAIL=`/bin/df -k / | grep -v Filesystem |awk '{print $5}' |sed 's/%//g'`
if [ $DISK_AVAIL -ge $THRESHOLD ]
then
echo "Please clean up your stuff \n\n" > $MAILFILE
$CAT $MAILFILE | $MAILER -s "Clean up stuff" $mailto
fi
done
## END of the Script ##
        Explanation of script: Above script is written using one FOR loop and one IF condition.
/bin/df -k / | grep -v Filesystem |awk ‘{print $5}’ |sed ‘s/%//g’     <<– This line will calculate the disk space in percentage number
if [ $DISK_AVAIL -ge $THRESHOLD ]   <<– This IF condition will validate the space, which is provided by the above command then number greater then or equal to 90 it will trig an alert using mail command to your given ADMIN address.
To Any Queries Send the Mail Click here..
BY