Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How to notify through DB MAIL when sql server agent stopped automatically?


How to notify through DB MAIL when sql server agent stopped automatically?

Author
Message
sqlpanther
sqlpanther
SSC Rookie
SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)

Group: General Forum Members
Points: 38 Visits: 198
Hello all,
Can someone tell me how can we send email when my sql sevrer agent stops automatically, i have my dbmail configured...

Thanks,
Chris Harshman
Chris Harshman
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2664 Visits: 3247
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.
Lowell
Lowell
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14931 Visits: 38919
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

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

GSquared
GSquared
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14369 Visits: 9729
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
Gail Wanabee
Gail Wanabee
Old Hand
Old Hand (325 reputation)Old Hand (325 reputation)Old Hand (325 reputation)Old Hand (325 reputation)Old Hand (325 reputation)Old Hand (325 reputation)Old Hand (325 reputation)Old Hand (325 reputation)

Group: General Forum Members
Points: 325 Visits: 1302
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.
sqlpanther
sqlpanther
SSC Rookie
SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)

Group: General Forum Members
Points: 38 Visits: 198
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...
Jason Bunn
Jason Bunn
SSC-Addicted
SSC-Addicted (413 reputation)SSC-Addicted (413 reputation)SSC-Addicted (413 reputation)SSC-Addicted (413 reputation)SSC-Addicted (413 reputation)SSC-Addicted (413 reputation)SSC-Addicted (413 reputation)SSC-Addicted (413 reputation)

Group: General Forum Members
Points: 413 Visits: 646
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.
EdVassie
EdVassie
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3144 Visits: 3815
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

Original author: SQL Server FineBuild 1-click install and best practice configuration of SQL Server 2017 2016, 2014, 2012, 2008 R2, 2008 and 2005. 1 Dec 2016: now over 39,000 downloads.
Disclaimer: All information provided is a personal opinion that may not match reality.
Quote: "When I give food to the poor they call me a saint. When I ask why they are poor they call me a communist." - Archbishop Hélder Câmara
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