|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Today @ 12:33 AM
Points: 26,
Visits: 133
|
|
Hello all, Can someone tell me how can we send email when my sql sevrer agent stops automatically, i have my dbmail configured...
Thanks,
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Thursday, June 13, 2013 10:20 AM
Points: 1,571,
Visits: 1,730
|
|
The problem is that SQL Agent is the program you'd typically use to do monitoring and alerting. It sounds like what you really need is some kind of watchdog program that ensures Windows services are running on your servers.
Another option might also be able to setup some script or something to run when the service fails. In the Control Panel \ Administrative Tools \ Services, right click on the service, and select the Recovery tab. You can specify here what happens when the service fails.
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Yesterday @ 5:34 PM
Points: 11,784,
Visits: 28,041
|
|
Chris Harshman (12/12/2012) The problem is that SQL Agent is the program you'd typically use to do monitoring and alerting. It sounds like what you really need is some kind of watchdog program that ensures Windows services are running on your servers.
Another option might also be able to setup some script or something to run when the service fails. In the Control Panel \ Administrative Tools \ Services, right click on the service, and select the Recovery tab. You can specify here what happens when the service fails.
yep I', with Chris; this is the "how can i make the watchman notifyme if the watchman dies?"
you can't, you have to use a different tool, something that the item you ar emonitoring does not depend on or use.
if you search for SQL monitoring software or network monitoring software, you'll find a lot of items;
Lowell
--There is no spoon, and there's no default ORDER BY in sql server either. Actually, Common Sense is so rare, it should be considered a Superpower. --my son
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Yesterday @ 1:45 PM
Points: 15,442,
Visits: 9,572
|
|
You theoretically could set up a proc that would run indefinitely, which would check the state of the SQL Agent every few seconds, and send an e-mail when it finds it not running. Set it up in master, set it to run automatically when SQL starts, and it would monitor SQL Agent from within the SQL service.
It's a really bad idea, but it could be done. One main reason it's a bad idea is that if anything takes down both SQL and SQL Agent, like a serious Windows error, then it won't monitor anything. So counting on it is unreliable.
The advice already given, that you should get some third-party monitoring tool, is the right way to go.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Thursday, June 13, 2013 5:09 PM
Points: 254,
Visits: 1,032
|
|
This is not an explicit answer to your question but it may provide an acceptable work-around if you haven't already implemented it.
Right-click on "SQL Server Agent" in your SSMS GUI and select "Properties". The "General" tab has settings for SQL Server and SQL Server Agent that will ensure they automatically restart if they inadvertently stop.
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Today @ 12:33 AM
Points: 26,
Visits: 133
|
|
| That is how it we set it but still agent stopped...so i was just thinking if i can find a work around for it...
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Friday, June 14, 2013 6:19 AM
Points: 340,
Visits: 459
|
|
The other thing to think about is that email isn't really a successful alert system unless it arrives, and there are a whole host of issues that can prevent an email from arriving even if it is sent correctly by SQL Server.
What we do is set up an agent job on each server to send a dummy email every two hours, and then have a script check the folder in our email system that the right number of emails were received by the right number of servers. If all is well, the emails are deleted. If there is a disconnect, a warning email or page goes off.
Yes, there are issues that can prevent the second warning email/page from sending, and yes, what happens if the monitor fails in addition to email on a server is a problem, but those are multiple simultaneous failure scenarios and watching both for a successful send (via agent) and a successful receipt (by the monitoring script) is better than nothing.
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Yesterday @ 3:26 AM
Points: 2,635,
Visits: 2,786
|
|
The Windows Service Control manager can detect when a service stops unexpectedly. You can use this to automatically restart your service or automatically run a command.
If you want to automatically send an email, then check this out for the syntax needed: http://serverfault.com/questions/110057/easiest-way-to-send-an-email-from-the-command-line-using-windows-2003-r2
Author: SQL Server FineBuild 1-click install and best practice configuration of SQL Server 2012, 2008 R2, 2008 and 2005. 4 June 2013: now over 24,000 downloads. Disclaimer: All information provided is a personal opinion that may not match reality. Concept: "Pizza Apartheid" - the discrimination that separates those who earn enough in one day to buy a pizza if they want one, from those who can not.
|
|
|
|