Space storage shell script issue!

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Space storage shell script issue!
# 8  
Old 08-23-2011
data_capacity=`tail -1 df.k | cut -d" " -f4 | sed 's/%//'`
[ $data_capacity -ge 30 ] && mailx  -s "Filesystem /oradata is  ${data_capacity}%filled" $DBALIST

# 9  
Old 08-24-2011
Space storage shell script issue!

Thanks to all for your valuable time!

I have now the output as expected!

Please let me know if there is a shell script which checks all the mounts in the Oracle Db Tier that alerts once the space usage crosses over 75%

Thanks for your time once again!


---------- Post updated 08-24-11 at 04:38 AM ---------- Previous update was 08-23-11 at 11:55 AM ----------

Continuing from - Disk Monitoring shell script giving incorrect information thread..

Using the code below:

$ df -h | grep % | sed 's,%,,g' | awk ' { if ($5>=30) {print $0} } ' > disk_chk_out
$ mailx -s "Disk Check > 30%" < disk_chk_out

Still getting the output which should not be receiving from e-mail alert as the criteria is below 30%:
/dev/sda1              99M   21M   74M  22 /boot

tmpfs                 9.8G   28M  9.8G   1 /dev/shm

E-mail alert output as below:
Filesystem            Size  Used Avail Use Mounted on
/dev/sda3              20G   13G  6.2G  68 /
/dev/sda1              99M   21M   74M  22 /boot
                      400G  272G  129G  68 /oradata
                      1.2T  526G  691G  44 /orabkup
                      2.3T  1.6T  728G  69 /software
                      2.3T  1.6T  728G  69 /backup
                      2.3T  1.6T  728G  69 /patches
                      450G  170G  281G  38 /xyz_oradata
                      150G   67G   84G  45 /orabin
                      225G  106G  120G  48 /oradata_TEST
tmpfs                 9.8G   28M  9.8G   1 /dev/shm
                       40G   20G   21G  48 /abc_orabin

Now what's wrong here



Last edited by Franklin52; 08-24-2011 at 05:52 AM.. Reason: Please use code tags for code and data samples, thank you
# 10  
Old 08-24-2011
Use below awk:
awk 'NF==5&&$4>30||NF==6&&$5>30'

If it does not help. Post df -h output here.
# 11  
Old 08-24-2011
Space storage shell script issue!

Hi Panyam,

Thanks but that didn't help either

df -h output:
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3              20G   13G  6.2G  68% /
/dev/sda1              99M   21M   74M  22% /boot
                      400G  272G  129G  68% /oradata
                      1.1T  526G  578G  48% /orabkup
                      2.3T  1.6T  728G  69% /software
                      2.3T  1.6T  728G  69% /backup
                      2.3T  1.6T  728G  69% /patches
                      450G  170G  281G  38% /xyz_oradata
                       20G   96K   20G   1% /scripttest
                      150G   67G   84G  45% /orabin
                       10G  5.5M   10G   1% /ebs/eptp51
                      225G  106G  120G  48% /oradata_xxx
tmpfs                 9.8G   28M  9.8G   1% /dev/shm
                       40G   20G   21G  48% /orabin
                       40G  1.4G   39G   4% /oradata2



Moderator's Comments:
Mod Comment Use code tags.

Last edited by zaxxon; 08-24-2011 at 07:23 AM.. Reason: code tags
# 12  
Old 08-24-2011
Try out the below one, and let us know, is the one you need as a email ?

df -h | awk '/%/ {a=substr($(NF-1),1,length($(NF-1))-1); if(a>30){print $0}}'

# 13  
Old 08-24-2011
@ a1_win:
Since you ignore PMs and moderator notes I want to make you think about, that if you continue to ignore to use code tags, you collect infraction points which will result in a permanent ban after collecting an amount of them. So maybe consider reading your PMs and use code tags.
See (B) in this link if you do not understand how to use them:
The UNIX and Linux Forums - Forum Rules
# 14  
Old 08-24-2011
Space storage shell script issue!


Still I am getting the below output in e-mail alert which is below 30% criteria:

40G  1.4G   39G   4% /oradata2

I used the code tag as above but didn't help.

df -h | awk '/%/ {a=substr($(NF-1),1,length($(NF-1))-1); if(a>30){print $0}}'


---------- Post updated at 06:39 AM ---------- Previous update was at 06:35 AM ----------

Sure Zaxxon, will start using the code tags by typing as Code Tag which I juts did in the last post

Thanks for the information

Last edited by a1_win; 08-24-2011 at 07:46 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Red Hat

Total storage space and Serial number

Hi, Could you please tell me the commands to find Total storage space and Serial number of Linux server. OS -- Red Hat Enterprise Linux Server release 6.6 (Santiago) This is 2 node cluster. Regards, Maddy (1 Reply)
Discussion started by: Maddy123
1 Replies

2. Shell Programming and Scripting

Print 1 to 10 with space in shell script

Hi, I want to print 1 to 10 or upto any number sequentially with space in a single line. Like, 1 2 3 4 5 6 7 ...... In shell script only.. Can anyone plz help me. Thanks: (14 Replies)
Discussion started by: arup1980
14 Replies

3. Shell Programming and Scripting

Shell Script to Abort if file name has space.

Hi, In my shell script I use the following code to copy files from one directory to other. for file in `ls`; do #----------------- Copy Files From INDIR to OUTDIR -------------# echoen "Copying File ${INDIR}/$file to ${OUTDIR}/${file}" cp ${INDIR}/$file ... (4 Replies)
Discussion started by: pinnacle
4 Replies

4. Shell Programming and Scripting

Help with Disk Space script in bash shell

Hi Guys, I'm a newb at shell scripting and successfully attempted a small disk space script (victory!!) but i'm wondering whether it actually takes into consideration KB,MB,GB. Please take a look at the script and advise. ##script to check if file sys has reached threshold. ... (3 Replies)
Discussion started by: Irishboy24
3 Replies

5. Solaris

Storage issue on T5220

We have one box T5220 which was assigned 2x100G Luns but i have a strange problem if i use powermt display it only shows me one card but cfgadm, fcinfo commands shows 2 dual port cards as up. What could be the reason for it. I already did a re-configure reboot but that didn't help. Can anyone help... (1 Reply)
Discussion started by: fugitive
1 Replies

6. Shell Programming and Scripting

Passing Parameter containing space in between to Shell Script

Hi, I have one shell script which use two parameter however one of its parameter have space in between. eg. 20110114 b c d here b c d is one parameter I used 'b c d' but its not giving correct result. Also i tried b\c\d but this one also didnt work. Any help would be... (5 Replies)
Discussion started by: diehard
5 Replies

7. Shell Programming and Scripting

Shell script partitions space monitor

Hello friends, I'm newbie in shell scripting... Until now i have this script: #!/bin/sh emailok = emailissue = limit="50" df -h | grep -vE '^Filesystem' | awk '{print $1 " " $4 " " $5}'|while read val do partition=$(echo $val | awk '{print... (9 Replies)
Discussion started by: john_doe
9 Replies

8. AIX

how do I increase the storage space I am new to AIX

Host Name - xxxxxxx IP Address - xxxxxxxxx Alert Msg - The percentage of available storage space (DMXMemory) is low (49.54374442289481 percent). Time received - 14:23 Time Logged - 14:55 Suggested Group - MR-UNIX (5 Replies)
Discussion started by: Nyiko
5 Replies
Login or Register to Ask a Question