W A T C H D O G This directory contains the WATCHDOG program. The original was taken from a DECUS tape (unknown authors) and was rewritten. The purpose of this program is to monitor interactive processes and log processes off that have been inactive for a specified period of time. A interactive process is a process that is attached to a terminal. The process can be network process, a spawned process, or an interactive process. WATCHDOG does not care as long as it is connected to a terminal. A command file is included to build the program called WATCHDOG.BLD. To build WATCHDOG type the following command : $ @WATCHDOG.BLD (Then answer the questions as they appear.) To start WATCHDOG you may use WATCHDOG.COM command file. This command file should be modified to reflect your desired options and default values. The following command should be added to your computer's startup command file SYS$MANAGER:SYSTARTUP.COM: $ @SYS_UTILITY:WATCHDOG.COM The following privileges are required to run WATCHDOG CMKRNL - may change mode to kernel SYSNAM - may insert in system logical name table DETACH - may create detached processes PSWAPM - may change process swap mode TMPMBX - may create temporary mailbox WORLD - may affect other processes in the world OPER - operator privilege There are several logical names needed to run to WATCHDOG which are explained below. WATCHDOG_OPER_FLAG - Specifics which operator terminal types are to receive WATCHDOG operator messages. The $OPCDEF macro defines symbolic names for the operator terminal types. The bit encoded vector is constructed by specifying the desired symbolic names in a logical OR operation. The list of the symbolic names and their functions are given below for each operator terminal type. Symbols are setup in the WATCHDOG.COM so symbol name need just be logically OR together. Typical value is OPC$M_NM_CENTRL. OPC$M_NM_CENTRL - Central Operator OPC$M_NM_PRINT - Printer Operator OPC$M_NM_TAPES - Tape Operator OPC$M_NM_DISKS - Disk Operator OPC$M_NM_DEVICE - Device Status Information OPC$M_NM_CARDS - Card Device Operator OPC$M_NM_NTWORK - Network Operator OPC$M_NM_CLUSTER - VAXcluster Operator OPC$M_NM_SECURITY - Security Operator OPC$M_NM_OPER1 - System Manager Defined Operator Function OPC$M_NM_OPER2 - System Manager Defined Operator Function OPC$M_NM_OPER3 - System Manager Defined Operator Function OPC$M_NM_OPER4 - System Manager Defined Operator Function OPC$M_NM_OPER5 - System Manager Defined Operator Function OPC$M_NM_OPER6 - System Manager Defined Operator Function OPC$M_NM_OPER7 - System Manager Defined Operator Function OPC$M_NM_OPER8 - System Manager Defined Operator Function OPC$M_NM_OPER9 - System Manager Defined Operator Function OPC$M_NM_OPER10 - System Manager Defined Operator Function OPC$M_NM_OPER11 - System Manager Defined Operator Function OPC$M_NM_OPER12 - System Manager Defined Operator Function WATCHDOG_INTERVAL - Defines the Interval that WATCHDOG should wake up and look for idle processes. This value must be specified in whole minutes. A typical value is 5 minutes ("0 00:05:00.00"). WATCHDOG_START_MSG - Defines the system wide default at which time WATCHDOG will start taking idle action and at every interval after that until the process it no long idle or the process is stopped. WATCHDOG_START_MSG value should be a whole number greater than 0. A value of 0 means bypass any idle action. A value greater than 0 means start taking idle action at the specified value (WATCHDOG_START_MSG) multiplied by the wake up interval (WATCHDOG_INTERVAL). A typical value is 3, which means if the WATCHDOG_INTERVAL is set to 5 minutes that WATCHDOG will begin warning idle processes starting at at 15 minutes and every interval after that until the user is logged off or until CPU time or buffer I/O is done by the process. WATCHDOG_STOP_PROC - Defines the system wide default at which time WATCHDOG should perform the stop action on idle processes. WATCHDOG_STOP_PROC value should be a whole number greater than 0. A value of 0 means do not stop action. A value greater than 0 means take stop action at specified value (WATCHDOG_STOP_PROC) multiplied by the wake up interval (WATCHDOG_INTERVAL). A typical value is 6, which means if WATCHDOG_INTERVAL is set to 5 minutes then WATCHDOG will take stop action on users that have been idle for 30 minutes. Before continuing lets understand terms: option flags - Are single bit flags to enable or disable special options. These options are explained with the logical name they are associated with set/cleared in. idle action - The action WATCHDOG take when a process is idle. The default idle actions that WATCHDOG takes are listed below. stop action - The action WATCHDOG take when a process is stop. The default stop actions that WATCHDOG takes are listed below. Watchdog Default Actions: 1. Put Header Messages on Warning and Stop Messages to the User. 2. Do Not Notify Operator When Idle Action is Taken on User. 3. Do Not Notify Operator When Stop Action is Taken on User. 4. Tell User Idle Action is Taken. 5. Tell User Stop Action is Taken. 6. Do Not Log in Log File When Idle Action is Taken. 7. Do Not Log in Log File When User Action is Taken. 8. Attempt to Disconnect User If Possible on Stop Action WATCHDOG_FLAGS - Defines the system wide default option flags for users. Specifics which options will be on by default when WATCHDOG is running. The USERDEF macro from WATCHDEF.MLB defines symbolic names for flag. The bit encoded vector is constructed by specifying the desired symbolic names in a logical OR operation. The list of the symbolic names and the function are given below. Symbols are setup in the WATCHDOG.COM procedure so symbol names can be logically ORed together. Typical value is 0. $ FLAGS = USER_M_NO_DISCONNECTIONS .or. USER_M_NOTIFY_OPER_LOGOFF $ DEFINE/SYSTEM/NOLOG WATCHDOG_FLAGS "''FLAGS'" USER_M_NO_OPER_TIMESTAMP 1 ! No Operator Timestamp USER_M_NO_HEADER_MSG 2 ! No Header Message on Terminal USER_M_NOTIFY_OPER_WARNING 4 ! Notify Operator When Warning User USER_M_NOTIFY_OPER_LOGOFF 8 ! Notify Operator When Logoff User USER_M_NO_NOTIFY_USER_WARNING 16 ! No User Warning Message USER_M_NO_NOTIFY_USER_LOGOFF 32 ! No User Logoff Message USER_M_LOG_WARNING 64 ! Log File Message When Warning User ! (The Above Option is Not ! Yet Implemented) USER_M_LOG_LOGOFF 128 ! Log File Message When Logoff User ! (The Above Option is Not ! Yet Implemented) USER_M_NO_DISCONNECTIONS 256 ! Not Disconnect User USER_M_FORCEX 512 ! Use Forcex Before Logging Off User WATCHDOG_FORCEX - Defines the system wide decimal value to be issued by $FORCEX system service before the users to be logged off (only applied if the FORCEX flag is set in their options. A typical value is 268444028 or %X10002172 which is SS$_FORCEDEXIT (8572 dec or 2172 hex) logically ORed with STS$M_INHIB_MSG (268435456 dec or 10000000 hex) to suppress an extra message when force exiting a process. WATCHDOG_TIMESTAMP - Defines the frequency timestamp messages (Optional) should be send to the operator. If the flag USER_M_NO_OPER_TIMESTAMP is set in system default options then no logical name need be defined. WATCHDOG_EXCEPTION_FILE (Must be Comment Out If Not Used) - Defines file containing the exceptions to override the default start message, stop process, and option values. Exceptions record format is as follows : recordtype entity [{startmsg!DEFAULT} [{stopproc!DEFAULT} [{flags}]]] where recordtype -> ACCOUNT - Account Name !USERNAME - User Name !PROCESS - Process Name !TERMINAL - Terminal !IDENTIFIER - Rights Identifier or UIC where entity -> A fixed or single wildcard string or a fixed or wildcard identifier/UIC value or named the process may own or hold. where startmsg -> See definition logical WATCHDOG_START_MSG. This value overrides the logical's value. If the logical's value is desired use the keyword "DEFAULT". where stopproc -> See definition logical WATCHDOG_STOP_PROC. This value overrides the logical's value. If the logical's value is desired use the keyword "DEFAULT". where flags -> See definition logical WATCHDOG_FLAGS. With the exception instead of default of 0 the default is value of WATCHDOG_FLAGS. Example of Exception Records : ACCOUNT BOSS ! Never Logoff User With The Account ! Name. ACCOUNT USER 5 ! Warn these Accounts starting at the ! 5th idle Interval But Never Log ! Them Off. ACCOUNT SYS* 2 10 ! Warn any Account Name starting ! with "SYS" at 2nd idle Interval ! and log them out at 10th idle ! Interval. ACCOUNT DB*USER DEFAULT 7 512 ! Warn any Account Name starting ! with "DB" and ending with "USER" ! at the system wide default interval ! and log then out at the 7th idle ! interval. There options flag ! says they should be logged off ! first by trying a disconnect, if ! that does not work then by using ! FORCEX assuming the default flags ! do specify NO_DISCONNECTIONS. ACCOUNT *TST DEFAULT DEFAULT 12 ! Any Account Name Ending with "TST" ! should be send warning messages ! and logged out using the system ! wide startmsg and stopproc ! defaults. The Options Flag ! Instructs Watchdog to Notify ! the Operator when a user is ! send a Warning Message ! or a Log out Message. ! ! Same Type of Syntax May be used for All Other Record Types ! Except for entity specification for Terminal, Identifier. ! ! Terminal Must Been with One significant Letter and End with ! a colon TERMINAL OP*: ! Never Log Any One off of Consoles ! ! Identifier Entities May be Expressed in the Following Syntax ! [n,m] ! [name1,name2] ! [name] ! name ! %Xhex-value ! (any above of number or name may also be *) ! IDENTIFIER [1,4] ! Never Logoff Any One holding this ! Identifier IDENTIFIER <1,*> ! Never Logoff Any One holding this ! Identifier IDENTIFIER [SYSTEM,MANAGER] ! Never Logoff Any One holding this ! Identifier IDENTIFIER [MANAGER] ! Never Logoff Any One holding this ! Identifier IDENTIFIER MANAGER ! Never Logoff Any One holding this ! Identifier Any further improvements/wishlist can be made to the author below. Finally note if Watchdog does disappear, messages are usually displayed on the console and a file WATCHDOG.DMP is created. Or if your system crashes due to Watchdog the system dump will in SYSDUMP.DMP. Save theses files and contact the author below if you want further a correction made. George H. Walrod III 8150 Lakecrest Drive #402 Greenbelt, MD 20770 (301)474-2971