Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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 8, 2012 11:07 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 2:22 PM
Points: 40,986, Visits: 38,284
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."

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

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

Group: General Forum Members
Last Login: Friday, January 29, 2016 12:11 PM
Points: 192, Visits: 929
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 9, 2012 9:27 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, July 18, 2016 10:02 AM
Points: 1,933, Visits: 3,627
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