How to Detect if SQL Agent is running

  • Occasionally, SQL Agent is found not to have started after a reboot. 

    DOes anyone know how to use SQL from one SQL server to monitor other SQL Server's to see that their Agents are running?  I hope to use one SQL server to monitor others.

  • I know you can send yourself an email through SQL Mail if SQL Agent Stops.

    Do you know that you can change the property of the SQL Agent Service though Services or Server Manager under SQL Admin Tools to automatically start when the operating system starts? The default on install is that it does not auto start.

  • You can also obtain netsvc.exe, from the Windows Resource Kit.

    This handy utility can give you the status on any service locally or remotely.

    Controls and displays the status of services.

    NETSVC servicename \\computername /command

       servicename  Name of the service

       computername Name of the computer to administer.

       /command     One of the following:

                    /query    Queries the status of the service.

                    /start    Starts the service.

                    /stop     Stops the service.

                    /pause    Pauses the service.

                    /continue Starts the paused service.

                    /list     Lists installed services (omit servicename)

    Example: NETSVC server  \\joes486 /query

    Example: NETSVC "Clipbook Server" \\popcorn /stop

    Example: NETSVC alerter \\joes486 /pause

    Example: NETSVC /list \\joes486

  • Great Info PearlKnows, I just used it. Been working with SQL for years. Things you learn. Thanks for the info.

  • You're welcome!  It may also be possible for you to script something out using xp_cmdshell, and netsvc.exe, and then schedule it, with an alert if the service shuts down (assuming its remote)  I hope this gives you an idea.

Viewing 5 posts - 1 through 4 (of 4 total)

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