4) # "VERIFY DISKS SPACE AND MEMORY (SO)"
echo ${ECHO} " -- DISK SPACE --"
echo ${ECHO} ">----------------------------------------------------------------------------------------------------"
if [ `uname` = "SunOS" ]
then
WARNING=80
CRITICAL=90
### df -P -h | grep -v '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 " " $6 }'
df -h | grep -v '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 " " $6 }' | while read OUTPUT
do
USEP=$(echo ${OUTPUT} | awk '{ print $1 }' | cut -d'%' -f1 )
PARTITION=$(echo ${OUTPUT} | awk '{ print $3 " ] <=> "}')
if [[ "${USEP}" -ge ${CRITICAL} ]]
then
echo ${ECHO} "${RED} Disk Space Critical: \"[ ${PARTITION} [ ${USEP}% ]\" ${BLACK}"
elif [[ "${USEP}" -ge ${WARNING} ]]
then
echo ${ECHO} "${YEL} Disk Space Warning: \"[ ${PARTITION} [ ${USEP}% ]\" ${BLACK}"
else
echo ${ECHO} "${GREEN} Disk Space OK: \"[ ${PARTITION} [ ${USEP}% ]\" ${BLACK}"
fi
done
echo ${ECHO} ">----------------------------------------------------------------------------------------------------"
echo ${ECHO} " -- MEMORY --"
echo ${ECHO} ">----------------------------------------------------------------------------------------------------"
/usr/sbin/prtconf | egrep "Memory size:"
elif [ `uname` = "AIX" ]
then
WARNING=80
CRITICAL=90
### df -P -h | grep -v '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 " " $6 }'
df -h | grep -v '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 " " $6 }' | while read OUTPUT
do
USEP=$(echo ${OUTPUT} | awk '{ print $1 }' | cut -d'%' -f1 )
PARTITION=$(echo ${OUTPUT} | awk '{ print $3 " ] <=> "}')
if [[ "${USEP}" -ge ${CRITICAL} ]]
then
echo ${ECHO} "${RED} Disk Space Critical: \"[ ${PARTITION} [ ${USEP}% ]\" ${BLACK}"
elif [[ "${USEP}" -ge ${WARNING} ]]
then
echo ${ECHO} "${YEL} Disk Space Warning: \"[ ${PARTITION} [ ${USEP}% ]\" ${BLACK}"
else
echo ${ECHO} "${GREEN} Disk Space OK: \"[ ${PARTITION} [ ${USEP}% ]\" ${BLACK}"
fi
done
echo ${ECHO} ">----------------------------------------------------------------------------------------------------"
echo ${ECHO} " -- MEMORY --"
echo ${ECHO} ">----------------------------------------------------------------------------------------------------"
free
elif [ `uname` = "Linux" ]
then
hash pydf &> /dev/null
if [ $? -eq 1 ]
then
WARNING=80
CRITICAL=90
### df -P -h | grep -v '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 " " $6 }'
df -h | grep -v '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 " " $6 }' | while read OUTPUT
do
USEP=$(echo ${OUTPUT} | awk '{ print $1 }' | cut -d'%' -f1 )
PARTITION=$(echo ${OUTPUT} | awk '{ print $3 " ] <=> "}')
if [[ "${USEP}" -ge ${CRITICAL} ]]
then
echo ${ECHO} "${RED} Disk Space Critical: \"[ ${PARTITION} [ ${USEP}% ]\" ${BLACK}"
elif [[ "${USEP}" -ge ${WARNING} ]]
then
echo ${ECHO} "${YEL} Disk Space Warning: \"[ ${PARTITION} [ ${USEP}% ]\" ${BLACK}"
else
echo ${ECHO} "${GREEN} Disk Space OK: \"[ ${PARTITION} [ ${USEP}% ]\" ${BLACK}"
fi
done
else
pydf=`which pydf`
fi
if [ -f $pydf ]
then
$pydf
else
WARNING=80
CRITICAL=90
### df -P -h | grep -v '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 " " $6 }'
df -h | grep -v '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 " " $6 }' | while read OUTPUT
do
USEP=$(echo ${OUTPUT} | awk '{ print $1 }' | cut -d'%' -f1 )
PARTITION=$(echo ${OUTPUT} | awk '{ print $3 " ] <=> "}')
if [[ "${USEP}" -ge ${CRITICAL} ]]
then
echo ${ECHO} "${RED} Disk Space Critical: \"[ ${PARTITION} [ ${USEP}% ]\" ${BLACK}"
elif [[ "${USEP}" -ge ${WARNING} ]]
then
echo ${ECHO} "${YEL} Disk Space Warning: \"[ ${PARTITION} [ ${USEP}% ]\" ${BLACK}"
else
echo ${ECHO} "${GREEN} Disk Space OK: \"[ ${PARTITION} [ ${USEP}% ]\" ${BLACK}"
fi
done
fi
echo ${ECHO} ">----------------------------------------------------------------------------------------------------"
echo ${ECHO} " -- MEMORY --"
echo ${ECHO} ">----------------------------------------------------------------------------------------------------"
free -m
echo ${ECHO} ">----------------------------------------------------------------------------------------------------"
free -g
else
No comments:
Post a Comment