[Solved] Filesystem getting full. Need a monitoring script


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers [Solved] Filesystem getting full. Need a monitoring script
# 1  
Old 09-12-2012
[Solved] Filesystem getting full. Need a monitoring script

Hi,

I am new to shell scripting in unix HP-UX.

I need to determine how much a perticular file system is full and if it goes over 80% it should notify through mail about which are the files which are greater than 1 GB size.

I used df -k command it is showing the alloocated KB and the %used in that FS. But how to get it through script and find the files > 1 GB.

Can anybody advise?
# 2  
Old 09-12-2012
check_disk from Nagios will do the job:

Code:
bash-3.00# ./check_disk -w 80 -c 90 -m -p /
DISK OK - free space: / 7523 MB (37% inode=90%);| /=12381MB;20026;20016;0;20106

This User Gave Thanks to beta17 For This Post:
# 3  
Old 09-12-2012
A good start is looking and the options offered by find command...
another hint:
Code:
ran:/ $ df -k /opt/patrol
/opt/patrol            (/dev/vg00/lvol12      ) :   303614 total allocated Kb
                                                     55351 free allocated Kb
                                                    248263 used allocated Kb
                                                        81 % allocation used
ran:/ $ bdf /opt/patrol
Filesystem          kbytes    used   avail %used Mounted on
/dev/vg00/lvol12    307200  248263   55351   82% /opt/patrol

This User Gave Thanks to vbe For This Post:
# 4  
Old 09-12-2012
Thanks for the advises.
I have done this. to find out larger files in the directory.
Code:
find /prod/logs -type f -exec du -k {} \; | sort -rn | head -10

can you tell me how can i modify my search and fetch only the files which are over 1GB?

Moderator's Comments:
Mod Comment Please view this code tag video for how to use code tags when posting code and data.

Last edited by vbe; 09-12-2012 at 09:07 AM..
# 5  
Old 09-12-2012
Read about -size in your find man page.

Regards,
Alister
# 6  
Old 09-12-2012
I have read the man page of find command. My intention is to get the files over 100MB from a directory, so i used this code


Code:
$ find /prod/logs -type f -size +100M -exec du -k {} \; | sort -rn | head

find: Error in processing the argument 100M

I am getting the error "find: Error in processing the argument 100M"

But when i am using this
Code:
find /prod/logs -type f -size +100 -exec du -k {} \; | sort -rn | head

i am getting the outputs.

Can anybody advise how to use -size option ?
# 7  
Old 09-13-2012
But what does the man page say about the -size option ( in what? usually blocks or...)

This is the option I use on a AIX for greater than 1GB: -size +2000000...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Script for Monitoring Root Filesystem

I am on SCO UNIX, I need to write a script to monitor root file system. For some reason it's not working for me. #!/bin/sh df -B / | awk '{ print $5 " " $1 }' | while read output; do echo $output if ; then echo "Running out of space \ HOSTNAME" # mail -s "Alert: Almost out of... (8 Replies)
Discussion started by: samnyc
8 Replies

2. Solaris

Filesystem Full

In our shop we have to run a batch cycle. Every so often while we are running batch we get a filesystem full situation that causes batch to stop or slow down. Anyway, the practiced procedure is to look for large files and zip them. This takes a lot of time. We are in a sun solaris environment. What... (1 Reply)
Discussion started by: Harleyrci
1 Replies

3. Shell Programming and Scripting

[Solved] File System Monitoring Script

Hello Scripts Guru I had created a shell script to monitor the threshold of the file system, but some where it is not giving the correct output. Request to all to hel me out I am getting the following output /dev/vg00/lvol3 mounted on 1865224 10% / is 2097152% /dev/vg00/lvol1 mounted on... (2 Replies)
Discussion started by: indrajit_renu
2 Replies

4. Shell Programming and Scripting

Monitoring Script - filesystem

Hi all, I got an error when running this script (from BigAdmin community) the error is test: argument expected my server version is SunOS XXX 5.8 Generic_117350-46 sun4u sparc SUNW,Sun-Fire-V890 any idea on it? #! /usr/bin/ksh ### ### This script can be run from cron to... (9 Replies)
Discussion started by: SmartAntz
9 Replies

5. AIX

Help with a filesystem monitoring script.

I'd like to create a cron script that checks filesystems. For example if it reaches 95% USED, I'd like it to send me an email. Can this be possible for up to say 4 filesystems using the df -k command? Any samples to get me started would be much appreciated. (7 Replies)
Discussion started by: NycUnxer
7 Replies

6. UNIX for Dummies Questions & Answers

filesystem is full

Hello everybody, a very basic question. Inspite of me deleting huge files in a filesystem(AIX 5.3) in oracle folder, the filesystem when i check using df -k still shows 100% full. Does that mean there is a process still pointing to the files which i deleted. how do i work around this. Thanks!... (3 Replies)
Discussion started by: karthikosu
3 Replies

7. UNIX for Dummies Questions & Answers

filesystem full

my root filesystem is eventually full "/dev/rdsk/c1d0s0" as a result i cannot boot to the operating system, i booted into the fail safe mode to check the space using df -h command i discover that it is eventually full. Also to my amazement i found that i cannot see the filesystem which mounted on... (1 Reply)
Discussion started by: seyiisq
1 Replies

8. Shell Programming and Scripting

Filesystem Monitoring script problems

Hi there all, #!/usr/bin/ksh Set -x MIN_MB_FREE="100MB" # Min. MB of Free FS Space MAX_PERCENT="85%" # Max. FS percentage value FSTRIGGER="1000MB" # Trigger to switch from % Used to MB Free WORKFILE="/tmp/df.work" # Holds filesystem data >$WORKFILE #... (0 Replies)
Discussion started by: draco
0 Replies

9. UNIX for Dummies Questions & Answers

Filesystem Full

I noticed that whenever something is printed from my workstation, the available disk space in the /dev/dsk/c0t0d0s0 decreases considerably. Hence, after using my workstation for sometime, I encounter an error message: "Filesystem Full" that prevents me from printing any further. Is there a way to... (16 Replies)
Discussion started by: ilak1008
16 Replies

10. UNIX for Dummies Questions & Answers

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! (1 Reply)
Discussion started by: jzjy0r
1 Replies
Login or Register to Ask a Question