Notification
There are variety of methods to obtain notification from an NT server. NT contains a collection of internally pre-defined alerts (such as disk space low, service unable to start, etc.) that are written to the event logs, and can be configured to issue a pop-up message on a remote NT workstation or server that is in interactive use. There are also a variety of third party products that provide various types of notification, such as email, paging, red flashing consoles, etc. One of the most common and flexible communication interfaces in the corporate environment is, undeniably, e-mail. Email, in many cases, is the primary interface to other personnel in the company, even moreso than the telephone in some cases. Arrangements can even be made with telecommunications providers such that email sent to an external address activates a pager or cellular phone. For many companies, it is a very simple and logical choice to take advantage of this already existing infrastructural component for system-generated alerts.
Many operating systems provide an intrinsic method for sending messages via email. However, one common irritation with Windows NT is the lack of a UNIX-like "sendmail" command. Luckily, there are utilities available to add this functionality. In fact, one such command-line utility (MailTo.exe) is available as freeware. (Please see the resources section for the download URL.) This particular MailTo command sends STMP mail, and can include text files as the message body or attachments, and binary files as attachments. The syntax is very simple, and since it is a command-line executable, calls to it can be included in BAT or CMD files or more advanced scripts. Below is a list of possible uses, some of which have examples in the scripting article of this section:
1) Scan the ORACLE alert log for errors using the FINDSTR command, and, if any errors are found, email them to a list of email addresses. A job such as this can be scheduled to execute every 60 minutes, for instance. (Please see the example in the scripting article.) This essentially automates the mundane DBA task of periodically checking the alert log for any errors, and proves very useful when the DBA is off-site, as the email can be directed to other administrative personnel.
2) Check services to make sure they are started, and, if not, send an email to operational personnel. Again, this type of job can be automated to run at short periodic intervals, such as every 15 minutes or once per hour. Consequently, the job could be constructed in a manner that attempts to restart the particular service, as well as mailing a note to an administrator.
3) Scan the spooled output from a hot backup for errors using FINDSTR, then email any errors that were found to an administrator. This functionality could be added to the job that runs the hot backup.
4) Scan the spooled output from a full export for errors using FINDSTR, and, if errors are found, send an email containing the error listing to a DBA. This functionality could be added to the job that actually runs the full export.
5) Scan the NT Event Logs by writing the filtered contents to a text file using the DUMPEL.EXE, then scan the output for specific errors using the FINDSTR command. If specific errors or warnings are found, email them to an administrator. This type of job could be scheduled to run several times daily, once per hour, etc.
6) Perform a TNSPING or even connect to a database instance. If connection is not achieved, send an email to an administrator, and perhaps even attempt to restart the database instance if the connection error indicates the instance is not available. This type of job could be scheduled to run several times per hour, if necessary.
7) Spool the output of a DIR command, or the output of the DIRUSE command, to a text file and email this output to an administrator. This type of job can be used to monitor available disk space, and could be scheduled to run each morning, once per week, etc.
It should be obvious from the above list that automated notification can be achieved without a tremendous investment of time, dollars, expertise, and other valuable resources. In fact, the above list of jobs can be automated using entirely free components (such as the MailTo.exe, Schedule service, and VBscripts run by Microsoft's Windows Scripting Host). Please see the article on scripting for examples of several of the items on the list above.