Every administrator who runs Exchange Server wants to know when something's wrong with it, and many of us would prefer to find out about small problems before they turn into larger, more serious ones. You might think doing so requires a monitoring-and-management software package such as Microsoft Operations Manager (MOM), HP's OpenView, or Quest Software's Spotlight on Exchange. Although these tools certainly provide a great deal of useful functionality, you might be surprised at the monitoring and control functionality built right into your Exchange and Windows servers. You can monitor service and application performance, control services, and get notifications without additional expense. In general, you'll probably find that you can manage a handful of servers by using the built-in tools; the more sophisticated tools start adding major value as you move beyond small numbers of servers to Exchange organizations that consist of multiple servers in multiple locations, or when you have strict service level agreements (SLAs) that place a premium on early notification of problems.
Service Monitoring Basics
The simplest question to answer is also one of the most important: Is my server up or down? Most administrators are accustomed to checking the status of services from within Exchange System Manager (ESM). You can check the state of each individual virtual server by expanding a protocol in the Protocols container beneath each server, then looking for the familiar (and usually unwanted) little red circle. Doing so is a fine first step, but all it tells you is whether the virtual server is active; the underlying service can't be stopped without any indication in ESM other than the red Xso you can't easily tell whether the virtual server instance is stopped or the underlying service has failed or been stopped.
A more authoritative source is the Control Panel Services applet (services.msc). This applet lets you see and change the status of the Exchange services and their prerequisite services. You can right-click Services (Local) and use the Connect to another computer command to connect to another server, which is handy if you want to manage your servers from your desktop or notebook machine. The applet lets you see whether a service is currently running; you can stop and restart services or set their startup type. You can use the Services applet to get further information when ESM tells you that a service isn't running as it should be.
Of course, not everyone wants to use a GUI for every task. You can manage services from the command line by using two methods: the venerable NET commands and the Sc command. You're probably already familiar with NET START and NET STOP; they require the name of the service you want to control (e.g., NET STOP msexchangeIS will stop the Information Store service). Just typing NET START with no arguments will list all running services on the machine you're logged on to, which can be handy when you're trying to verify which services are running. If you try to stop a service on which other services depend (such as the System Attendant), NET STOP will prompt you to confirm your command unless you append the /y switch.
The Sc command is much more flexible, although this flexibility requires some additional work on your part. The first useful thing to know about Sc is that you can use it to target services on another server by including the server name (either as a NetBIOS name or a fully qualified DNS name) prefixed by two backslashes. You can use several command verbs with Sc:
Sc query tells you the state of the named service (which, we hope, is running), what control commands it's prepared to accept, and its last exit code.
Sc qc shows you the service name, its start type (automatic, manual, or disabled), the path to the binary image, the display name, the account used to start the service, and its dependent services.
Sc queryex displays the same information as Sc query, with the addition of the service process's process ID, which is sometimes needed to kill a hung process; you might need this information if the SMTP service hangs when encountering a malformed message.
Sc start and Sc stop do what you'd expect: They start and stop the named service. You have to stop each individual service separately because a single command can't stop a service and its dependents. Sc also has another difference from the NET commands: The latter don't return control to you until the service has either completed your request or failed to do so, but Sc simply sends the command and returns immediately, displaying a status of START_PENDING or STOP_PENDING.
Sc enumdepend displays the list of services that depend on the named service. This command is useful in conjunction with Sc stop; you can stop the dependent services first.
The most helpful way to use these commands is probably in a script that runs at intervals you define; the script can use Sc queryex to check the status of key processes, then alert you if something's amiss.
Setting Services for Automatic Restart
These tools are most useful when you want to explicitly stop or start a particular service. Most of the time, however, we really want to monitor a service and kick-start it if it fails. You can set service failure options in the Services applet by using the following steps:
Launch the Services applet.
Open the target service's Properties dialog box.
Switch to the Recovery tab, which Figure 1 shows. By default, the Exchange services are configured to do nothing when they fail. However, you can choose to restart the service, run an external program (which can be a script), or restart the computer. The IIS Admin service, for example, runs iisreset.exe with the /start switch when the service fails; this executable's job is to clean up the service and restart it normally.
For your Exchange services, set the first failure option to restart the service.
For the second failure option, your best bet is to use a notification tool to send mail directly to some other account or device that you monitor; for example, you can use the freeware Blat tool to send SMTP mail directly to a Short Message Service (SMS)-enabled mobile phone by using the free Teleflip service. Simply specify the (US-only) mobile number @teleflip.com as the target address (e.g., 4195551212@teleflip.com), and the message will automatically be gatewayed to your phone.