System Manager in a Box v1.0p2

Copyright 1999 PegaSoft Canada.  All Rights Reserved.

Linux is a trademark of Linus Torvalds.
System Manager in a Box is a trademark of PegaSoft Canada.

Licencing Information


This version of System Manager in a Box is shareware.  You may distribute this program freely along with this documentation.  Try this product for a two week period.  If you want to continue using this version for personal use, please mail US$35 to PegaSoft Canada to support fair priced, quality software.

For corporate, business use, register this program for US$249.  Registered users receive a CD-ROM, an illustrated manual with a special section on Linux administration basics, access to all minor upgrades of this software (version 1.1, 1.2 and so forth), and preferred customer support by our staff. The support does not extend to general questions about Linux or its distributions.

More information about PegaSoft and our products are available from our web site at http://www.vaxxine.com/pegasoft.  We encourage you check to check our site periodically for upgrades and plug-ins for SMiaB.

PegaSoft recognizes the fast obsolesce of computer software. All PegaSoft software reverts to freeware two years after its first release, and includes all minor upgrades. The release date is shown in the "About" window of the software. SMiaB 1.x reverts to freeware on November 1, 2001.

PegaSoft considers its software sold under license to a single user. The software isn't restricted to a single computer. If you purchase a copy of version 1.0 of a product, you may run the program on any computer you own, provided only one copy is in use at one time. As a result, if you install the software so as to run automatically on a regular basis, please register the copy on each computer so configured.
 

Release Notes

Linux administration is amazingly complex, and it's impossible to foresee all problems and configurations. We are interested in any problems you find with SMiaB and any plug-ins you've written for it.

Please email any problems/praise/suggestions to smiab_tech@tiamet.vaxxine.com and include the following information:
 


Remember that system administration problems are very hard to duplicate: no two computers are exactly alike. Please give as much relevant information as possible.

This version has been tested against Red Hat 6.0, S.u.S.E. 5.3/6.1, Caldera 2.2, Mandrake 6.0, Slackware 4.0. Debian 2.0 has been partially tested but is not fully supported.

Changes to SMiaB since version 0.9.2b (public beta release):

Changes SMiaB since version 0.9.1b (public beta release): If you developed a plug-in and want it featured on our web site, email it to smiab_public@tiamet.vaxxine.com.
 

Introduction

SMiaB is a system configuration debugger and troubleshooting tool designed to track down obscure system problems. SMiaB does not claim to solve all administration problems or understand highly customized Linux installations. Instead, it focuses on common Linux distributions, popular Linux packages, and detecting problems like network configuration errors, package installation mistakes, security oversights, performance bottlenecks and unexpected server failures--the kind of tiny problems administrators such as ourselves spend hours trying to track down. SMiaB gives administrators a "second opinion" on obscure problems.

SMiaB performs basic Linux administration tasks such as:

It can be run directly in a terminal window, called from other programs or installed as a web server CGI application.

SMiaB is based on expert system algorithms, giving it the capability to display implications. It not only identifies problems, but shows what software packages are affected and why.

Some of the packages SMiaB checks are Sendmail, INN, cnews, dnews, Samba, Apache, important security files, your kernel configuration and your Linux networking setup.

Additional checks can be added by installing plug-ins downloadable from our web site.
 

Installation

System Requirements


This program has the following hardware requirements:

There are versions of this program compiled for specific distributions. In general, your distribution should contain following packages: Optional Feature Requirements:

Running the Install Program

The PegaSoft web site has several versions of SMiaB available for downloading.  Select a suitable version for your distribution and unpack it using gunzip.

Installation is  done using the "install" script included in your archive. Simply type "./install" and follow the directions.  Once installation is complete, you can delete the downloaded file and the files you unpacked.

Note: Do not confuse the SMiaB install script with the Linux install command.

 SMiaB is installed into the following directories/files:

Note: If you have INN installed, do not confuse the sm command with the INN sm command.
 

Creating a KDE Icon

If you are using KDE, you can create an icon for SMiaB. If you create the icon in the KDE desktop's autostart folder, SMiaB will automatically run when you start KDE. (Remember that KDE also starts all applications that are open when you log off. If you leave the SMiaB window open and you have the SMiaB icon in the autostart folder, you'll get two copies of SMiaB running the next time you start KDE.

To create a KDE icon, right-click in the window or desktop you want the icon to appear and select New and Application. KDE will prompt you for a title for the icon--try SMiaB--and when you're finished, your new SMiaB icon will appear.

Right-click the new icon and select Properties. Choose the execute tab. Type in the following command into the Execute box to start xterm and run SMiaB:

/usr/X11/bin/xterm -fg white -bg black -fn 9x15 -e /sbin/sm

10x20, 7x13, 6x10 and 5x7 are other common font sizes. Click OK to make the changes take effect. You can now run SMiaB from your KDE icon.

If you want to change the size and position of the window, use the -geometry switch. For example, a geometry of 132x48+150+0 will run SMiaB in a window 132 characters wide and 48 characters high, and will position it 150 pixels from the left screen margin. You can read more about geometry settings on the X man page.


 

Quick Start

To use SMiaB immediately, do the following:

  1. Start the program by typing "/sbin/sm".
  2. Select "Config" in the main menu.
  3. Select the settings appropriate for your computer.
  4. Return to the main menu and select "Full Check" to check your computer
If you have problems running SMiaB, consult the Troubleshooting section below.
 

Performing Regular Checks Automatically

To perform regular system checks and have them emailed as an HTML document to the root login, install the following crontab command:

# Hourly Check - 5 minutes into each hour
5 * * * * sh -c "export PATH=\"/sbin:/usr/sbin:$PATH\" ; /sbin/sm -w 6 | mail -s SMiaB root"
# Dailly Check - 1:10 am, Monday to Friday
10 1 * * 1-5 sh -c "export PATH=\"/sbin:/usr/sbin:$PATH\" ; /sbin/sm -w 7 | mail -s SMiaB root"
# WeeklyCheck - 1:10 am Sunday
10 1 * * 0 sh -c "export PATH=\"/sbin:/usr/sbin:$PATH\" ; /sbin/sm -w 8 | mail -S SMiaB root"

Change this to make it suitable for your particular computer.  Not all distributions require the export statement.

You can, of course, run additional checks this way.  See the Non-Interactive section below for more information.  To run your own scripts during the hourly, daily or weekly checks, register your scripts in the Config window.
 

The Main Menu


As an administration tool, you should be logged in as root to run SMiaB. You can run SMiaB when you are not signed on as root, but many of the features are disabled.

If you are running a terminal emulation program such as a telnet client or X Window's xterm, resize the window to a convenient size before running SMiaB.

Run SMiaB by typing "/sbin/sm". After some initial messages, the SMiaB main menu will appear. You can select items using the arrow or tab keys, or by pressing the hilighted letter in the item. From the console or xterm, the alt key plus the hilighted letter will also work.

The bottom of the screen has a series of menus.

Plug-ins

This opens a window and displays a list of installed plug-ins detected by SMiaB.   SMiaB 1.0 comes with no plug-ins installed.

Info: this button shows detailed information about the selected plug-in.
Status: this button shows a status window, for those plug-ins that support it.

Computer

This opens a window and displays information about your computer.

Memory: The amount of free RAM memory, including swap space.
Core: The amount of free RAM memory, no swap space.
Root: The amount of space free on the root partition.
CPU: How busy the CPU is
Users: The number of people logged on.
Host: The current computer (as reported by the uname command).
OS: The operating system version (as reported by the uname command).
CPU Type: The CPU type (as reported by the proc filesystem).

Below this a list of who's on the computer (as reported by the finger command), or a summary of the mounted volumes (as reported by the df command). The information alternates each time the window is updated.

The lower box is a list of processes running on the computer (as reported by the ps command). In a wide window, more information is displayed.

There's a list of options along the bottom of the screen:

Close - return to the main menu

Logs - display a list of standard log files that you can browse. Files that aren't in your distribution or that SMiaB can't find are unselectable.

Process - display information about the currently selected process, including the name, state and command line with any parameters. The middle box shows the environment variables for the process. The lower box shows more detailed information as reported by the proc filesystem (use "man proc" for more information).


Hardware - brings up a submenu of information you can display about this computer's configuration. This information is taken from the /proc filesystem.

Use "man proc" for more detailed information about each of these windows.

Setup - runs your distributions' setup tool

Refresh - updates the information on the screen

If you don't press any keys, refresh will automatically be selected after a few seconds in order to update the display.

Preferences

The only preference is to turn off the blue background on colour displays.

Session

This opens a window and displays information about the current login session.

Login name: the name you signed on with
Primary Group ID: default group when creating files
Umask value: default file access bits
TTY: tty device you are running SMiaB on
Terminal Emulation: value of your TERM environment variable
Width: display width in characters
Height: display height in lines
Command Line: command you typed to run SMiaB. For example, "/sbin/sm".

The middle box contains a list of all environment variables

The lower box contains a list of all processes running under this login (as reported by the ps command). More information will be shown in a wider window.

Config

This opens a window for configuring SMiaB for the current computer.

At the top of the screen are a series of checkboxes. Turn on the boxes appropriate for your computer.

Multiuser Computer - check this if the computer will have more than one person logging in
Server Computer - check this if the computer is being used as a file server
Internet Computer - check this if the computer is also connected to the Internet with a mail server, web server, etc.
Dialup Networking - check this if your computer dials out to get an Internet connection
Secure Computer - check this if security is important

The distribution line contains the Linux distribution, as guessed automatically by SMiaB. If this is not right, you can change it using the change button.  A meta-distribution, such as Mandrake, will appear as the distribution it is based on-in this case, Red Hat.

The hourly/daily/weekly lines contain the locations of programs or shell scripts that you want automatically run whenever the hourly, daily or weekly system check is run. Unlike plug-ins which have specific design requirements, you can run anything you want here.
 

Saver

Starts the SMiaB screen saver, showing a CPU load graph and a kaleidoscope pattern alternately. When the screen saver is running, SMiaB releases non-essential resources and puts itself to sleep. Press any key to return to the main menu, but expect a delay as SMiaB wakes itself up.

About

This brings up the "About System Manager in a Box" window, displaying the credits and information about this release.
 

Quit

This shuts down the program and saves your configuration settings in the configuration file.
 

If you don't make a main menu selection, the screen saver is started after about 5 minutes.
 

Checking Your Computer

On the top of the main menu screen are a series of system checks you can run, numbered 1 to 8.

Full Check - runs a complete check of all packages known to the system manager.
Mail System Only - runs the mail system checks only
News System Only - runs the news system checks only
Web System Only - runs the web system checks only
Networking System Only - runs the network checks only
Hourly Check - runs the hourly system checks. SMiaB automatically checks for disk space shortages, backlogs in spool directories and certain failed daemons.
Daily Check - runs the daily system checks. SMiaB automatically checks for large system logs.
Weekly Check - runs the weekly system checks. SMiaB automatically runs regular Linux chores, including the updatedb command.

The first time you run a check, SMiaB displays a count of the number of checks it has performed in a status window. (On all future checks, SMiaB will display a bar graph as well.)

If there are no problem detected, SMiaB will simply display an "OK" message.

However, if there are problems, SMiaB will analyze the results and display them in a new window.

The tree display shows the results of SMiaB's analysis of your system. The top item in the tree is the result of the check you ran. For example, if you ran the full system check, you might see "The full check had problems". The indented items below it show which subsystems the check found problems with. You can press return on any item marked with a "|+>" to expand that item for more information. Items marked with a "|->" can be closed to hide details.

More options are at the bottom of the screen.

Close - closes the problem window and returns to the main menu
Copy To Notepad - copies to displayed information to the notepad accessory (see below)
Expand All - expands all the branches in the tree display, showing all the details.
Collapse All - returns the display to the way it was when the window was first opened
Find - searches the displayed problems for a word or phrase. The search is case sensitive.
Next - searches for the next occurrence of the word or phrase.
 

The Accessories Window

Pressing the ESC key (or F1 if your emulation supports function keys) opens the accessories window. There are two accessories:

Installing Plug-ins


Plug-ins are installed beneath the /var/lib/smiab/plug-ins directory. Plug-ins to be run should be installed under a subdirectory of the check number in the main menu. For example, all plug-ins in /var/lib/smiab1/plug-ins/1/ will be run whenever a full check is run. All plug-ins should have execute permission set (with chmod command).
 

Non-Interactive Options


SMiaB can be run from the command line. Using SMiaB non-interactively requires the user to be  logged in as root.

sm -h or sm --help displays the command line summary.

sm -q invokes SMiaB quietly...that is, it performs a query and returns an exit value of zero if there are no problems or a non-zero value if there were problems. For example,

   sm -q 1 && echo "Good"

will quietly run a full check (main menu item 1) and display "Good" if there were no problems.

sm -w returns the results of the query as a web page on standard output. The results can be redirected to other programs. For example,

   sm -w 6 | mail -s SMiaB root

will run an hourly check and mail the results (as a web page) to root, suitable for reading using a web-aware email program such as Netscape.

You can call SMiaB via a web server CGI if you install it in your server's cgi-bin directory. SMiaB detects a CGI call by checking the environment variables. SMiaB expects a CGI variable called "Query" which is assigned the number of the main menu check that you want to execute.

Here is a simple web page that runs a full system check:

   <HTML>
   <HEAD>
   <TITLE>System Manager in a Box</TITLE>
   </HEAD>
   <BODY BGCOLOR="white">

     <FONT COLOR="blue">
     <h1> System Manager in a Box </h1>

     Press button to run a full system check.<p>
     </FONT>

     <FORM METHOD="POST" ACTION="http://yourhost/your-cgi-bin/sm">
     <INPUT TYPE="Hidden" NAME="Query" VALUE="1">
     <INPUT TYPE="Submit" NAME="Submit" Value="Run SMiaB">
     </FORM>
   </BODY>
   </HTML>
 

The smiab Directory

If you create a smiab directory in your home directory, SMiaB can play sounds, run keyboard macros and give you a session log.
 

Adding Sounds


If you have Warren Gay's wavplay program installed, the system manager will play sounds. You can get wavplay from Metalab ( http://metalab.unc.edu/ ). Create a file called play_sound (for example, using touch play_sound) in the smiab directory. Then place in the directory wavs files for SMiaB to play. Name the files in upper case according to their purpose:

The chimes don't play while the screen saver is running.
 

Keyboard Macros

A keyboard macro is a shortcut for an often repeated series of keystrokes. To use keyboard macros, create a text file in your smiab directory called "macro_file". At the beginning of a line, type the letter to be used as the shortcut, followed by the letters it represents. The macro must fit on a single line.

For example, to create a keyboard macro for "Omnitech Systems Inc.", add this line to your macro file:

oOmnitech Systems Inc.

To use a macro, type control-a (or F2 if your emulation supports function keys) followed by the shortcut letter. In this example, typing control-a and "o" causes "Omnitech Systems Inc." to be entered as if you typed that message on your keyboard.

The macros are loaded on startup. If SMiaB is running, you'll have to restart it for the macros to take effect.
 

The Session Log

If the system manager detects a smiab directory, it automatically creates a file called "session_log". This file contains a history of the program's activities and system errors encountered. The log is cleared each time SMiaB is restarted.
 

Writing Plug-ins

A plug-in is a shell script or an executable program that responds to certain predefined command line options:

-v - displays a one line description of your plug-in
-V - display a multiple line description of your plug-in. This is used in SMiaB's plug-in window.
-p - returns the minimum version number of SMiaB required to use this plug-in. e.g. "0.9.1b" for the beta.

When your plug-in is executed with no parameters, it should perform whatever checks it's supposed to do. If there are no errors, it should return an exit status of zero. If there were errors, it should return an exit status of 1 and write a description of the errors to standard output. SMiaB will add the text to it's problem window.

If you aren't familiar with command line programming, there is a sample bash script plug-in /var/lib/smiab/plugin.sh which you can uses as a basis for writing your own plug-ins.

This version of SMiaB introduces a new plug-in format, "1.0".  The new version provides plug-ins with information via environment variables and requires the plug-in to display a pop-up status window.  Details are available from our web site.
 

The User Interface

Window Quick Reference:


Most of the objects on the screen should be easily understood, the majority designed after their GUI counterparts. Here is a list:

< > Text - A button. Press Return to activate. Type the hilighted letter to go immediately to this button.
| > Text - An menu button. Enter Return to activate. Type the hilighted letter to immediately activate.
( ) Text - A radio button. Press Return to select this item and deselect the previous item in the group.
[ ] Text - A check box. Press Return to switch on or off.
-----#------- - A scroll bar.
-----50%----- - A thermometer graph.

Buttons with hyphens in them are not selectable.
 

Basic Keyboard Shortcuts:


Movement Keys

Up/Down Arrow - move up or down to the next menu item

Left/Right Arrows - move left or right to the next menu item Page Up (or Control-P) - move up one page in a list Page Down (or Control-N) - move down one page in a list Home Key (or Control-Y) - move to the top of a list End Key (or Control-E) - move to the bottom of a list Tab Key - move to the next item in the window

Control-T - move to the previous item in the window

Return Key (or Spacebar) - activate a button

When inside of a list box, the movement keys move you around the list. If you are on the Linux console, pressing alt and the hilighted letter will always jump to the appropriate object, even if you're inside a list box or the notepad.

Editing Keys

Control-X - clear text

Control-B - copy text Control-V - paste text Misc. Keys

ESC Key (or F1) - bring up the accessories menu

Control-L - redraw the screen

Control-A (or F2) - execute a keyboard macro
 
 
 

Troubleshooting


When I type "/sbin/sm", most of the main menu items are unselectable.

SMiaB must be run from the root login.
 


When I type "/sbin/sm", it gives a warning about a missing configuration file.

SMiaB will warn you, the first time you run it, that there is no configuration file. The file will be created when you quit SMiaB.
 


When I type "/sbin/sm", SMiaB gives me an message about being unable to find my terminal type.

This is a ncurses message indicating that there is a problem starting ncurses.
 
 

When I type "/sbin/sm", SMiaB gives me an message about being unable to find ncurses.so.

This is a Linux message indicating that it can't find the ncurses package. In particular, Caldera 2.2 has ncurses installed but is missing a symbolic link to the library: change directory to /lib and create a symbolic link (using ln -s) between the libncurses.so... file to libncurses.so, and type ldconfig to register the change.
 

When I run the "other" version of "sm", the SMiaB display has a red background.

The ncurses package is not upward compatible: in particular, ncurses 3.0 is incompatible with ncurses 4.0. When you are running a different version of ncurses, the screen is drawn in red instead of blue because the colours are defined differently in your version of ncurses.
 

When I type "/sbin/sm", SMiaB reports that my display is too narrow.

SMiaB requires a minimum display size of 80 character by 24 lines.
 

When I type "/sbin/sm", SMiaB background pattern doesn't fill the entire window.

SMiaB has a maximum display size of 132 characters by 80 lines. A display bigger than this will have unused space at the right and bottom.
 

When I type "/sbin/sm", the main menu appears but the display is full of strange characters.

There are a number of possible reasons for this:

Be assured that we have tested SMiaB under everything from a genuine DEC vt100 terminal to a 1024x768 SVGA xterm window without problems.
 

Why does SMiaB complain when /sbin files are world readable and executable?

Most Linux distributions ignore the world access bits on files in safe bin directories because sbin isn't open to general access. If you select "Secure Computer", SMiaB requires safe bin files to be not to be world executable as extra protection in case the sbin directory access bits are inadvertently altered.
 

When I run SMiaB as a CGI program, it says that it should be "setuid root".

SMiaB is a system administration tool and requires root privilege to run. Make sure the sm binary is owned by root, and use "chmod +s" to make the binary run with root privilege.
 
 

Credits


Produced by PegaSoft Canada.
 

Project Leader

Ken O. Burtch

Project Team

Ken O. Burtch
Dan Braun

Associate Programmers

Warren W. Gay
Chris Hindy

Special Thanks

David A. Wheeler for his CGI library