Sponsored Content
Operating Systems HP-UX Need script to monitor "ALL" Disk Spaces Post 302848729 by krishmaths on Friday 30th of August 2013 12:05:11 AM
Old 08-30-2013
Quote:
Originally Posted by mohtashims
It works for most but does not work for some. Please see my output below.

Code:
/opt/app/optier (/dev/vx/dsk/dgd1grn1m1app1/optier) : 4 100 allocation free
/dev/odm (/dev/odm ) : 100 % free
/etc/vx/cbr/bk (/dev/vg00/cbr ) : 95 % free
/home (/dev/vg00/home ) : 19 % free
/opt/app/d1grn1m1/app1/bea (/dev/vx/dsk/dgd1grn1m1bea/bea) : 31 100 allocation free
/opt/app/d1grn1m1/app1 (/dev/vx/dsk/dgd1grn1m1app1/app1) : 12 100 allocation free
/opt/app/ndm (/dev/vx/dsk/dgd1grn1m1app1/ndm) : 11 100 allocation free
/opt (/dev/vg00/opt ) : 22 % free
/tmp (/dev/vg00/tmp ) : 95 % free
/usr/local/EMC (/dev/vg00/emc ) : 97 % free
/usr/local/opt/introscope (/dev/vx/dsk/dgd1grn1m1intro/introscope) : 10 100 allocation free
/usr/localcw/opt/patrol (/dev/vg00/patrol ) : 68 % free
/usr/localcw (/dev/vg00/localcw ) : 77 % free
/usr (/dev/vg00/usr ) : 33 % free
/var/adm/crash (/dev/vg00/crash ) : 99 % free
/var/adm/sw (/dev/vg00/sw ) : 41 % free
/var (/dev/vg00/var ) : 87 % free
/stand (/dev/vg00/stand ) : 54 % free
/ (/dev/vg00/root ) : 69 % free

The BOLD does not show percentages. Can you please explain and help fix?
When I see the difference between the BOLDed output lines and correct output lines, the difference is that the mount point having a space before ")" gives correct output. The space is important for awk command to interpret positional arguments properly. To fix this, let us insert a blank space before ")" so that the BOLDed output lines get fixed. Please use below command.

Code:
df -k | awk -F":" '/^\//{sub(/)/," )");a=a$1" : ";next} /%/ {a=a$1"\n"} END{print a}' | awk '(NF>0){$5=100-$5; $7="free"; $8=""} 1'

 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. Shell Programming and Scripting

How to remove "New line characters" and "spaces" at a time

Dear friends, following is the output of a script from which I want to remove spaces and new-line characters. Example:- Line1 abcdefghijklmnopqrstuvwxyz Line2 mnopqrstuvwxyzabcdefghijkl Line3 opqrstuvwxyzabcdefdefg Here in above example, at every starting line there is a “tab” &... (4 Replies)
Discussion started by: anushree.a
4 Replies

3. Shell Programming and Scripting

script to read a line with spaces bet " " and write to a file

Hi, I need a command in UNIX KSH below is the description... MAPPING DESCRIPTION ="Test Mapping for the calid inputs" ISVALID ="YES" NAME ="m_test_xml" OBJECTVERSION ="1" VERSIONNUMBER ="1" unix ksh command to read the DESCRIPTION and write to a file Test Mapping for the calid inputs... (3 Replies)
Discussion started by: perlamohan
3 Replies

4. Solaris

Help:"Bad checksum in disk label" and "Can't open disk label package"?

Hello, I'm brand new to Sun/Solaris. I have a Sun Blade 150, with SunOS 5.8. I wanted to make a backup to prevent future data loss, so I put the disk in a normal PC with Windows XP to try to make a backup with Norton Ghost, the disk was detected, but not the file volume, so I place the disk... (6 Replies)
Discussion started by: Resadija
6 Replies

5. Shell Programming and Scripting

How to replace "®" "™" "with Spaces in UNIX

do U know how to replace the registered trademark "®" symbol or trade Mark "™" "with Spaces in UNIX (4 Replies)
Discussion started by: MMeari
4 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

8. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
df(1)							      General Commands Manual							     df(1)

Name
       df - display free and used disk space

Syntax
       df [-i] [-l] [-n] [filesystem...] [file...]

Description
       The command displays the amount of disk space available on the specified file system, for example, It also displays the amount of available
       disk space on the file system in which the specified file is contained, for example, If a device is given that has no file systems  mounted
       on  it,	displays  the  information  for  the  root file system.  Without any arguments or options, displays shows all mounted filesystems,
       including those manually mounted without use of the file.  The numbers are reported in kilobytes.

       Unless the -n option is specified, updates the statistics stored in memory for the file system specified, before it  returns  the  informa-
       tion.

Options
       -i   Also report the number of used and free inodes.

       -l   Reports on locally mounted disks only.

       -n   Do	not  update the file system statistics stored in memory.  Instead, return whatever statistics are stored in memory.  This prevents
	    from hanging in the event that a server containing the specified file system is down.

Restrictions
       You cannot use the command to find free space on an unmounted file system using the block or character special device name.   Instead,  use
       the command.

Examples
       % df
       Filesystem     Total    kbytes  kbytes	%
       node	      kbytes   used    free	used	Mounted on
       /dev/ra1a       7429    2085    4602	31%    /tmp
       /dev/ra0e      30519   14817   12651	54%    /usr/spool
       /dev/ra0h     313233  122858  159052	44%    /usr/staff1

       The  total  disk  space is the total space that was created during the making of the file system.  The addition of the used space, the free
       space and a percentage of reserved space is the total space.  The default value for the reserved space is 10%.

Files
       List of mounted file systems

See Also
       getmnt(2), fstab(5), dumpfs(8), icheck(8), mkfs(8), newfs(8), quot(8)

																	     df(1)
All times are GMT -4. The time now is 03:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy