Author |
Topic |
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2012-06-04 : 13:56:00
|
I would like to setup a low disk space alert when space more than 70.Please suggest.. |
|
Sachin.Nand
2937 Posts |
Posted - 2012-06-04 : 14:16:55
|
Use the xp_fixeddrives proc.After Monday and Tuesday even the calendar says W T F .... |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2012-06-04 : 15:53:30
|
Thanks Tara !How should i setup an alert when the disk space is low with isp_DiskSpace procedure (CLR). |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2012-06-04 : 16:18:55
|
Depends how you are alerting now. We used Database Mail to send out alerts. We logged the output of the stored procedure for all of our servers into one table, believe we ran it hourly or maybe even more frequently. We then had another job that read that table to find issues and sent emails when there were issues. The emails were either regular emails or it went to our mobile devices. We set thresholds of 80-89 full as regular emails and 90+ full were sent to mobile devices.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2012-06-04 : 16:38:00
|
There's also a way to find mount point free space using PowerShell:http://blogs.technet.com/b/josebda/archive/2010/04/08/using-powershell-v2-to-gather-info-on-free-space-on-the-volumes-of-your-remote-file-server.aspx |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2012-06-04 : 16:41:21
|
I have a PS script as well for this. I had to roll my own as none of the ones I found on the Internet worked on all of our servers.Here's my PS script:# Helper function to translate the scriptblock output into a DataTableFunction Out-DataTable { $dt = new-object Data.datatable $First = $true foreach ($item in $input){ $DR = $DT.NewRow() $Item.PsObject.get_properties() | foreach { if ($first) { $Col = new-object Data.DataColumn $Col.ColumnName = $_.Name.ToString() $DT.Columns.Add($Col) } if ($_.value -eq $null) { $DR.Item($_.Name) = "[empty]" } elseif ($_.IsArray) { $DR.Item($_.Name) =[string]::Join($_.value ,";") } else { $DR.Item($_.Name) = $_.value } } $DT.Rows.Add($DR) $First = $false } return @(,($dt))} #Out-DataTable# Get disk space information for each volume (drives and mounts)Function Get-VolumeSpace ([string]$ServerName="localhost"){ $wql="Select SystemName, Name, Capacity, FreeSpace From Win32_Volume Where DriveType=2 or DriveType=3" $volSpace=Get-WmiObject -ComputerName $ServerName -Query $wql $volSpace | Select SystemName, Name, Capacity, FreeSpace} #Get-VolumeSpace$dataTable = Get-VolumeSpace | Out-DataTable$connectionString = "Data Source=Server1\Instance1;Integrated Security=true;Initial Catalog=DBA;"$bulkCopy = new-object ("Data.SqlClient.SqlBulkCopy") $connectionString$bulkCopy.DestinationTableName = "VolumeSpace"$bulkCopy.WriteToServer($dataTable) Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
|
|
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2012-06-04 : 22:35:06
|
Thanks Tara/robvolkI have only one server.. |
|
|
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2012-06-04 : 22:43:47
|
Probably i would like to do this thru performance monitor alerts. Any idea? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
Sachin.Nand
2937 Posts |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
Sachin.Nand
2937 Posts |
|
future_is_me
Starting Member
14 Posts |
Posted - 2012-12-17 : 14:08:57
|
How can I make use of this script? If I put this script in action part of a basic task wizard (task scheduler) would this send me an email whenever the size falls below a specific value?quote: Originally posted by tkizer I have a PS script as well for this. I had to roll my own as none of the ones I found on the Internet worked on all of our servers.Here's my PS script:# Helper function to translate the scriptblock output into a DataTableFunction Out-DataTable { $dt = new-object Data.datatable $First = $true foreach ($item in $input){ $DR = $DT.NewRow() $Item.PsObject.get_properties() | foreach { if ($first) { $Col = new-object Data.DataColumn $Col.ColumnName = $_.Name.ToString() $DT.Columns.Add($Col) } if ($_.value -eq $null) { $DR.Item($_.Name) = "[empty]" } elseif ($_.IsArray) { $DR.Item($_.Name) =[string]::Join($_.value ,";") } else { $DR.Item($_.Name) = $_.value } } $DT.Rows.Add($DR) $First = $false } return @(,($dt))} #Out-DataTable# Get disk space information for each volume (drives and mounts)Function Get-VolumeSpace ([string]$ServerName="localhost"){ $wql="Select SystemName, Name, Capacity, FreeSpace From Win32_Volume Where DriveType=2 or DriveType=3" $volSpace=Get-WmiObject -ComputerName $ServerName -Query $wql $volSpace | Select SystemName, Name, Capacity, FreeSpace} #Get-VolumeSpace$dataTable = Get-VolumeSpace | Out-DataTable$connectionString = "Data Source=Server1\Instance1;Integrated Security=true;Initial Catalog=DBA;"$bulkCopy = new-object ("Data.SqlClient.SqlBulkCopy") $connectionString$bulkCopy.DestinationTableName = "VolumeSpace"$bulkCopy.WriteToServer($dataTable) Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog
|
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2012-12-17 : 16:08:14
|
quote: Originally posted by future_is_me How can I make use of this script? If I put this script in action part of a basic task wizard (task scheduler) would this send me an email whenever the size falls below a specific value?
The script that I posted just gets the information. You would have to write code to read the table and take action as necessary. We use this table for growth purposes and not for alerting purposes. We have separate alerting software (SCOM).Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
|
|
lopez
Starting Member
8 Posts |
Posted - 2012-12-20 : 00:56:01
|
Whenever working with SQL Server it is a very difficult task to get information related to the hard disk space that is consumed by the SQL Server and its databases, and to perform required tasks to save the disk space from being misused or wasted with the Databases of the SQL ServerYou can follow the step by step operation in SQL Server Management Studio for alerting http://databases.about.com/od/sqlserver/ht/sqlserveralerts.htm |
|
|
gtopawb
Starting Member
5 Posts |
Posted - 2012-12-27 : 02:10:29
|
unspammed |
|
|
|