Last Extend size moniter by remote machine

You mean something like:
Code:
DEFINE VARIABLE iUsed AS DECIMAL FORMAT 'ZZZ,ZZZ,ZZZ,ZZ9' NO-UNDO.
DEFINE VARIABLE iAvail AS DECIMAL FORMAT 'ZZZ,ZZZ,ZZZ,ZZ9' NO-UNDO.
FOR EACH _Area NO-LOCK: 
DISPLAY _Area-name LABEL 'Area Name' WITH 2 COLUMNS. 
FIND _Areastatus WHERE _Areastatus-Areanum = _Area._Area-number NO-LOCK. 
ASSIGN iUsed = (_AreaStatus-Hiwater - _AreaStatus-Freenum)
       iUsed = (iUsed * _Area-blocksize)
       iAvail = (_AreaStatus-Totblocks - 
                 _AreaStatus-Hiwater - 
                 _AreaStatus-Extents +
                 _AreaStatus-Freenum)
       iAvail = iAvail * _Area-blocksize.
DISPLAY _AreaStatus-Totblocks LABEL 'Total Blocks' FORMAT '>,>>>,>>9' 
        _AreaStatus-Extents LABEL 'Extent Blocks' 
        _AreaStatus-Totblocks - _AreaStatus-Hiwater - _AreaStatus-Extents LABEL 'Empty Blocks' 
        _AreaStatus-Freenum LABEL 'Free Blocks' 
        _AreaStatus-Hiwater - _AreaStatus-Freenum LABEL 'Active Blocks' 
        _Area-blocksize LABEL 'Block Size' 
        iUsed LABEL 'Used space' 
        iAvail LABEL 'Avail space' WITH 3 COLUMNS. 
end.

Casper.
 
Thanks for support ,

But i just want to know the last data area extent size but this code tell total Extend size .

i want sepreate extend size of data area,

Waiting for your responce .
 
I'm not going to write the code for you this morning, as I haven't finished my coffee yet and thus it would be of questionable quality, :eek: but you can get what you want by looping through _AreaExtent and using FILE-INFO.
 
Thanks Tom , for reply ,

See what the Exact problem , i just want create a reminder programm in Progress that will send a mail if last Extend Size will more than 1.3 GB ,

I just want the actual Table name and the Field from where i will extract last Extend Size..

Please suggest any solution ..
Waiting for your reply ...
 
There is no exact file and field which tracks the current size of extents.

To obtain the name of the last extent in a particular storage area you use _AreaExtent. A simple
Code:
FOR EACH _AreaExtent NO-LOCK: DISPLAY _AreaExtent. END.
should reveal how that works.

Once you have the name of the last extent then you need to master the use of FILE-INFO to obtain the extents current size. Just lookup FILE-INFO in the documentation, there are several simple examples that are easy to follow.

Handling your alerting process and so forth is up to you.

It's really not too hard. If you actually try to write the code and there is something unclear about the suggested approach I'll be happy to comment.

If you're having trouble writing the code then you might want to consider a commercial alternative such as DBAppraisefor alerting on this and many other important conditions in a Progress database.
 
Hi ,

Thanks Tom for Preety Reply , i can extract size of the file by filelist table but I am confused that how i know tha last data extent , can u please help me .


Thanks in advance.
 
In _area the field _area-extents contains the number of available extents in that area.


so i guess this code will give you the last extent in an area:

Code:
for each _area,
  first _areaextent where _areaextent._area-number = _area._area-number and
                          _areaextent._extent-number = _area._area-extents:
    disp _area._area-name _areaextent._extent-path format 'X(40)'.
end.

Casper.
 
I have a shell script that does virtually the same thing. You can try this too if you're running on a Linux/Unix box.

Code:
#!/bin/bash
wd=$1
logfile=/tmp/extentsize_prod
logfile1=/tmp/extentsize_temp
reportfile=/tmp/extentsize_report
mailfile=/tmp/extentsize_mailfile
touch $reportfile
touch $logfile
listf=`ls -l $wd/mfg_* | grep -ve 32768| cut -f 1 -d . | awk '{print $NF}' | uniq`
for i in $listf
do
   ls -alr $i* |grep -ve 32768| head -1 >> $logfile
done
cat $logfile | sort -n +4 | awk '{ printf ("%5d %s\n", ($5 / 1024 + 0.999), $9) }' > $logfile1
mv -f $logfile1 $logfile
exec < $logfile
while read line
do
   var1=`echo $line | awk '{print $1}'`
   var2=`echo $line | awk '{print $2}'`
   if [ $var1 ] && [ $var2 ]
   then
      var3=`basename $var2`
      var4=`cat $wd/mfg.st | grep $var3 | awk -F"\"" '{print $2}'`
      var5=`cat $wd/mfg.st | grep $var3 | grep " f "`
      if [ $var1 -gt 1048576 ]
      then
         echo Extent $var2 is close to the 2GB limit > $mailfile
         echo ------------------------------------------------------------ >> $mailfile
         if [ -f $logfile ]
         then
            cat $logfile >> $mailfile
         fi
         if [ -f $logfile1 ]
         then
            cat $logfile1 >> $mailfile
         fi
         mail -s "Alert Extent Size nearing capacity" $3 < $mailfile
      fi
      if [ "$var5" ]
      then
         EXTENT=Fixed
      else
         EXTENT=Variable
      fi
      if [ $2 ] && [ $2 == "--report" ]
      then
         echo -e "Table $var4 is $var1 k using a $EXTENT extent $var2 \n" >> $reportfile
      fi
   fi
   if [ -f $logfile ]; then rm -f $logfile; fi
   if [ -f $logfile1 ]; then rm -f $logfile1; fi
done
if [ $2 ] && [ ! $3 ]
then
   echo You must supply an email address
   exit 1
fi
if [ $2 ] && [ $2 == "--report" ]
then
   cat $reportfile | mail -s "Extent Size Report `date "+%D"`" $3
fi
if [ -f $reportfile ]; then rm -f $reportfile; fi


Usage:  <script> <pathtodatabase>
or
Usage: <script> <pathtodatabase> --report <emailaddress>
 
Back
Top