![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| vxfs filesystem full! | hungevntelecom | HP-UX | 1 | 09-30-2007 12:52 PM |
| filesystem is full | karthikosu | UNIX for Dummies Questions & Answers | 2 | 03-13-2007 03:21 PM |
| Filesystem full - what to look for | RTM | SUN Solaris | 0 | 03-09-2006 07:10 AM |
| /tmp filesystem full | szodiac | UNIX for Dummies Questions & Answers | 11 | 07-18-2005 07:38 AM |
| Filesystem Full | ilak1008 | UNIX for Dummies Questions & Answers | 16 | 07-18-2005 03:35 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
need a unix script to let me know by email or pager when the filesystem is 80% full.
Does anyone have a script to check disk space usage.
My backup directory keeps filling up with archivelog files and I need a script to let me know by email or pager when the filesystem is 80% full. Thank you! |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
If yo don't want to use percentage because you have large
filesystems. Correct and modify the following pseudo_coded_ksh: #!/bin/ksh #begin_of_MP_use.sh fecha=`date +"%Y%m%d"` LOG2=/tmp/"$fecha".txt tty 1>/dev/null 2>&1 cod_ret=$? if [ $cod_ret -eq 1 ] then VERBOSE="No" fi if [ "$VERBOSE" = "Yes" ] then set -x TTY=`tty` else TTY=/dev/null fi dia=`date +"%Y%m%d"` HOME=/usr/local/scripts/ LOG=$HOME/logs/"$dia"/"$fecha"_chequeo_MP.txt if [ ! -d $HOME/logs/"$dia" ] then mkdir $HOME/logs/"$dia" cod_ret=$? if [ $cod_ret -ne 0 ] then LOG=$LOG2 echo "$fecha ERROR $cod_ret when creating $HOME/logs/$dia directory" |tee -a $LOG 1>>$TTY 2>&1 else chmod 0750 $HOME/logs/"$dia" cod_ret=$? if [ $cod_ret -ne 0 ] then echo "$fecha ERROR $cod_ret when doing chmod 0750 $HOME/logs/$dia" |tee -a $LOG 1>>$TTY 2>&1 fi fi fi function gen_std_DF { case $1 in AIX) df -kMv /temp |awk '{print $1,$2,$5,$8}' |grep -v "Filesystem" > /tmp/my_df.txt ;; SunOS) df -F uMP -o i |awk '/\// {print $3 }' > /tmp/df_i.txt df -l -F uMP -k |awk '/\//{print $1, $6, $4}' | paste - /tmp/df_i.txt > /tmp/my_df.txt ;; Linux) df -x iso9660 -x vfat -x proc -x devpts -i |awk '/\// {print $2}' > /tmp/df_i.txt df -x iso9660 -x vfat -x proc -x devpts -k |awk '/\//{print $1,$6,$4}' |paste - /tmp/df_i.txt > /tmp/my_df.txt ;; HP-UX) bdf -il |awk '/\//{print $1, $9, $4, $6}' > /tmp/my_df.txt ;; } function notify_this { case "$1" in major) /usr/lpp/OV/OpC/opcmsg severity=$1 app=$2 obj=$3 msg_grp=$4 \ msg_text="$5";; # opcmsg: HP Vantage Point Operations API # PATH for AIX # use the API for Tivoli or whatever # replace with your emergency notification method warning) uuencode /tmp/my_df.txt my_df.txt | mail -s "$5" <your_mail_account@your_domain> ;; esac } # body of script HOST=<hostname> OS=`uname` gen_std_DF "$OS" cat /usr/local/scripts/varios/reportes/uso_MP/umbrales_"$servidor".txt |while read raw_dev SpaUmbMaj SpaUmbWar MP InoUmbMaj InoUmbWar do Free_Inodes=`cat /tmp/my_df.txt |grep -w $raw_dev |awk '{print $4'}` if [ $Free_Inodes -ge $InoUmbWar ] then if [ $Free_Inodes -ge $InoUmbMaj ] then notify_this major df df OS "Free Inodes: $Free_Inodes $MP " else notify_this warning df df OS "Free Inodes: $Free_Inodes $MP " fi fi FREE_SPACE=`cat /usr/local/scripts/varios/reportes/uso_MP/my_df.txt |grep -w $raw_dev |awk '{print $3}'|tail -1` if [ $FREE_SPACE -lt $SpaUmbWar ] then if [ $FREE_SPACE -le $SpaUmbMaj ] then notify_this major df df OS "MR: Filesystem $MP $FREE_SPACE Kb libres" else notify_this warning df df OS "MR: Filesystem $MP $FREE_SPACE Kb libres" fi fi done exit 0 #end_of_MP_use.sh # Example of umbrella_file for AIX # Logical_Volume space_alarm_umb space_warning_umb Mount_point i-node_alarm_umb i-node_warning_umb /dev/hd4 100000 200000 / 250 2500 /dev/hd2 1000 10000 /usr 2500 10000 /dev/hd9var 1200000 1500000 /var 3000 15000 /dev/hd3 5000 20000 /tmp 500 5000 /dev/hd1 5000 20000 /home 800 3600 /dev/mwa_raw_dev 5000 30000 /var/opt/perf 100 1000 /dev/ov_raw_dev 5000 30000 /var/lpp/OV 100 1000 /dev/recman_raw_dev 20000 50000 /rman 50 1000 /dev/oracle_raw_dev 20000 40000 /usr/lpp/oracle8i 100 1000 /dev/archiving_raw_dev 50000 100000 /usr/lpp/oracle8i/admin/<instance_name>/arch 90 9000 /dev/oraclebin_raw_dev 400000 200000 /usr/lpp/oracle8i/product/8.1.6 100 2000 /dev/backuprman_raw_dev 2000000 5000000 /home/backup 1000 10000 # end_of Example of umbrella_file for AIX For the others OS Replace the Logical Volume with partition_name, meta_device_name. Examples: HP-UX /dev/vg15/al_abd_p Linux Redhat: /dev/sda1, /dev/md3 SunOs: /dev/dsk/c0t0d0s6 Good Luck. Hugo. |
|||
| Google The UNIX and Linux Forums |