LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-26-2011, 06:15 PM   #1
deepak_message
Member
 
Registered: Oct 2007
Posts: 175

Rep: Reputation: 17
Script for partition uses more than 50%


Hi,

As a system administartor, I need to make the health report everyday of linux servers.
I am looking script, which can output only the partition used more than 60%.
eg, #df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda1 100G 75G 25G 75% /
/dev/hda2 100G 30G 70G 30% /home

Script should answered --

Use% Mounted on
75% /

Please help me, if any one have good scirpt skill.
Thanks in Advance
 
Old 12-26-2011, 09:13 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by deepak_message View Post
Hi,
As a system administartor, I need to make the health report everyday of linux servers. I am looking script, which can output only the partition used more than 60%. eg, #df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda1 100G 75G 25G 75% /
/dev/hda2 100G 30G 70G 30% /home

Script should answered --
Use% Mounted on
75% /

Please help me, if any one have good scirpt skill.Thanks in Advance
We'll be glad to help you...post what you've written, and where you're stuck. But we're not going to write your scripts for you....have you tried to do this? Looked at any bash scripting tutorials??
http://tldp.org/LDP/abs/html/

And as you said in another of your posts:
Quote:
Originally Posted by deepak_message
you can knock the google for more details.
First hit for "linux disk space monitoring script":
http://www.cyberciti.biz/tips/shell-...isk-space.html

Did you put ANY effort into this, before posting the question?
 
Old 12-26-2011, 09:15 PM   #3
vikki
Member
 
Registered: Jun 2009
Posts: 30

Rep: Reputation: 18
Can you check this.

http://www.cyberciti.biz/tips/shell-...isk-space.html
 
Old 12-28-2011, 06:01 AM   #4
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Thumbs up

Quote:
Originally Posted by deepak_message View Post
Hi,

As a system administartor, I need to make the health report everyday of linux servers.
I am looking script, which can output only the partition used more than 60%.
eg, #df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda1 100G 75G 25G 75% /
/dev/hda2 100G 30G 70G 30% /home

Script should answered --

Use% Mounted on
75% /

Please help me, if any one have good scirpt skill.
Thanks in Advance
Hi Deepak,

You can use below one liner. This will list all partitions which are greater than 40% utilized.

Code:
[root@vikas ~]# df -hTP | awk '{print $6}' | sed '1d' | tr '%' ' ' | awk '$1 > 40'
42 
65 
[root@vikas ~]# df -hTP
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/mapper/vg_ftp-lv_root ext4  9.9G  4.0G  5.5G  42% /
tmpfs        tmpfs    329M     0  329M   0% /dev/shm
/dev/sda1     ext4    485M   29M  432M   7% /boot
/dev/mapper/vg_ftp-lv_home ext4 1008M  614M  344M  65% /home
Hope this helps. Also, always used CODES , when you are pasting outputs of some commands. It makes your post more readable.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
partition type reader script/code robertjinx Programming 12 08-06-2010 08:10 AM
Script for getting alert when the partition is full arooooon Linux - Server 8 01-17-2010 08:58 AM
script to sum all partition size bostonthunder777 Linux - Server 4 12-26-2007 03:26 PM
auto mount partition script SweetLou Linux - General 2 02-19-2007 09:39 PM
Fdisk Auto Partition Script fotoguy Linux - Software 2 07-12-2006 10:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration