Command Macro to gather STCP interface and Ethernet adapter statistics

Blue Bar separator


gather_stcp

Purpose

This macro will periodically call VOS commands and make analyze_system requests to gather statistics about the STCP stack and the genet and renet adapters. Output is written to a file named stcp_stats.(date). These statistics can help with troubleshooting and provide a baseline to help with capacity planning.

Display Form

 --------------------------------- gather_stcp --------------------------------
 -ip:
 -genet:
 -renet:
 sleep_time: 15

Command-Line Form

gather_stcp [-ip string]                                                       
		[-genet string]
		[-renet string] 
		[sleep_time]

Arguments

-ip string
This is a string of the format #name,#name,#name. Each name is the device name of an IP interface, that is the device name used in the "ifconfig -add" command. The leading pound (#) character is required. Names are separated by a comma (,). Spaces between the names will confuse the macro.

-genet string
This is a string of the format #name,#name,#name. Each name is the device name of gigabit adapter. The leading pound (#) character is required. Names are separated by a comma (,). Spaces between the names will confuse the macro.

-renet string
This is a string of the format #name,#name,#name. Each name is the device name of U713 10/100 adapter. The leading pound (#) character is required. Names are separated by a comma (,). Spaces between the names will confuse the macro. Note that K460 10/100 adapters cannot be used with this argument.

sleep_time number
This is the number of minutes to sleep between gathering statistics. For general baselining I recommend leaving it at the default of 15.

Explanation

Basically the macro will call the following commands and analyze_system requests
  1. netstat -statistics
  2. netstat -interface
  3. match ' @ ' -or miss; dump_streams -driver_table
  4. match ' @ ' -or flow; dump_streams -driver_table
  5. stcp_meters
  6. dump_genet
  7. dump_renet
If an argument is not provided the corresponding commands/requests are skipped. The "netstat -statistics command, dump_streams -drivers and stcp_meters analyze_system request are always called.

Output is written to a file named stcp_stats.(date) in the current working_dir. While you can read the file while the command is running you can get some strange results if you have the file open when the macro tries to write to it. I recommend that you always copy the current day's file to a temporary file and then read the temporary file. There is no problem reading files for previous days.

Output is redirected to the outfile with the attach_default_output command. If you run this macro interactively you will not see any output and when you break out there is a good possibility that output will still be redirected to a file. If that is the case you can redirect output back to your terminal with the detach_default_output command.

Since the command will run forever I also recommend that it be run in a started process. Since, it calls analyze_system the process must be started with the -privileged argument. The outfile that is created will not grow past 1 block unless some errors are encountered.

The analyze_system request stcp_meters was introduced in releases VOS 14.7 and 15.0. If you are running this macro on an earlier release you will need to comment out or remove the stcp_meters request.

Finally, the daily output file can be several thousand (or more) blocks long. I suggest that you monitor your system to make sure that a disk space problem does not develop. For capacity planning baselining you do not need to use the -genet and -renet arguments. These arguments are more useful when troubleshooting problems.

Example

d gather_stcp.out

%phx_vos#m14_d02>CAC>Noah_Davids>gather_stcp.out  06-04-20 20:09:41 mst

Noah_Davids.CAC logged in on %phx_vos#m14 at 06-04-11 05:17:57 mst.
gather_stcp -ip #sdlmux.14.1,#sdlmux.14.2,#sdlmux.14.3 -renet #stcp_u713.m14.6.1
+,#stcp_u713.m14.7.1,#stcp_u713.m14.6.2 -genet #stcp_u714.m14.6.3,#stcp_u714.m14
+.7.3

display_line 'gather_stcp -ip #sdlmux.14.1,#sdlmux.14.2,#sdlmux.14.3 -genet #stc
+p_u714.m14.6.3,#stcp_u714.m14.7.3 -renet #stcp_u713.m14.6.1,#stcp_u713.m14.7.1,
+#stcp_u713.m14.6.2' 15
gather_stcp -ip #sdlmux.14.1,#sdlmux.14.2,#sdlmux.14.3 -genet #stcp_u714.m14.6.3
+,#stcp_u714.m14.7.3 -renet #stcp_u713.m14.6.1,#stcp_u713.m14.7.1,#stcp_u713.m14
+.6.2 15
ready  05:17:57

ready  20:09:41
ls stcp_stats*

Files: 8, Blocks: 37762

w       4068 stcp_stats.06-04-11
w       5207 stcp_stats.06-04-12
w       5207 stcp_stats.06-04-14
w       5207 stcp_stats.06-04-15
w       5153 stcp_stats.06-04-16
w       5207 stcp_stats.06-04-17
w       5108 stcp_stats.06-04-18
w       2605 stcp_stats.06-04-19

Directories: 0

Links: 0

ready  20:10:17

gather_stcp.cm

                                                                                
& gather_stcp.cm start here
&
& gather_stcp.cm
& version 1.0 06-04-08
& version 1.1 07-05-18 added streams drivers flow control counter
&                      removed ! characters
&                      reformated so there are no line wraps
& version 1.2 07-05-21 added streams driver miss counter
& version 1.3 10-11-26 added disclaimer
&
& Noah Davids Stratus CAC noah.davids@stratus.com
&
& The latest version of this macro and documentation can be found at
&        http://noahdavids.org/self_published/gather_STCP_stats.html
&
& This software is provided on an "AS IS" basis, WITHOUT ANY WARRANTY OR ANY
& SUPPORT OF ANY KIND. The AUTHOR SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES
& OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE.  This disclaimer
& applies, despite any verbal representations of any kind provided by the
& author or anyone else.
&
&begin_parameters
 IPall option(-ip),string
 GENETall option(-genet),string
 RENETall option(-renet),string
 SLEEP_TIME sleep_time:number=15
&end_parameters

&set_string CMD gather_stcp
&if (length &IPall&) > 0 &then &+
   &set_string CMD (concat (quote &CMD&) ' -ip ' &IPall&)
&if (length &GENETall&) > 0 &then &+
   &set_string CMD (concat (quote &CMD&) ' -genet ' &GENETall&)
&if (length &RENETall&) > 0 &then &+
   &set_string CMD (concat (quote &CMD&) ' -renet ' &RENETall&)
&set_string CMD (concat (quote &CMD&) ' ' &SLEEP_TIME&)
display_line &CMD&
&
&
&echo no_input_lines no_command_lines no_macro_lines
&set count 1
&attach_input
set_ready -format off
&
&label again
&
attach_default_output stcp_stats.(date) -append
display_line *** (time) ***
&echo command_lines
>system>stcp>command_library>netstat -statistics
&set_string IPtemp (concat &IPall& ,)
&while (length &IPtemp&) > 1
 &set i (index &IPtemp& ,)
 &set_string IP (substr &IPtemp& 1 (calc &i& - 1))
 >system>stcp>command_library>netstat -interface &IP&
 &set y &i& + 1
 &set_string IPtemp (substr &IPtemp& &y&)
 &set count &count& + 1
&end
&
&
&echo no_command_lines
analyze_system
&echo input_lines
&
&
match ' @ ' -or miss; dump_streams -driver_table
match ' @ ' -or flow; dump_streams -driver_table
&
&
stcp_meters -all -long
&set count 1
&set_string GENETtemp (concat &GENETall& ,)
&while (length &GENETtemp&) > 1
 &set i (index &GENETtemp& ,)
 &set_string GENET (substr &GENETtemp& 1 (calc &i& - 1))
 dump_genet &GENET& -display_zeros -follow_q
 &set y &i& + 1
 &set_string GENETtemp (substr &GENETtemp& &y&)
 &set count &count& + 1
&end
&
&
&set count 1
&set_string RENETtemp (concat &RENETall& ,)
&while (length &RENETtemp&) > 1
 &set i (index &RENETtemp& ,)
 &set_string RENET (substr &RENETtemp& 1 (calc &i& - 1))
 dump_renet &RENET& -display_zeros -follow_q
 &set y &i& + 1
 &set_string RENETtemp (substr &RENETtemp& &y&)
 &set count &count& + 1
&end
&
&
&echo no_input_lines
quit
detach_default_output
sleep -minutes &SLEEP_TIME&
&goto again
&
& gather_stcp.cm ends here

Blue Bar separator
This page was last modified on 11-10-26
mailbox Send comments and suggestions
to ndav1@cox.net