Time and Space: How to Monitor Drive Space in SQL Server

  • cteDailyGrowth AS (

    --using the row number, join the drive free table to itself, offset by one day. this gets the free

    -- space for each drive on that day and also on the next day.

    SELECT di1.RowNum, di1.EntryDate, di1.DataFree CurrentData, di1.LogFree CurrentLog, di1.BackupFree CurrentBackup,

    di2.DataFree NextData, di2.LogFree NextLog, di2.BackupFree NextBackup

    FROM cteDriveInfo di1

    INNER JOIN cteDriveInfo di2 ON di2.RowNum = di1.RowNum + 1

  • Sam Catchesides wrote:

    I implemented a similar solution at work, logging the disk free space (along with database free space) to a table along with when it was recorded. Simple SSRS report front end to graph out the last 30 days is emailed every morning, and the report allows selection of longer time periods and more specific drives/servers. Works well for us, and we can at a glance see if there is a worrying trend in disk usage occurring, and then we can drill down and see if a specific database is causing it. Has saved our bacon a couple of times.

    I know this is an older post but it's still highly appropriate.  This is a cool idea and I think you should write an article on it, if you haven't already.  If you already have, I'd love to see the link.  If you haven't I'd love to goad you into doing so.  It would help a lot of folks out.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden wrote:

    Sam Catchesides wrote:

    I implemented a similar solution at work, logging the disk free space (along with database free space) to a table along with when it was recorded. Simple SSRS report front end to graph out the last 30 days is emailed every morning, and the report allows selection of longer time periods and more specific drives/servers. Works well for us, and we can at a glance see if there is a worrying trend in disk usage occurring, and then we can drill down and see if a specific database is causing it. Has saved our bacon a couple of times.

    I know this is an older post but it's still highly appropriate.  This is a cool idea and I think you should write an article on it, if you haven't already.  If you already have, I'd love to see the link.  If you haven't I'd love to goad you into doing so.  It would help a lot of folks out.

    SQL agent job running posh cmd is best way these days, to get any OS related info including drive space.

    ive started building a warehouse that uses CMS and each remote instance has a linked server and agent jobs which fire into tables on a db on the CMS instance

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Perry Whittle wrote:

    CMS

    I'm unfamiliar with this acronym.

    412-977-3526 call/text

  • Central Management Server

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Thanks.

    Is there a standard schema for the tables?

    412-977-3526 call/text

  • Whatever schema you want them to be

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Perry Whittle wrote:

    Jeff Moden wrote:

    Sam Catchesides wrote:

    I implemented a similar solution at work, logging the disk free space (along with database free space) to a table along with when it was recorded. Simple SSRS report front end to graph out the last 30 days is emailed every morning, and the report allows selection of longer time periods and more specific drives/servers. Works well for us, and we can at a glance see if there is a worrying trend in disk usage occurring, and then we can drill down and see if a specific database is causing it. Has saved our bacon a couple of times.

    I know this is an older post but it's still highly appropriate.  This is a cool idea and I think you should write an article on it, if you haven't already.  If you already have, I'd love to see the link.  If you haven't I'd love to goad you into doing so.  It would help a lot of folks out.

    SQL agent job running posh cmd is best way these days, to get any OS related info including drive space.

    ive started building a warehouse that uses CMS and each remote instance has a linked server and agent jobs which fire into tables on a db on the CMS instance

    Is that Posh command a call to WMIC VOLUME?  If so, can you demonstrate how you're parsing the data to get it to a table?

     

    • This reply was modified 7 months ago by  Jeff Moden.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • many different ways of doing it using various cmdlets, had been trying get-volume and get-wmiobject, get-ciminstance seems to be preferred though, looking to make use of the sql table target cmdlets to get the data into a database

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • what would have been a better way to ask this question?

    Is there a standard schema for the tables?

     

    412-977-3526 call/text

  • it all depends on what data you wish to harvest and build the schema to match, there's no offering out of the box that i've seen

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

Viewing 11 posts - 46 through 55 (of 55 total)

You must be logged in to reply to this topic. Login to reply