Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
df -k | grep ^/| sed 's/\%//g' | awk '{if ($5 > 90) {print $6","$5"%"}}' >> $Temp
# Check whether some filesystems meet the criteria:
fs_count="`cat $Temp | wc -l`"
if [ $fs_count -gt 0 ]
then
echo " " >> $EMail
echo "##-----------------------------------" >> $EMail
echo "## Espacios en filesystems:" >> $EMail
echo "##-----------------------------------" >> $EMail
echo " " >> $EMail
echo "The following filesystems are over 90%:" >> $EMail
cat $Temp | sed -e 's/,/ /' |awk '{print "Filesystem \"" $1 "\" is " $2 }' >> $EMail
cat $EMail | mailx -s "Alertas sobre servidor * $server *" $a
fi
rm $Temp
rm $EMail
#!/usr/bin/ksh
LIST="/arch /redo /backup"
for i in $LIST
do
xx=`df -k $i |nawk '/^\//{print substr($5,1,length($5)-1)}'`
if test $xx -gt 60
then
echo "$i is at $xx - Please investigate" | mailx -r root@newport.com -s "Space alert! - $i on `uname -n` is at $xx %"
fi
done
#!/usr/bin/sh
LIST="/arch /redo /backup"
for i in $LIST
do
xx=`df -k $i |nawk '/^\//{print substr($5,1,length($5)-1)}'`
if test $xx -gt 60
then
echo "$i is at $xx - Please investigate" | mailx -r xxx@yyy.com -s "Space alert! - $i on `uname -n` is at $xx %"
fi
done
#!/usr/bin/sh
LIST="/ /home"
for i in $LIST
do
xx=`df -k $i |awk '/^\//{print substr($5,1,length($5)-1)}'`
if test $xx -gt 90
then
echo "$i is at $xx - Please investigate" | mailx -r xxx@yyy.com -s "Space alert! - $i on `uname -n` is at $xx %"
fi
done
#!/usr/bin/sh
#
#@(#) Check filesystem space -
#@(#) used to automate the monitoring of filesystems to
#@(#) confirm that they do not pass a pre-defined threshold.
#
# This job is set up in cron to run on a regular basis.
# It monitors space in directories, making sure that free space
# does not fall below pre-defined thresholds.
#
export DATE=`date +%m%d`
export TMP="/tmp/.chkfilspc.$DATE"
export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin:
export HOSTNAME=`hostname`
export PROGRAM=$0
export PAGE='/usr/local/bin/sendpage -n'
# If you are using this under AIX 3.2.5, leave DF='df', but on
# an AIX 4 system you will have to change it to DF='df -k'
export DF='df -k'
function CHK_FILE_SPC
{
export FILESYS=$1
if [ "$3" = "%" ]
then
export AMOUNT=`$DF $FILESYS | tail -1 | awk -v PERCENT=$2 '{print $2*PERCENT/100/1024}'`
else
export AMOUNT=$2
fi
integer FREE_SPACE LOW_WATER_MARK
FREE_SPACE=`$DF $FILESYS | tail -1 | awk '{print $3}'`
(( LOW_WATER_MARK = $AMOUNT * 1024 ))
if (( $FREE_SPACE < $LOW_WATER_MARK))
then
(( MB_FREE = $FREE_SPACE / 1024 ))
FILE_NAME="$TMP`echo $FILESYS | sed 's/\//\./g'`"
if [ ! -s $FILE_NAME ]
then
# If the log file doesn't exist, then check the filesystem one more
# time before paging the administrator
RE_CHK_FILE_SPC
else
# If the log file exists, then just log that it was still full at this
# time, but don't do any more (unless /tmp is the file that's full and
# the log could not be created.
date >> $FILE_NAME
fi
fi
}
function RE_CHK_FILE_SPC
{
integer FREE_SPACE LOW_WATER_MARK
FREE_SPACE=`$DF $FILESYS | tail -1 | awk '{print $3}'`
(( LOW_WATER_MARK = $AMOUNT * 1024 ))
if (( $FREE_SPACE < $LOW_WATER_MARK))
then
(( MB_FREE = $FREE_SPACE / 1024 ))
FILE_NAME="$TMP`echo $FILESYS | sed 's/\//\./g'`"
MESSAGE="Only $MB_FREE MB free in filesystem - $FILESYS - on $HOSTNAME"
# Comment out the next line if you do not have any paging software
# installed.
# echo "$MESSAGE" | $PAGE UNIX_CRITICAL
# The following lines open the log file and save the message. This
# file is used to check against each time the script is run. If
# the log file exists then it will not page again, until after the
# date changes
date > $FILE_NAME
echo "$MESSAGE" >> $FILE_NAME
# The following lines will be sent to the mailbox of the root user.
# echo "PROGRAM: \t $PROGRAM\n"
# echo "LOG FILE:\t $HOSTNAME:$FILE_NAME\n"
# echo "MESSAGE: \t $MESSAGE\n"
# echo "PAGED: \t UNIX_CRITICAL"
fi
}
############### MAIN
#
# The format of the following lines - are as follows:
# FUNCTION_NAME filesystem amount_free [%]
#
# Examples:
#
# CHK_FILE_SPC /tmp 10
# - check /tmp for 10 MB of free space
#
CHK_FILE_SPC / 10 %
# - check / to see that there is 40 % of free space