Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

check diskspace Expand / Collapse
Author
Message
Posted Thursday, November 08, 2012 11:07 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 7:19 AM
Points: 35,956, Visits: 30,245
SGT_squeequal (11/8/2012)
@jeff here you go, save it then rename it to .vbs



Heh... I saw some CDO email in there. You're a man after my own heart. Thanks for posting the code.


--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." -- 04 August 2013
(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1382645
Posted Friday, November 09, 2012 8:55 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Today @ 6:46 AM
Points: 190, Visits: 878
If you don't have any mount points, here is a script for using the xp_fixeddrives function. The threshold is set in the if exists line, and sends an email showing all drives with free space below the set threshold. Hope it helps someone.



CREATE TABLE #DriveSpace
(DriveLetter char(1),
MBFree int)

INSERT INTO #DriveSpace
EXEC master.dbo.xp_fixeddrives


if exists (SELECT * FROM #DriveSpace WHERE MBFree < 10000) -- value to set threshold at, in MB
BEGIN
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'SQL Server Agent Mail Profile',
@recipients = 'someone@mycompany.com',
@query = 'CREATE TABLE #DriveSpace2 (DriveLetter Char(1),MBFree int); INSERT INTO #DriveSpace2 EXEC master.dbo.xp_fixeddrives; SELECT DriveLetter, MBFree FROM #DriveSpace2; DROP TABLE #DriveSpace2' ,
@subject = '<ServerName> - Low Disk Space',
@attach_query_result_as_file = 1 ;
END
DROP TABLE #DriveSpace
Post #1383070
Posted Friday, November 09, 2012 9:27 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Tuesday, April 15, 2014 9:54 AM
Points: 1,720, Visits: 3,063
Thanks much, we don't have mount points. I will give it a try
Post #1383094
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse