Below is script for sending notification ,when a mount point or filesystem crosses a threshold value.
For solaris
#!/bin/sh
df -h | egrep -v '/system|/platform|/dev|/etc|lib' | awk '{print $6 " " $5}'|cut -d% -f1|while read fs val
do
if [ $val -ge 90 ]
then
echo "The $fs usage high $val% \n \n \n `df -h $fs`" | mailx -s "Filesystem $fs Usage high on Server `hostname`" [email protected]
fi
done
Put in crontab:
00 * * * * /usr/local/scripts/diskalert.sh
For monitoring zpool usage in solaris:
zpool list | awk '{print $5}'| grep -v CAP | cut -d% -f1| while read val
do
if [ $val -ge 80 ]
then
echo "The $fs usage high $val% \n \n \n `df -h $fs`" | mailx -s "Filesystem $fs Usage high on Server `hostname`" [email protected]
fi
done
Put in crontab as below:
00 * * * * /usr/local/scripts/zpoolusage.sh
SHELL SCRIPT