From:	SMTP%"turion@research.ptt.nl" 23-MAR-1994 08:42:29.91
To:	EVERHART
CC:	
Subj:	part 11 status tool

X-Newsgroups: comp.os.vms
From: turion_s@dnlts0research.ptt.nl. (Paul Turion)
Subject: part 11 status tool
Message-Id: <1994Mar21.144655.1814@news.research.ptt.nl>
Sender: turion_s@research.ptt.nl (Paul Turion)
Nntp-Posting-Host: dnlts0.research.ptt.nl
Reply-To: turion@research.ptt.nl
Organization: PTT Research
X-Newsreader: mxrn 6.18-4
Date: Mon, 21 Mar 1994 14:46:55 GMT
Lines: 451
To: Info-VAX@CRVAX.SRI.COM
X-Gateway-Source-Info: USENET


-- 
 ------- --------------------  			Paul Turion 
| p t t |  r e s e a r c h   |			The Netherlands
|      _|                    | 			e-mail address
|    _|_|   .  .  .  .  .    |			P.Turion@research.ptt.nl
|___|_|      
My interest is in the future because
I am going to spend the rest of my life there.
-+-+-+-+-+-+-+-+ START OF PART 11 -+-+-+-+-+-+-+-+
X!*      Using this technique, one could set up various combinations of *
X!*      nodes to be search, i.e. One for your cluster, you local network, *
X!*      specific work nodes, etc. *
X!***************************************************************************
V****
$ CALL UNPACK WHAT.CLD;1 689459345
$ create/nolog 'f'
X                              WHAT
X
X   A FAST Cluster and network-wide SHOW USERS (and Much more) type command.
X
X        Authors:
X
X        Pete Portante, (most of the work)
X        Andrew W. Potter
X        David Mulvihill
X        Rochester Institute of Technology
X
X        Distributed and supported by:
X
X        Andrew W. Potter
X        Systems Programmer
X        Information Systems and Computing
X        Rochester Institute of Technology
X        Rochester NY, 14623  PH (716) 475-6994
X        Email:    awpsys@ritvax.BITNET
X                  awp8101@ritcv.UUCP
X
XWHAT is a very fast utility that uses DECnet non-transparent communications
Xto produce three different displays.
X
X        WHAT is distributed in Source (PASCAL, VAX C and MACRO 32 needed),
X        object and executable form.  WHAT must be relinked to run under
X        VMS V5 Executables are in the subdirectory `091.V5`093.
X
X        Relinking:
X
X        WHAT may be relinked to run under V5 by setting default to
X        the `091.source`093 directory and typing:
X
X                $ @BUILD_WHAT LINK
X
X
X        Features:
X
X        $ WHAT
X           Produces a SHOW USERS like display of users on this system
X
X        $ WHAT/NODE=(node1`091,node2...`093)
X
X          Same as above except it generates the display from all of the
X          specified systems
X
X
X           /FULL Generates a full display of (somewhat like Unix FINGER)
X
X           /ALL  Lists ALL processes (only for use with /FULL)
X
X           /USER=(user1,`091user2,...`093)
X               Qualifies the list to only report on the specified users.
X               /USER can also translate the logical name WHAT_USER_list
X               for a list of preferred users.  See Help WHAT
X
X           /OUTPUT=filename  Redirects output from SYS$OUTPUT
X
X           /SILENT   Directs what to not report an error of failure
X                     to connect to a remote node.
X
X           /NOHEADER Eliminates the header line.
X           And more
X
X        $ WHAT/NODE=(node1`091,node2...`093)/STATUS
X
X          Prints a one line status line for each system
X
X        The above command can be qualified with the following qualifiers
X
X           /OUTPUT=filename  Redirects output from SYS$OUTPUT
X
X           /SILENT   Directs what to not report an error of failure
X                     to connect to a remote node.
X
X           /TOTAL   Generates a total line for the systems reported
X
X        As an alternative to /NODE=(list) users can set up
X        logical names to list preferred groups of nodes that run WHAT
X        for use with the /SELECT qualifier
X
X        EG.
X
X        $ define WHAT_CLUSTER FOO,BAR,ZOT
X
X        $ what/select=cluster `091/any other what qualifiers`093
X
X        Will give the same result as
X          WHAT/NODE=(FOO,BAR,ZOT)
X
X
X        WHAT uses some of the following techniques for speed.
X
X        1) Looks at process state BEFORE calling $getjpi to retrieve
X           information in P1 space.  This allows WHAT to NOT request
X           that information if doing so would require a inswap.
X
X        2) Does NOT use DECnet to retrieve information from the local
X           node.  For example assume the user is logged on to
X           LARRY and he issues the command:
X                $ WHAT/NODE=(CURLY,LARRY,MOE)
X           What would connect to the non-transparent object only to
X           retrieve the info from CURLY and MOE.
X
X        3) Sends the qualifying information (/USER=userlist) to the
X           remote node for remote subsetting.  This prevents having
X           to transmit over the net large data buffers of ALL users
X           just to filter it all out locally.
X
X
X                        Installation:
X
X
X        NOTE:  If you wish you may perform the complete installation with
X               INSTALL.COM.
X
X        1)Create a WORLD executable directory somewhere.  (Assume
X          Sys$sysdevice:)
X
X                $ CREATE/DIR/prot=w:e/own=system -
X                        sys$sysdevice:`091net_what`093
X
X        2) Define an exec mode logical name to point to that directory
X
X                $ define/sys/exec WHAT_DIR sys$sysdevice:`091what_dir`093
X
X        3) Copy all the files in this directory to WHAT_DIR:
X
X        4) Modify if desired the logical names in WHAT_DIR:WHATLOG
X           to define site specific node groups for WHAT/SELECT
X
X        5) Apply the CLD WHAT_DIR:WHAT.CLD to the system dcltables.
X
X           SET COMMAND/TABLES=SYS$COMMON:`091SYSLIB`093DCLTABLES -
X                      /OUTPUT=SYS$COMMON:`091SYSLIB`093DCLTABLES -
X                      WHAT_DIR:WHAT.CLD
X
X           Use install to replace the DCLTABLES (need about 300 GBLPAGES fre
Ve)
X
X           $ INSTALL == "$INSTALL/COMMAND"
X           $ INSTALL REPLACE SYS$LIBRARY:DCLTABLES
X
X           (Or you put the command SET COMMAND WHAT_DIR:WHAT.CLD in
X           the users login.com files...Slow...Ugh)
X
X        6) Apply the file WHAT_DIR:WHAT.HLP to your favorite help library.
X
X           $ LIBRARY/HELP SYS$HELP:HELPLIB WHAT_DIR:WHAT.HLP
X
X        7) Add to your site specific startup command file
X           SYS$MANAGER:SYSTARTUP.COM the following lines:
X
X                $ DEFINE/SYS/EXEC WHAT_DIR sys$sysdevice:`091net_what`093
X                $ @what_dir:start_what
X
X        8) Start WHAT with the command @WHAT_DIR:START_WHAT
X
X        Note:   All cluster members CAN run WHAT from the same directory
X
X        Now go do the same thing on all other systems with reach to
X        make it a useful network wide utility
X
X=========================================================================
$ CALL UNPACK WHAT.DOC;1 1616111945
$ create/nolog 'f'
X1 -WHAT
X WHAT
X
X Invokes the WHAT utility to report user information on one or
X more VMS systems in the network.  WHAT with no qualifiers produces
X a "SHOW USERS" like display of users on the current system.
X
X WHAT is an RIT (Rochester Institute of Technology) developed utility
X
X2 Qualifiers
X
X/ALL
X
X /ALL
X
X Directs WHAT to include system processes in the display.  This
X qualifier generates the same display format as /FULL. This qualifier
X is ignored unless it is specified with /FULL.
X
X/BRIEF
X
X /BRIEF (Default)
X
X Directs WHAT to produce a SHOW USERS like display.  This is the
X default action for WHAT.
X
X/FULL
X
X /FULL
X
X Directs WHAT to expand the /BRIEF to provide a more detailed list of
X user processes on the specified node(s)
X
X/HEADER
X
X /HEADER (Default)
X /NOHEADER
X
X  Specifies whether or not a header line precedes the report
X/USERNAME
X
X /USERNAME=string
X
X  1) Directs WHAT to subset the report generated by /BRIEF, /FULL and
X     /FULL/ALL to include only those processes that belong to a
X     username beginning with "string".
X
X  2) If the user has defined a logical name "WHAT_USER_string" then WHAT
X     will translate this logical name for a list of users to use in the
X     subset operation.  Logical Names may have up to 127 translations.
X/STATUS
X
X /STATUS
X
X  Directs WHAT to produce a one line system status report for each of
X  the specified nodes.
X
X/SILENT
X
X /SILENT
X /NOSILENT (Default)
X
X  Directs WHAT to not display the VMS error messages that are caused
X  by inability to connect to any remote nodes.
X
X/TOTAL
X
X /TOTAL
X
X Directs WHAT to report a total line of Processes, Users and Batch
X jobs. This qualifier applies only to the /STATUS qualifier.
X
X/OUTPUT
X
X /OUTPUT=filename
X
X  Redirects the report from WHAT to the specified filename.  The filename
X  is required when /OUTPUT is specified.
X/NODE
X
X /N0DE=(NODE`091,...`093)
X
X  Specifies one or more nodes for WHAT to query. Do NOT specify
X  the nodename with two colons "::"
X/SELECT
X
X /SELECT=xxxxx
X
X  Directs WHAT to translate the logical name WHAT_xxxxx for the list
X  of nodes to translate.  There are a set of default node groups defined
X  on the system.  These may be determined by the DCL command:
X
X        $ SHOW LOGICAL/SYSTEM WHAT_*
X
X  You may define your own groups of interest as follows:
X
X        $ DEFINE WHAT_ME VAXA,VAXB,VAXC
X
X  The command WHAT/SELECT=ME  will report on the nodes VAXA, VAXB and
X  VAXC.
X
X2 Examples
X
X 1)   $ WHAT/SELECT=RITVAX
X
X        Generates a SHOW USERS like display of all users logged in to
X        the RITVAX VAXcluster.
X
X
X 2)   $ WHAT/NODE=(VAXA,VAXB,VAXIMG)
X
X        Generates a SHOW USERS like display of all users logged in to
X        The nodes VAXA, VAXB and VAXIMG
X
X 3)   $ WHAT/SELECT=RITVAX/STATUS
X
X        Generates a report of system utilization on all systems in
X        the RITVAX cluster
X
X 4)   $ WHAT/FULL/SELECT=RITVAX/USER=BE
X
X        Generates a full users report for all users who have a username
X        beginning with the string "BE"
X
X 5)    Logical Lists
X
X       You may define a list of users for use in the /USER subsetting
X       operations as a list as follows.
X
X        $ define WHAT_USER_MYLIST -
X           ABC1234,-
X           BCDICS, -
X           999DEPT,-
X           JKL9876
X
X        $ WHAT/SELECT=RITVAX/USER=MYLIST
X
X         Causes WHAT to look for specified users in WHAT_USER_MYLIST
X         on RITVAX
X
X2 Authors
X
X        Pete Portante, (most of the work)
X
X        Andrew W. Potter
X        David Mulvihill
X        Rochester Institute of Technology
X
X        Distributed and supported by:
X
X        Andrew W. Potter
X        Systems Programmer
X        Information Systems and Computing
X        Rochester Institute of Technology
X        Rochester NY, 14623  PH (716) 475-6994
X        Email:    awpsys@ritvax.BITNET
X                  awp8101@ritcv.UUCP
X
X        Any Questions please send Electronic Mail
$ CALL UNPACK WHAT.HLP;2 1365657453
$ create/nolog 'f'
Xsys$system:sys.stb/sel
$ CALL UNPACK WHAT.OPT;1 591101241
$ create/nolog 'f'
X`091inherit('what_defs')`093program what;
X
Xvar
X   date_str,  `123 Date string `125
X   time_str: packed array `0911..11`093 of char;  `123 Time string `125
X   curr_node: varying `09115`093 of char := '               ';  `123 Place t
Vo store the current node we are on `125
X   stats: `091external(stat_rec)`093dae_stats_descr;  `123 Where we store th
Ve stats from the nodes `125
X   data: `091external(data_rec)`093dae_data_buf;  `123 Data for the nodes `1
V25
X   nodes: dae_nodes_descr;  `123 Where we store the info from the nodes `125
X   outfile: text;  `123 The output file we will put information to `125
X   func: unsigned := 0;  `123 Function code to send to daemon `125
X
X
X
Xprocedure outputheader(var outfile: text; func: unsigned);
X
Xvar
X   loop: integer;  `123 Loop control variable `125
X
Xbegin
X   if odd(cli$present('HEADER')) then  `123 Do we want the header `125
X      case func :: integer of
X         DAE_BRIEF:
X            begin
X               writeln(outfile, 'Interactive Users':36);
X               writeln(outfile, date_str:27, time_str:12);
X               writeln(outfile, 'Total number of interactive users = ':44, s
Vtats.tot_int:1);
X               writeln(outfile);
X               writeln(outfile, ' Username   Node     PID      Process Name
V Terminal');
X                                `123 ABC1234   ABCDEF  xxxxxxxx  abcdefghijk
Vlmno ABCxxx:`125
X            end;  `123 label DAE_BRIEF `125
X         DAE_FULL:
X            begin
X               writeln(outfile, 'Interactive Users':48);
X               writeln(outfile, date_str:39, time_str:12);
X               writeln(outfile, 'Total number of interactive users = ':56, s
Vtats.tot_int:1);
X               writeln(outfile);
X               writeln(outfile, 'Username  Node  Pid   Process Name    Group
V Term   Login Ste  Cpu  Program');
X                                `123ABC12345 ABCDEF xxxx abcdefghijklmno ABC
VDEFGABCxxxx XX:XX ABC XXXX $ABCDEFGH`125
X            end;  `123 label DAE_FULL `125
X         DAE_SYSTEM:
X            begin
X               writeln(outfile, 'Process Summary':47);
X               writeln(outfile, date_str:39, time_str:12);
X               writeln(outfile, ' ':13, stats.tot_int:1, ' Interactive Users
V,', stats.tot_bat:1, ' Batch Jobs, ',
X                                stats.tot_prc:1, ' Total Processes');
X               writeln(outfile);
X               writeln(outfile, 'Username  Node  Pid   Process Name    Group
V Term   Login Ste  Cpu  Program');
X                                `123ABC1234  ABCDEF xxxx abcdefghijklmno ABC
VDEFGABCxxx: XX:XX ABC XXXX $ABCDEFGH`125
X            end;  `123 label DAE_SYSTEM `125
X         DAE_STATUS:
X            begin
X               writeln(outfile, 'Status Summary from Node ':30, curr_node, '
V on ', date_str, ' at ', time_str:5);
X               writeln(outfile, 'Node         Up      Ver    Cpu     Pages
V   Int Bat Tot     Load Averages');
X                                `123ABCDEF   XXX+XX:XX   V4.7   abcd   XXXXX
VX   XXX XXX XXX   XX.XX XX.XX XX.XX`125
X            end;  `123 then `125
X      end;  `123 case `125
Xend;  `123 outputheader `125
X
X
X
Xprocedure printoutput(var outfile: text);
X
Xvar
X   load_string,
X   temp_string,  `123 Temporary place to hold the output string `125
X   boot_string: varying `09123`093 of char;  `123 The string version from th
Ve boot time `125
X   day,  `123 Day return in boot_string `125
X   loop,  `123 Loop control variable `125
X   status: integer;  `123 Status return values `125
X   len: $uword;  `123 Length of strings returned by system functions `125
X   infostring: dae_record_buffer;  `123 Network message string returned `125
X
Xbegin
X   infostring := ' ';  `123 Initialize for cleanliness `125
X
X   if (cli$present('STATUS') = CLI$_PRESENT) then
X      begin
X
X         for loop := 1 to stats.num_stats do
X             with stats.stat_arr`091loop`093 do
X                begin
X                   boot_string.length := 23;
X                   temp_string := ' ';
X
X                   what_uptime(boot_time, boot_string, len);
X
+-+-+-+-+-+-+-+-  END  OF PART 11 +-+-+-+-+-+-+-+-

