Automatic Notification When SQL Server Agent shuts down?

  • For some reason, my SQL Server Agent turns itself off on occasion.  There don't seem to be any error messages in the logs, so I have no idea why it's happening.  I'd like to set up some process that will notify me when the SQL Server Agent is not up and running.  Obviously I can't set up a SQL Job, because it wouldn't run if SQL Server Agent was down!

    Anyway, just thought you guys would have a inventive workaround or some great ideas!

    Thanks,

    Bill

  • The agent is a service, so you can monitor it using one of Windows resource kit utility SCLIST.EXE

    you can use a batch file like:

    sclist|find /i "SQLServerAgent"

    IF %ERRORLEVEL% EQU 1 ECHO "Agent not Running"

    As to why it is not running, check the account the service started with.

     

    Hope this helps.

     

  • On W2K and W2K3, there also are options for the OS to restart it. I belive in SQL2K, there's an option as well.

  • Thanks!  I found the option to restart the service in W2K and SQL2K.  In SQL2K it's under the Advanced tab of SQL Server Agent Properties in Enterprise Manager.

    I think I'll leave it at that and not change the recovery options on the Windows service.  If I set both of them to recover there may be a conflict.

    I appreciate it very much!

    Bill

  • JUST FYI,  If you want to monitoring a service state inside SQL this can be done by another undocumented xp. Here is the T-SQL to show the surrent state for the SQL server agnet.  Again this can be used for any service.

    xp_servicecontrol N'QUERYSTATE', N'SQLserveragent'

     

    Dan

  • Cool, thanks Dan!

  • There is software available to monitor services and page you when they go down.

    I use What's Up Gold for monitoring the SQL and Agent services on my servers. It is inexpensive.

    http://www.ipswitch.com/Products/WhatsUp/

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply