dbWriter Home
IP to Country Look up
Site Map

IP to Country DB

Free Databases:

ASP Code

ASP Links

VB Script functions:
Array
Case/Select
In String (inStr)
Replace

HTML code:
SELECT Color
SELECT Countries
SELECT Language
SELECT State/Province

SQL:

SQL Functions:
Delete leading Char
Get Browser
Long number from IP

Stored Procedures:

SQL Tricks:
Delete ALL duplicates
Delete dup records

MISC
IP Address Owner
MS SQL Server

Mortgage Calcs:
how much is my payment
Loan Amortization
Loan Calculator
Mortgage Calculator
Motrgage Pay Off

dbWriter License

Link to US

Links

Contact US
 

dbWriter SQL stored procedure email drive space problems to administrator

Set up job to run this stored procedure on hourly basis to check for drive space problems and email to the administrator: Here are two choices of how to send that e-mail.

Send e-mail using xp_sendmail:

CREATE PROCEDURE [dbo].[ZP_EMAIL_Drive]
As

declare @MB_Free int

create table #FreeSpace(
Drive char(1),
MB_Free int)

insert into #FreeSpace exec xp_fixeddrives

select @MB_Free = MB_Free from #FreeSpace where Drive = 'C'

-- Free Space on C drive Less than Threshold
if @MB_Free < 1024
exec master.dbo.xp_sendmail
@recipients = 'administrator@YOURSITE.com',
@subject ='SERVER X - Free Space Issue on C Drive',
@message = 'Free space on C Drive has dropped below 1 gig'

select @MB_Free = MB_Free from #FreeSpace where Drive = 'F'

-- Free Space on F drive Less than Threshold
if @MB_Free < 2048
exec master.dbo.xp_sendmail
@recipients =  'administrator@YOURSITE.com',
@subject ='SERVER X - Free Space Issue on C Drive',
@message = 'Free space on F Drive has dropped below 2 gig'

drop table #FreeSpace

GO
 

  OR Send e-mail using  dbWriters  -- CDONTS NewMail

CREATE PROCEDURE [dbo].[ZP_EMAIL_Drive]
As

declare @MB_Free int

create table #FreeSpace(
Drive char(1),
MB_Free int)

insert into #FreeSpace exec xp_fixeddrives

select @MB_Free = MB_Free from #FreeSpace where Drive = 'C'

-- Free Space on C drive Less than Threshold
if @MB_Free < 1024
exec [dbo].[zp_sendMAIL]
@From = 'SERVER X ',
@To = 'administrator@YOURSITE.com',
@CC = null,
@Subject = 'SERVER X - Free Space Issue on C Drive',
@Body = 'Free space on C Drive has dropped below 1 gig',
@BCC = null,
@Attachment  = null


select @MB_Free = MB_Free from #FreeSpace where Drive = 'F'

-- Free Space on F drive Less than Threshold
if @MB_Free < 2048
exec [dbo].[zp_sendMAIL]
@From = 'SERVER X ',
@To = 'administrator@YOURSITE.com',
@CC = null,
@Subject = 'SERVER X - Free Space Issue on F Drive',
@Body = 'Free space on F Drive has dropped below 2 gig',
@BCC = null,
@Attachment  = null

drop table #FreeSpace

GO
 

Partners/Links © 2005 - 2008 dbWriter.com All Rights Reserved
This site is protected by the dbWriter IPtoCountry MS/SQL database!!
Site map | Link to US
Contact Us

Sign up for PayPal and start accepting credit card payments instantly.