SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


check diskspace


check diskspace

Author
Message
sqlfriends
sqlfriends
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10121 Visits: 4195
Is there any existing and recommended script that checks sql server drives, and send alerts to DBA, like there is only 10% space or 30 % space free ?

Thanks
SGT_squeequal
SGT_squeequal
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1191 Visits: 1118
you could create something from master..xp_fixeddrives however, i created a VBS script that you pass a couple of parameter, disk to check and threshold, if the disk space is less then threshold then an email is sent. drop me a private message with your email address and i will send you a copy

*************************************************************

The first is always the hardestw00t
sqlfriends
sqlfriends
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10121 Visits: 4195
Thanks, I am currently using a sqlscript from this site http://www.sqldbatips.com/showcode.asp?ID=4 ,which enables sp_OACreate.

And I just came back from a SQl in the City session, it says to enable sp_OA is not good for security.
So I think I may need to change that. What do you think this script? Thanks
SGT_squeequal
SGT_squeequal
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1191 Visits: 1118
that URL does not resolve for me, like i say i use a VBS script that works perfect for me i can even pass a URL and it works prety well for me

*************************************************************

The first is always the hardestw00t
Perry Whittle
Perry Whittle
SSC Guru
SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)SSC Guru (52K reputation)

Group: General Forum Members
Points: 52735 Visits: 17672
The best way is to use a simple WMI query as follows

wmic volume get capacity, "free space", name



If xp_cmdshell is disabled you can turn it on first then disable it again afterwards.

Or you could run it from a central trusted server where xp_cmdshell is on and use the Node paarameter to read remote servers like so (also has an output file)

wmic /output:"c:\temp\mountsizes.txt" /node:sqlnode1,sqlnode2,sqlnode3,sqlnode4
volume get capacity, "free space", name, systemname



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

"Ya can't make an omelette without breaking just a few eggs" ;-)
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)

Group: General Forum Members
Points: 210493 Visits: 41973
SGT_squeequal (11/7/2012)
you could create something from master..xp_fixeddrives however, i created a VBS script that you pass a couple of parameter, disk to check and threshold, if the disk space is less then threshold then an email is sent. drop me a private message with your email address and i will send you a copy


Any chance of you posting the VBS script? Thanks.

--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.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Joie Andrew
Joie Andrew
SSCertifiable
SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)

Group: General Forum Members
Points: 6271 Visits: 2032
I would avoid xp_fixeddrives. It does not recognize mount points. You will get much better information querying the win32_Volume WMI class. You can do it easy if you are using powershell:

get-wmiobject -class win32_volume | select-object -property name, label, capacity, freespace | format-table -wrap

Joie Andrew
"Since 1982"
SGT_squeequal
SGT_squeequal
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1191 Visits: 1118
@jeff here you go, save it then rename it to .vbs :-)

*************************************************************

The first is always the hardestw00t
Attachments
DriveCheckv1.5.txt (31 views, 3.00 KB)
sqlfriends
sqlfriends
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10121 Visits: 4195
Thank you SGT_squeequal.

Do you schedule this as a windows task or a sql agent job?

I will give it a try.
SGT_squeequal
SGT_squeequal
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1191 Visits: 1118
your welcome, i use windows scheduled task, you have to pass 3 parameter

1 drive or URL to Drive
2 hostname (not used in processing, only used to write to log file so i know what server its checking)
3 Threshold (i use 15% when server has 15% or less email me)

Example exec from a batch file

cscript //b //nologo C:\DriveCheckv1.5.vbs "\\192.0.0.142\data" SERVER_SHARE 15

message me if you have any proplems

*************************************************************

The first is always the hardestw00t
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search