Software requirements ===================== - Sudo: Sudo tool allows a user to execute a command as another user. It will be necessary if you are planning to allow a non-root user to execute Smart. You can download Sudo at http://www.courtesan.com/sudo/. - Awk: Awk is a pattern scanning and processing language. Smart uses it and expects to find it at /bin/awk. If that's not your case, you should edit "check-service" and "smart" files of Smart distribution and modify the line where AWK="/bin/awk" is specified. - Nagios plugins: Their sources may be downloaded independently of Nagios distribution and some of them require additional installation of certain programs and libraries. You can use the plugins distributed with Smart, or download the newest ones at http://sourceforge.net/projects/nagiosplug/. Some shell scripts (into the "scripts" directory of Smart) may require some specific commands to check some services, such as "dig" for dns, "wget" for web services, "nmblookup" for nmbd (samba), "ntpq" for ntpd, "ldapsearch" for slapd (openldap), etc. The paths of this commands are defined in a variable at the beginning of each script, thus you can change their location, use any other command that might work better for your system, or even rewriting the whole script at your convenience. Smart installation ================== Integration with Sudo, allows the system administrator to permit another user, we call sysman, to restart any services or execute any program as if he was root. Permissions of files and directories allow that user to execute Smart, but deny him to modify its contents. If you are not interested in creating such a user, you can omit steps 1, 2 and 3. 1. Create user "sysman" and group "sysman". 2. Create Smart directory. It's a good idea to install it at "sysman" home and to set the appropriate owner and permissions: mkdir /home/sysman chown root:sysman /home/sysman chmod 750 /home/sysman 3. Edit Sudo configuration file (/etc/sudoers) and add the following lines: ... sysman hostname=(root) NOPASSWD: /home/sysman/check-service sysman hostname=(root) NOPASSWD: /sbin/reboot 4. Get the Smart software at http://www.uic.es/uicfreesoft/smart/. 5. Untar and unzip the distribution: tar -zxf smart-X.Y.tar.gz 6. Get into the distribution and copy files to the destination directory. If you choose a destination different from "/home/sysman", you will have to edit "smart" file and modify the line where dir="/home/sysman" is specified. cd smart-X. cp check-service /home/sysman/ cp smart /home/sysman/ cp host.conf.dist /home/sysman/host.conf cp services.conf.dist /home/sysman/services.conf cp -r scripts /home/sysman/ cp -r plugins /home/sysman/ 7. Get into destination directory and check/set files permissions and owners. cd /home/sysman chown -R root:root check-service scripts plugins host.conf services.conf chown root:sysman smart chmod -R 700 check-service scripts plugins chmod 750 smart chmod 644 host.conf services.conf Smart configuration =================== a) Edit Smart host config file (host.conf) and modify it according to your preferences (hostname, mail notifications, commands paths...). b) Edit Smart services config file (services.conf) and uncomment/modify/add any service/daemon you want to check. Every line describes one service, with the following semicolon-separeted parameters: NAME (non-empty string): descriptive service name (ex: IMAP). process_name[:port] (non-empty string[:integer]): parent process name and its operational port (ex: couriertcpd:143). process_param (string): parameters of running process. Some services run with the same process name, so parameters are useful to distinguish them. For example, parent process of Courier IMAP and POP3 is "couriertcpd", but one is executed with the parameter "pop3d" and the other one with "imapd" (ex: imapd). max_procs (non-empty integer): highest number of running processes allowed (ex: 10). Leave it to 0 if what you're monitoring runs no processes (for example, disk space). min_procs (non-empty integer): lowest number of running processes allowed (ex: 1). Leave it to 0 if what you're monitoring runs no processes (for example, disk space). start_command (string): command to start the service or script to be executed when service is down (ex: /courier/libexec/imapd.rc). pid_file (string): pid file path (ex: /var/run/imapd.pid). sock_file (string): socket file path start_mode (0/1 integer): the service may be started/stopped by adding start/stop to the start command (1), or it may be not necessary (0). check_script (string): name of the script used to check the service. This script has to be into the "scripts" directory (ex: imap.nag). Leave parameters empty if they are not applicable, except NAME, process_name, max_procs, min_procs and start_mode, which can't be empty. Running smart ============= Now you should be able to run Smart as user root or sysman: /home/sysman/smart Try with -h to get more information about available parameters. To run Smart through crond may be a good thing. You can run it as frequently as you wish, but doing it every five minutes seems to be reasonable enough.