XEROX SERVERSTATUS 2 4 1 SERVERSTATUS 1 4 By: Ralph D. Hill (Ralph@Toronto.CSNET) INTRODUCTION Server status is a simple package that periodically tests to see if servers are up, and reports status information to the user. The package also allows programs to enquire about the status of a server. The user supplies a list of server specifications. Each server specification consists of the name of the server (or something that CANONICAL.HOSTNAME recognizes as the name of a server), and a function (possibly NIL) to be called when the status of the server changes. This function is called with two arguments: the name of the server, and a status indicator that is either Up or Down depending on the current status of the server. The function(s) are called only after all servers have been tested (so that they can enquire about the current status of other servers). Server status informs the user (in the prompt window) whenever the status of a server changes. Also, on D'lions, an appropriate sound is made (where appropriate is loosely defined). If the user selects "INFO" in the process status window when the Server Status process is selected, a window will be created. This window shows the current status of the servers. It is updated only when the status of a server changes, the user buttons in the window, or "INFO" is selected again. Thus, it can be buried, and will only re-appear when asked for or when it changes. Status information is also available programatically. The function "ServerStatusGetServerStatus" is passed a single server name (or something that CANONICAL.HOSTNAME recognizes as the name of a server) as an argument. It will return the status of that server, or NIL if the name is not recognized as a server. USAGE First set Server.Status.Test.Spec to a list of server specifications, then load serverstatus.dcom from your LISPUSERS directory. Server status will start automatically. (If Server.Status.Test.Spec is null when serverstatus is loaded, a very simple default will be used). A server specification is a list consisting of the name of a server (or something that CANONICAL.HOSTNAME recognizes as the name of a server) and a function to call when the status of the server changes (or NIL). In the following example, three servers are listed. The first (phylum) has no associated function. The last two use the same function, "PrinterStatusChangeFn," to change the default printing host. (SETQ Server.Status.Test.Spec ( (phylum NIL) (quake PrinterStatusChangeFn) (pentelPS: PrinterStatusChangeFn)) For the above, the definition of PrinterStatusChangeFn could be (this function ignores the arguments, and directly queries the states of the servers): [LAMBDA (serverName newStatus) (COND ((EQUAL (ServerStatusGetServerStatus 'quake) 'Up) (SETQ DEFAULTPRINTINGHOST '(Quake))) ((EQUAL (ServerStatusGetServerStatus 'pentelPS:) 'Up) (SETQ DEFAULTPRINTINGHOST '(PentelPS:))) (T (printout PROMPTWINDOW T "No printers!!" T)))] If you wish to change the list of servers being checked (or one of the functions), call ServerStatusTesterStart on the new list of server specifications, or use the middle button menu (see Window Operations, below). If ServerStatusTesterStart is called with no arguments, it uses the current value of Server.Status.Test.Spec. The variable Server.Status.Delay is the delay, in minutes, between successive tests. It defaults to 5, but can be changed at any time by either setting it directly, or using the middle button menu (see Window Operations, below). The variable Server.Status.Title.Font specifies the font to be used in the title of the server status window. It defaults to (GACHA 10 MRR). It may be changed at any time. Server.Status.Test.Spec, Server.Status.Delay and Server.Status.Title.Font may be set in the user's init file. WINDOW OPERATIONS The server status window is initially created and positioned by selecting INFO in the process status window with the server status process selected. It may be closed at anytime and later reopened by selecting INFO again. There is no need to have the window open. It will not be automatically openned. Selecting INFO when the window is opened is equivalent to depressing the left button in the server status window. Depressing the left button in the server status window causes the window to be repainted with the current status information, flashes the window, and announces, in the prompt window, when the servers were last checked, and when they will be checked next. Note that if this is done while the servers are being checked, the status reported in the window may reflect changes in the status that have not been reported in the prompt window. This is because the changes in status are reported in the prompt window only after all servers have been checked. Checking all the servers can take several minutes. Depressing the middle button in the status window brings up a menu of three items. These are: Restart - restart the status checker on a new server specification. It is assumed that the user has changed the value of Server.Status.Test.Spec. If the number of servers being tested has changed, the user will probably have to reshape the window. Run NOW - causes server status to check the servers now (instead of waiting for the end of the current interval). Change Frequency - allows the user to change the frequency of checking the servers. This resets Server.Status.Delay. This also starts an immediate check of the servers. METHOD The status of pup servers is checked by bouncing packets off of them with PUP.ECHOUSER. If the server is up this does not take long. If the server is down, or very busy, the elapsed time can be 30 seconds. If this test reports that the server is down, PRINTERSTATUS is tried on the assumption that the server is a printer, and is not echoing. NS servers are check by attempting to open an RPC connection to them. Again, this can be very fast if the server is up, but takes 30 seconds or more if the server is down. Thus, if there are a lot of servers that are down, server status can take a long time to work through a cycle. The algorithm is used is basically: check all the servers; report all changes in the prompt window; execute any user supplied functions; update the server status window (if it is open and there are changes to report); sleep for Server.Status.Delay minutes or until the user selects any of the middle button functions. BUGS The sound effects are poor. It sometimes thinks a server is down when it is merely sick or slow. Useful Extensions The following extensions are left as exercises for others: 1) When server status is loaded, Server.Status.Test.Spec should default to the servers found in DEFAULTPRINTINGHOST and LISPUSERSDIRECTORIES. 2) As an extention to the above, functions could automatically be created to ensure that the CAR of DEFAULTPRINTINGHOST is always a working printer. (E.g., it simply rearranges printers in the list, or knows about nearby printers). Better, ensure that the first printer of each type is working. 3) There should be function for adding entries to and deleting entries from, the the list of server specifications being used. E.g., (ServerStatusAddServer '(newServer someFunction)) and (ServerStatusDeleteServer 'someServer). 4) The ServerStatusGetServerStatus function should take an optional argument that says to check the status of the server, instead of simply looking up the status as of the last check. For consistency, if the status changed the user supplied function should be called. 5) A mechanism should be provided so that if the user always wants the status window in a particular place, it can be placed there automatically during initialization. 6) There is probably lots of useful information it could keep that would help users, for example, how long a server has been down, and how many times it has been down in the last week. 7) The servers should be classified as to type of service (printer, files) at the beginning, so that a more elegant (and efficient) status testing algorithm may be used. 8) The checking should be done in parallel, with one process per server. This would greatly reduce the elapsed time to test all the servers. It also makes it easy to add many other features. 9) A shrink function should be provided. A suitable icon would be a "thumbs up" if all servers are functioning. "Thumbs down" if they are not. 10) (Hard). Whenever a server is down, the time at which it will come up should be reported. Similarly, for servers that are up, the time at which they will go down should be available (:-). (LIST ((PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC ) STARTINGPAGE# 1) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC )) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC )) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC )) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC )) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC )) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))))) + 3( ((8(8D PAGEHEADING RUNNINGHEAD(+3+3730`TERMINAL MODERNMODERN MODERN MODERN MODERNLOGOGACHA   HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN   HRULE.GETFNMODERN  HRULE.GETFNMODERN ) =78!   %  : ( 9 , 4Gn\^kw>c;)   !z