| Author |
Topic  |
|
|
sqlfresher2k7
Aged Yak Warrior
584 Posts |
Posted - 06/04/2012 : 13:56:00
|
I would like to setup a low disk space alert when space more than 70. Please suggest.. |
|
|
Sachin.Nand
Flowing Fount of Yak Knowledge
2937 Posts |
Posted - 06/04/2012 : 14:16:55
|
Use the xp_fixeddrives proc.
After Monday and Tuesday even the calendar says W T F .... |
 |
|
|
tkizer
Almighty SQL Goddess
USA
35017 Posts |
|
|
sqlfresher2k7
Aged Yak Warrior
584 Posts |
Posted - 06/04/2012 : 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
USA
35017 Posts |
Posted - 06/04/2012 : 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 Kizer Microsoft MVP for Windows Server System - SQL Server http://weblogs.sqlteam.com/tarad/
Subscribe to my blog |
 |
|
|
robvolk
Most Valuable Yak
USA
15566 Posts |
|
|
tkizer
Almighty SQL Goddess
USA
35017 Posts |
Posted - 06/04/2012 : 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 DataTable
Function 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 Kizer Microsoft MVP for Windows Server System - SQL Server http://weblogs.sqlteam.com/tarad/
Subscribe to my blog |
 |
|
|
sqlfresher2k7
Aged Yak Warrior
584 Posts |
Posted - 06/04/2012 : 22:35:06
|
Thanks Tara/robvolk
I have only one server.. |
 |
|
|
sqlfresher2k7
Aged Yak Warrior
584 Posts |
Posted - 06/04/2012 : 22:43:47
|
| Probably i would like to do this thru performance monitor alerts. Any idea? |
 |
|
|
tkizer
Almighty SQL Goddess
USA
35017 Posts |
|
|
Sachin.Nand
Flowing Fount of Yak Knowledge
2937 Posts |
|
|
tkizer
Almighty SQL Goddess
USA
35017 Posts |
|
|
Sachin.Nand
Flowing Fount of Yak Knowledge
2937 Posts |
|
|
future_is_me
Starting Member
USA
14 Posts |
Posted - 12/17/2012 : 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 DataTable
Function 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 Kizer Microsoft MVP for Windows Server System - SQL Server http://weblogs.sqlteam.com/tarad/
Subscribe to my blog
|
 |
|
|
tkizer
Almighty SQL Goddess
USA
35017 Posts |
Posted - 12/17/2012 : 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 Kizer Microsoft MVP for Windows Server System - SQL Server http://weblogs.sqlteam.com/tarad/
Subscribe to my blog |
 |
|
|
lopez
Starting Member
USA
8 Posts |
Posted - 12/20/2012 : 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 Server
You 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 - 12/27/2012 : 02:10:29
|
| unspammed |
 |
|
| |
Topic  |
|