.db2toprc configuration file

The .db2toprc configuration file is a user generated file used to set parameters at initialization time for the db2top monitoring utility.

The db2top utility will search for the location of the .db2toprc file using the user-defined variable $db2topRC. If the variable is not set, db2top will first search for the .db2toprc file in the current directory and then in the home directory. The .db2toprc file is user generated.

Environment variables

You can set the following environment variables:
  • DB2TOPRC

    A user defined environment variable that stores the location of the .db2toprc file. For example, on Linux®, you can define DB2TOPRC as: export db2topRC="~/db2top".

    If the variable is not set by the user, db2top will first search for the .db2toprc file in the current directory and then in the home directory.

  • DB2DBDFT

    This variable specifies the database alias name of the database to be used for implicit connects. It is used when no database name is specified on the command line or in the .db2toprc configuration file.

  • EDITOR

    This system environment variable specifies the command used to start the text editor used to display the results of explain or native snapshots.

    If this variable is not set, vi is used.

Structure

Some of the entries in the .db2toprc file are described here.

cpu=command
Use this entry to display the results of CPU activity on the second line at the right of the screen output. For example:

cpu=vmstat 2 2 | tail -1 | awk '{printf("%d(usr+sys)",$14+$15);}'

displays Cpu=2(usr+sys) on the right of the screen.
io=command
Use this entry to specify a command and display the result on the second line at the left of the screen output. For example:

io=vmstat 2 2 | tail -1 | awk '{printf("%d(bi+bo)",$10+$11);}'

displays Disk=76(bi+bo) on the left of the screen.

Both commands run as background processes and the fields on the screen are updated asynchronously.

shell alias=command
Use this shell entry to specify a user defined command, for example: shell M=top spawns top from a db2top session when entering M. It returns to the current screen upon exit.
function alias=command
Use this entry to specify a user defined command, for example: function N=netstat creates a new function called N that repeatedly displays the output of netstat. There can be multiple function entries. They must be placed on separate lines. For example:
  • function Q=netstat
  • function N=df -k
sort=command
Use this entry to specify a sort order, for example: sort=command creates a default sort order for this function, where command is the column number. It can be either ascending or descending. Sort is valid for sessions, tables, tablespace, bufferpool, dynsql, statements, locks, utilities and federation.

Sample .db2toprc file

There is no default .db2toprc configuration file. However, you can press "W" to create a .db2toprc for the current setup. Use the following sample .db2toprc file as a reference. Comments have been added to all entries.

# db2top configuration file
# On UNIX, should be located in $HOME/.db2toprc
# File generated by db2top-1.0a
#
node= # [-n] nodename
database=sample # [-d] databasename
user= # [-u] database user
password= # [-p] user password (crypted)
schema= # [-V] default schema for explains
interval=2 # [-i] sampling interval
active=OFF # [-a] display active sessions only (on/off)
reset=OFF # [-R] Reset snapshot at startup (on/off)
delta=ON # [-k] Toggle display of delta/cumulative values (on/off)
gauge=ON # display graph on sessions list (on/off)
colors=ON  
# True if terminal supports colors. Informs GE_WRS if it can display information with colors
graphic=ON  # True if terminal supports semi graphical characters (on/off). 
port= # Port for network collection
streamsize=size # Max collection size per hour (eg. 1024 or 1K : K, M or G)
# Command to get cpu usage information from OS
cpu=vmstat 2 2 | tail -1 | awk '{printf("%d(usr+sys)",$14+$15);}'
# Command to get IO usage information from OS
io=vmstat 2 2 | tail -1 | awk '{printf("%d(bi+bo)",$10+$11);}'
# Ordering of information in sessions screen
# Column order for the session screen (option l)
sessions=0,1,18,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,19,20,21,22,23
# Column order for the tables screen (option T)
tables=0,1,2,4,3,5,6,7
# Column order for the tablespaces screen (option t). 
# The display will be sorted in ascending order on column #22
tablespaces=0,1,18,2,3,4,5,6,7,8, sort=22a
# Column order for the bufferpool screen (option b)
bufferpools=0,1,18,2,3,4,5,6,7,8,9,10
# Column order for the Dynamic SQL screen (option D)
dynsql=0,1,18,2,3,4,5,6,7,8,9
statements=0,1
locks=0,1
utilities=0 # contains the default column and sort order for the utility screen
federation=0,2,4  # contains the default column and sort order for the federation screen

# User defined commands
shell P=top
function N=date && netstat -t tcp