Configuring the afsmonitor Program
| Chapter 8. Monitoring and Auditing AFS Performance |

## Configuring the afsmonitor Program

To customize the afsmonitor program, create an ASCII-format configuration file and use the -config argument to name it. You can specify the following in the configuration file:

- The File Servers, Cache Managers, or both to monitor.

- The statistics to display. By default, the display includes 271 statistics for File Servers and 570 statistics for Cache Managers. For information on the available statistics, see Appendix C, The afsmonitor Program Statistics.

- The threshold values to set for statistics and a script or program to execute if a threshold is exceeded. By default, no threshold values are defined and no scripts or programs are executed.

The following list describes the instructions that can appear in the configuration file:

`cm` `hostname`

  Names a client machine for which to display Cache Manager statistics. The order of cm lines in the file determines the order in which client machines appear from top to bottom on the `System Overview` and `Cache Managers` output screens.

`fs` `hostname`

  Names a file server machine for which to display File Server statistics. The order of fs lines in the file determines the order in which file server machines appear from top to bottom on the `System Overview` and `File Servers` output screens.

`thresh fs | cm `field_name` `thresh_val` [`cmd_to_run`] [`arg1`] . . . [`argn`]`

  Assigns the threshold value thresh_val to the statistic field_name, for either a File Server statistic (fs) or a Cache Manager statistic (cm). The optional cmd_to_execute field names a binary or script to execute each time the value of the statistic changes from being below thresh_val to being at or above thresh_val. A change between two values that both exceed thresh_val does not retrigger the binary or script. The optional arg1 through argn fields are additional values that the afsmonitor program passes as arguments to the cmd_to_execute command. If any of them include one or more spaces, enclose the entire field in double quotes.

  The parameters fs, cm, field_name, threshold_val, and arg1 through argn correspond to the values with the same name on the thresh line. The host_name parameter identifies the file server or client machine where the statistic has crossed the threshold, and the actual_val parameter is the actual value of field_name that equals or exceeds the threshold value.

  Use the thresh line to set either a global threshold, which applies to all file server machines listed on fs lines or client machines listed on cm lines in the configuration file, or a machine-specific threshold, which applies to only one file server or client machine.

  - To set a global threshold, place the thresh line before any of the fs or cm lines in the file.

  - To set a machine-specific threshold, place the thresh line below the corresponding fs or cm line, and above any other fs or cm lines. A machine-specific threshold value always overrides the corresponding global threshold, if set. Do not place a thresh fs line directly after a cm line or a thresh cm line directly after a fs line.

`show fs | cm `field/group/section``

  Specifies which individual statistic, group of statistics, or section of statistics to display on the `File Servers` screen (fs) or `Cache Managers` screen (cm) and the order in which to display them. The appendix of afsmonitor statistics in the OpenAFS Administration Guide specifies the group and section to which each statistic belongs. Include as many show lines as necessary to customize the screen display as desired, and place them anywhere in the file. The top-to-bottom order of the show lines in the configuration file determines the left-to-right order in which the statistics appear on the corresponding screen.

  If there are no show lines in the configuration file, then the screens display all statistics for both Cache Managers and File Servers. Similarly, if there are no show fs lines, the `File Servers` screen displays all file server statistics, and if there are no show cm lines, the `Cache Managers` screen displays all client statistics.

# comments

  Precedes a line of text that the afsmonitor program ignores because of the initial number (#) sign, which must appear in the very first column of the line.

For a list of the values that can appear in the field/group/section field of a show instruction, see Appendix C, The afsmonitor Program Statistics.)

The following example illustrates a possible configuration file:

       thresh cm dlocalAccesses  1000000
       thresh cm dremoteAccesses  500000 handleDRemote
       thresh fs rx_maxRtt_Usec     1000
       cm client5
       cm client33
       cm client14
       thresh cm dlocalAccesses  2000000
       thresh cm vcacheMisses      10000
       cm client2
       fs fs3
       fs fs9
       fs fs5
       fs fs10
       show cm numCellsContacted
       show cm dlocalAccesses
       show cm dremoteAccesses
       show cm vcacheMisses
       show cm Auth_Stats_group

Since the first three thresh instructions appear before any fs or cm instructions, they set global threshold values:

- All Cache Manager process in this file use 1000000 as the threshold for the dlocalAccesses statistic (except for the machine client2 which uses an overriding value of 2000000.)

- All Cache Manager processes in this file use 500000 as the threshold value for the dremoteAccesses statistic; if that value is exceeded, the script handleDRemote is invoked.

- All File Server processes in this file use 1000 as the threshold value for the rx_maxRtt_Usec statistic.

The four cm instructions monitor the Cache Manager on the machines client5, client33, client14, and client2. The first three use all of the global threshold values.

The Cache Manager on client2 uses the global threshold value for the dremoteAccesses statistic, but a different one for the dlocalAccesses statistic. Furthermore, client22 is the only Cache Manager that uses the threshold set for the vcacheMisses statistic.

The fs instructions monitor the File Server on the machines fs3, fs9, fs5, and fs10. They all use the global threshold for therx_maxRtt_Usec statistic.

Because there are no show fs instructions, the File Servers screen displays all File Server statistics. The Cache Managers screen displays only the statistics named in show cm instructions, ordering them from left to right. The Auth_Stats_group includes several statistics, all of which are displayed (curr_PAGs, curr_Records, curr_AuthRecords, curr_UnauthRecords, curr_MaxRecordsInPAG, curr_LongestChain, PAGCreations, TicketUpdates, HWM_PAGS, HWM_Records, HWM_MaxRecordsInPAG, and HWM_LongestChain).

Using the afsmonitor Program |  | Writing afsmonitor Statistics to a File