﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by Roshan  Joseph  / Automate drive space monitoring for all production servers / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 19 Jun 2013 04:54:23 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Automate drive space monitoring for all production servers</title><link>http://www.sqlservercentral.com/Forums/Topic725595-1557-1.aspx</link><description>Good post , however,it is triggering mails for only one linked server in server list table. I would require disk   space availability on all servers in server list table. Did any one simulate of execute the code ??? Apreciate your help.</description><pubDate>Wed, 04 Apr 2012 14:33:39 GMT</pubDate><dc:creator>sri490</dc:creator></item><item><title>RE: Automate drive space monitoring for all production servers</title><link>http://www.sqlservercentral.com/Forums/Topic725595-1557-1.aspx</link><description>I'm looking for a script to monitor non fixed drives like mount points. Any idea?Thanks! Aldo</description><pubDate>Tue, 29 Nov 2011 01:38:24 GMT</pubDate><dc:creator>aldo.bittel</dc:creator></item><item><title>RE: Automate drive space monitoring for all production servers</title><link>http://www.sqlservercentral.com/Forums/Topic725595-1557-1.aspx</link><description>If I still had the code available, I would share...We had a dilapidated 200 box that would not delete the old backup files on an external drive... Needless to say it would fill up and we would puke on a regular basis if someone did not manually traverse Win Explorer and delete the old backups.After learning about the xp_FixedDrives procedure (here, by the way), I created a sproc ( triggered by an agent job firing hourly) that would check our drive and if we got below a comfortable free space level, it would automatically email the network administrator.After we had some baseline data we were able to track our average usage on an hourly and daily basis. As more and better data came in, the procedure was altered so that if it was predicted to drop below the comfort zone before the next working shift, it would let the admin know before the end of the working day. This saved many early morning messages telling us that the backup dropped us below our established comfort zoneAnother element that this brought to the table was the ability to track the variations in daily usage. We are primarily a web design and host company, so peoples working schedules can be seen minutely when looking at the various file sizes... No surprises then when a blizzard closes 95% of businesses that the logs increased in size</description><pubDate>Tue, 19 Apr 2011 10:03:25 GMT</pubDate><dc:creator>Mad Myche</dc:creator></item><item><title>RE: Automate drive space monitoring for all production servers</title><link>http://www.sqlservercentral.com/Forums/Topic725595-1557-1.aspx</link><description>[quote][b]joeroshan (6/13/2009)[/b][hr],,the table. It gives me control over which all servers to check among my long list of linked servers. [/quote]Not sure how efficient &amp; advisable it is to link many servers.Being conservative, I run a small sp as part of each nightly backup/maint plan on each SQL server I administer. It writes the free space into a small cummulative table in the Master db, which I can then retrieve with an external application every morning.Table:CREATE TABLE [dbo].[tblStatsDisk](	[ID] [int] IDENTITY(1,1) NOT NULL,	[DiskTimeStamp] [datetime] NULL,	[Drive] [char](1) NULL,	[FreeDisk] [bigint] NULLMaint Plan SP:USE MASTER-- Description: Poll free disk space on each drive immediately after the backup-- =============================================ALTER PROCEDURE [dbo].[GetDiskFree] AS/* TEST HARNESSexec [dbo].[GetDiskFree]select * from dbo.tblStatsDisk*/BEGINSET NOCOUNT ON;INSERT into dbo.tblStatsDisk (drive, FreeDisk)EXEC master.dbo.xp_fixeddrives-- this command creates the rows (one for each drive) with NULL date, srv... fields-- the columns must allow NULL especially disktimestamp UPDATE master.dbo.tblStatsDisk		SET DiskTimeStamp = (GETDATE())			where disktimestamp is nullEND----How you collect and centralise this later is another story ... but you start small with a modular approach then build an application that combines this with some DB size stats collected from the backup DMV routines.HTH</description><pubDate>Mon, 15 Jun 2009 22:52:02 GMT</pubDate><dc:creator>Ol'SureHand</dc:creator></item><item><title>RE: Automate drive space monitoring for all production servers</title><link>http://www.sqlservercentral.com/Forums/Topic725595-1557-1.aspx</link><description>Thanks pklotka. But I would stick to the table. It gives me control over which all servers to check among my long list of linked servers. Thank you for the suggestion.</description><pubDate>Sat, 13 Jun 2009 04:36:56 GMT</pubDate><dc:creator>joeroshan</dc:creator></item><item><title>RE: Automate drive space monitoring for all production servers</title><link>http://www.sqlservercentral.com/Forums/Topic725595-1557-1.aspx</link><description>Here is a simple script that allows you to avoid populating a table with servers. I'd suggest using reporting services to email results to your end users.[i]/*** This table holds the drive space data*/[/i]create table serverdrivespace(  name sysname, drive sysname, mbfree nvarchar(255))[i]/*** This script populates the serverdrivespace table*/[/i]truncate table serverdrivespacecreate table #servers(  name sysname not null, network_name sysname null, status nvarchar(255) not null, id int not null, collation_name sysname null, connect_timeout int not null, query_timeout int not null)create table #drivespace(  drive sysname, mbfree nvarchar(255))declare server_cursor cursor forselect name from #serverswhere status like '%rpc,%'begin try	insert into #servers	exec sp_helpserver	declare @name sysname	open server_cursor	fetch next from server_cursor into @name 	declare @sql nvarchar(4000)	while @@fetch_status = 0	begin		set @sql = 'exec [' + @name + '].master.dbo.xp_fixeddrives'		print @sql		truncate table #drivespace		insert into #drivespace		exec sp_executesql @sql		insert into serverdrivespace		select @name as servername, *		from #drivespace		fetch next from server_cursor into @name 	end	close server_cursorend trybegin catch	SELECT	 ERROR_NUMBER() AS ErrorNumber	,ERROR_SEVERITY() AS ErrorSeverity	,ERROR_STATE() AS ErrorState	,ERROR_PROCEDURE() AS ErrorProcedure	,ERROR_LINE() AS ErrorLine	,ERROR_MESSAGE() AS ErrorMessage;end catchselect * from serverdrivespacedeallocate server_cursordrop table #drivespacedrop table #serversAn upgrade to this would be an SSIS package that uses WMI to get drive information from remote servers. You could monitor the entire network this way instead of limiting yourself to just SQL Servers.</description><pubDate>Fri, 12 Jun 2009 07:14:09 GMT</pubDate><dc:creator>pklotka-937181</dc:creator></item><item><title>Automate drive space monitoring for all production servers</title><link>http://www.sqlservercentral.com/Forums/Topic725595-1557-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/scripts/Administration/67064/"&gt;Automate drive space monitoring for all production servers&lt;/A&gt;[/B]</description><pubDate>Thu, 28 May 2009 22:43:02 GMT</pubDate><dc:creator>joeroshan</dc:creator></item></channel></rss>