You might check out gtop; I have to admit to being fond of how they
represent processes, and memory utilization -- and the filesystems, while
lacking the others' glitz, does work...

-Ken

On Sat, 21 Apr 2001, James R. Van Zandt wrote:

> 
> I managed (finally!) to restore my system from backups after the
> possible compromise last week. I also repartitioned to make better use
> of a new disk, and now have lots more room.  In the process, I found
> myself wishing for a better way to visualize disk and partition sizes.
> A modest search of the internet did not turn up what I had in mind.  I
> put together a prototype using awk and gnuplot (see below).  I suppose
> perl and tk would be better choices, and I can see several ways to
> extend it.  However, it sure seems like reinventing the wheel.  Can
> anyone point me to an existing tool along these lines?
> 
>           - Jim Van Zandt
> 
> 
> #!/bin/sh
> #
> #     part - display disk partition usage
> #
> #     Jim Van Zandt <[EMAIL PROTECTED]>
> awk  '
> BEGIN {
>     i=1;
>     while (getline<"/proc/partitions" >0){
>       print "# /proc/partitions: ",$0;
>       if ($1 ~ /[0-9]/ && $(NF-1) > 1 && $NF ~ /[0-9]/){ 
>             # "extended" partition shows as 1 block
>           dev="/dev/" $4;
>           device[i]=dev;
>           drive=dev;
>           sub(/[0-9]*$/,"",drive);
>           if (drive != prevdrive){
>               prevdrive=drive;
>               numdrives++;
>           }
>           blocks[dev]=$3;
>           cum=cum+$3;
>           i=i+1;
>       }
>     }
>     while (getline<"/proc/swaps" > 0){
>       if ($1 ~ /^\/dev/){
>           dev=$1;
>           mountpoint[dev]="swap";
>           used[dev]=$4;
>       }
>     }
>     n=i-1;
>     pad=cum/15/(numdrives-1);
>     printf("# numdrives=%d pad=%f\n",numdrives,pad);
>     while ("df" | getline >0){
>       print "# df: ",$0
>       if ($1 ~ /^\/dev\//){
>           dev=$1;
>           kbytes[dev]=$2;
>           used[dev]=$3;
>           mountpoint[dev]=$6;
>       }
>     }
>     print "unset label";
>     print "unset key";
>     print "set border 0";
>     print "set noxtics";
>     print "set noytics";
>     print "set nox2tics";
>     print "set noy2tics";
>     print "set xrange [0:5]";
>     print "set style data lines";
>     xmidlab=1.5; xrightlab=2; xleft=3; xright=4;
>     labelheight=cum/n+2;
>     for (pass=1; pass<=2; pass++){
>       lo=0; ly=0; ry=0;
>       if (pass==2) print "plot \"-\"";
>       for (i=1; i<=n; i++){
>           dev=device[i];
>           ly+=labelheight;
>           if (pass==1){
>               if (dev in mountpoint){
>                   dir=mountpoint[dev];
>               } else {
>                   dir="";
>               }
>               label=sprintf("%-10s %5d   %-10s", 
>                             dev, blocks[dev]/1024, dir);
>               printf("set label \"%s\" at %d,%f right\n", 
>                      label, xrightlab,ly);
>           } else if (pass==2){
>               drive=dev;
>               sub(/[0-9]*$/,"",drive);
>               if (drive != prevdrive){
>                   prevdrive=drive;
>                   lo+=pad;
>               }
>               if (dev in mountpoint){
>                   ry+=labelheight;
>                   dir=mountpoint[dev];
>                   use=used[dev];
>                   kb=kbytes[dev];
>               } else {
>                   dir="";
>                   use=0;
>                   kb=0;
>               }       
>               printf("# %-12s %8d %8d %8d %-10s %s\n",
>                      dev, blocks[dev], kb, use, dir, os[dev]);
>               hi=lo+blocks[dev];
>               printf("%d %d\n%d %d\n%d %d\n%d %d\n%d %d\n\n",
>                      xleft,lo, xleft,hi, xright,hi, xright,lo, xleft,lo);
>               printf("%d %d\n%d %d\n", xleft,(lo+hi)/2, xrightlab,ly);
>               if (dev in mountpoint){
>                   printf("\n\n");
>               } else {
>                   printf("%f %d\n%f %d\n\n", xrightlab,ly, xmidlab, ly);
>               }
>               lo=hi;
>           }
>       }
>     }
>     print "e";
> }' | gnuplot -persist
> 
> 
> 
> **********************************************************
> To unsubscribe from this list, send mail to
> [EMAIL PROTECTED] with the following text in the
> *body* (*not* the subject line) of the letter:
> unsubscribe gnhlug
> **********************************************************
> 
> 


**********************************************************
To unsubscribe from this list, send mail to
[EMAIL PROTECTED] with the following text in the
*body* (*not* the subject line) of the letter:
unsubscribe gnhlug
**********************************************************

Reply via email to