locked
Checking for free disk space and getting mail when it falls below a certain limit RRS feed

  • Question

  • Hello

    I have a script which checks the disk space and when it falls a certain size , it mails the dba mail box.

    I would like to know how I can change it , as a percentage calculation.

    For example when the free space is less than 20% of the total space on the drive I should be receiving a mail.

    The script I have is :

    declare @MB_Free int

    create table #FreeSpace(
    Drive char(1),
    MB_Free int)

    insert into #FreeSpace exec xp_fixeddrives
    -- Free Space on F drive Less than Threshold
    if @MB_Free < 4096
    exec master.dbo.xp_sendmail
    @recipients ='
    dvaddi@domain.edu',
    @subject ='SERVER X - Fresh Space Issue on D Drive',
    @message = 'Free space on D Drive
    has dropped below 2 gig'
    drop table #freespace


    Thanks

    Thursday, September 14, 2006 3:19 AM

Answers

  • Hi Vaddi -

    Why not use the Alerts feature in Performance Monitor? The Logical Disk Performance Object has a Counter for % Free Space and you can select which drive letter you'd like to monitor. Once the limit is reached, you can have it email you using a WSH script.

    HTH...

     

    Thursday, September 14, 2006 11:14 AM

All replies

  • Hi Vaddi -

    Why not use the Alerts feature in Performance Monitor? The Logical Disk Performance Object has a Counter for % Free Space and you can select which drive letter you'd like to monitor. Once the limit is reached, you can have it email you using a WSH script.

    HTH...

     

    Thursday, September 14, 2006 11:14 AM
  • Joe,

    Can you provide the WSH script, and how to use it?  Tx.

    Monday, July 11, 2011 1:07 PM