.\"Copyright (c) 2000 .\" W. M. Shandruk . All rights are reserved. .\" .\"Redistribution and use in source and binary forms, with or without .\"modification, are permitted provided that the following conditions .\"are met: .\"1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\"2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\"3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by W. M. Shandruk. .\"4. The name of W. M. Shandruk may not be used to endorse or promote .\" products derived from this software without specific prior written .\" permission. .\" .\"THIS SOFTWARE IS PROVIDED BY W. M. SHANDRUK ``AS IS'' AND ANY EXPRESS OR .\"IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF .\"MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN .\"NO EVENT SHALL W. M. SHANDRUK BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, .\"SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, .\"PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; .\"OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, .\"WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR .\"OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF .\"ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" .\" .Dd August 21, 2003 .Dt MONITORD 8 .Os FreeBSD 4.3 .Sh NAME .Nm monitord .Nd monitor system services for accidental termination .Sh SYNOPSIS .Nm monitord .Op Fl f Ar file Fl t Ar interval .Sh DESCRIPTION .Nm monitord is a simple to use system service that allows one to easily monitor other system services for accidental termination. If they terminate because of some internal bug or illegitimate action, such as a DoS attack, they are restarted with the given username and parameters specified in .Pa monitord.conf . .Pp The two command line options are as follows: .Bl -tag -width Fl .It Fl f Ar file A custom configuration .Pa file may be used instead of the default one: .Pa /usr/local/etc/monitord.conf. .It Fl t Ar interval The time .Ar interval in seconds at which to check the system processes, which are configured in .Pa monitord.conf. The default .Ar interval is 10 seconds. .El .Pp The configuration file for .Nm , .Pa /usr/local/etc/monitord.conf , has a simple format. It is divided into two parts. The first part contains general configuration informaion, which for now consists simply of the admin's email and your email server. The second part consists of multiple configuration lines for each service to be monitored. In this second part, the first column contains the .Ar user under which the given .Ar service on that line will be run if it needs to be restarted. The group to which the user belongs will be grabbed from the password database. The second column consists of the .Ar options to be used in monitoring that particular service. Currently, three options are supported: .Bl -tag -width Fl .It Ar auto Indicates that the service should be automatically restarted if it's found down. This is also the default behaviour when neither .Ar auto nor .Ar noauto are specified. .It Ar noauto Indicates that the service should not be automatically restarted if it's down. .It Ar alert Indicates that if this service is found down, the administrator is automatically notified via email, as specified in the first part of the configuration file. Also, once a service is restarted, this option will prompt .Nm to notify the administrator that it was successfully restarted. .El .Pp The third column is the .Ar delay that will follow the startup of that particular service. Some services take a while to start up, especially if they need to perform preperatory tasks in a wrapper script, so to keep .Nm from attempting to restart a service after it's already begun its startup proceedure but before it appears in the process table the specified .Ar delay keeps .Nm from checking that service for the specified time in seconds. The fourth and fifth columns are the .Ar service being monitored and .Ar script used to start the service, respectively. Only the script column includes the full path. If no special wrapper script is being used but instead the service's binary is invoked directly simply include the path to the service in the script column. The service field should always contain the name of the binary being executed. See examples in .Pa monitord.conf. The last column, which is optional, may contain any .Ar parameters that should be passed to the .Ar script (or binary as the case may be). For instance, the following line would configure .Nm to watch for .Xr sendmail 8 and restart it, in case of termination, with the user .Va root and group .Va wheel (which it would grab from the password database), and then notify the administrator. .Nm will wait 30 seconds after attempting to restart sendmail before it checks to see if sendmail is up and running: .Pp .Bd -literal root auto,alert 30 sendmail /usr/sbin/sendmail -bd -q60m .Pp .Sh EXAMPLES Here are a few more example service entries: .Pp .Bd -literal root auto,alert 30 syslogd /usr/sbin/inetd -wW root auto,alert 30 syslodg /usr/sbin/syslogd www auto,alert 60 httpd /usr/local/etc/rc.d/apache.sh .Ed .Pp .Sh IMPLEMENTATION NOTES This is version 0.4.1. .Pp When using a time .Ar interval that is smaller than 5 seconds, an increasingly larger amount of CPU time will be used by the process. It is recommended that one keep the .Ar interval equal to or above 5 seconds. The default of 10 seconds may be changed in .Pa config.h before compile time. .Pp .Sh FILES .Bl -tag -width /usr/local/etc/monitord.conf -compat .It Pa /usr/local/etc/monitord.conf configuration file .El .Sh DIAGNOSTICS When restarting a .Ar service which it is monitoring, .Nm monitord will notify .Xr syslogd 8 of the event. .Pp .Nm monitord should be run as .Va root so that it can restart the services it is monitoring with the correct username and group. .Sh AUTHOR This manual page was written by .An W. M. Shandruk Aq walt@erudition.net . .Sh BUGS There are no known bugs.