配置

如果存在区域,脚本应始终作为 root 的 UID 和在全局区域中运行。
该脚本需要一个服务请求编号,用于为脚本的输出创建一个目录,该目录将是 /var/tmp/guds/[SR#] 。
该脚本还需要对收集期间机器状态的单行描述。
此描述将添加到 INFO 文件中。

将按以下格式创建输出目录。

guds.[Host ID].[Host Name]-YYYY.MM.HH.MM.SS

将按以下格式创建交付给 Oracle 支持的打包文件。

SR#_guds.[Host ID].[Host Name]-YYYY.MM.HH.MM.SS.EXT

其中:
“SR#”是输入的服务请求编号。

“EXT”是“.zip”、“.tgz”或者“.uu”之一。

请确保我们发送给 Oracle 的文件是打包文件,即以后缀“.zip”、“.tgz”或者“.uu”结尾的文件。

输出示例

在交互模式下运行脚本时,我们将看到以下内容:

Performance Script
-----------------
This script will run on your system for an amount of time
determined by the number of iterations the script is asked
to do, and the count and interval supplied for various
commands. If you have not been given specific values, please
accept the defaults when asked. This will cause the script
to run for about 20 minutes.
For the best analysis, you should run this script twice.
1) Run the script when the system is experiencing the
performance problem.
2) Run it again when the machine is doing well.
This will allow the kernel engineer working on the call
to compare bad data to baseline data. Some numbers are
meaningless without baseline data.
This script will gather data from your system and put it
in a directory called /var/tmp/guds[SR#].
Please enter your Service Request number.
The SR number should only consist of doirts or of the pattern
[0-9]-[0-9]+.
SR #: (Insert SR number here)
Enter the number of hours for the script to run.
If the number of hours given is zero, the script will
run for the specified number of iterations.
For a positive, non zero number of hours, the script
will run using the specified count, interval and wait
parameters until the given number of hours has been
met or exceeded.
Hours[0]: 
Please enter the count option for commands that require it.
These are commands like vmstat and iostat which use an
interval and a count to repeat the output.
For example, using a count of 10 and interval of 30
will cause iostat, vmstat, mpstat, etc to output
10 sets of data, with 30 seconds between data sets.
If you have not been given a value for this number,
the default value will be 40
Count[40]:
Please enter the interval option for commands that require it.
These are commands like vmstat and iostat which use an
interval and count to repeat the output.
If you have not been given a value for this number,
the default value will be 5
Interval[5]:
Please enter the number of total data sets for the script
to capture. Each data set contains the output of one SET
of a commands output.
For example, a single data set would contain an entire
"ps -elf" output, and an entire vmstat output, where
the vmstat output is made up of a variable number of data
lines, as defined by "count" and "interval"
If you have not been given instructions for this number,
the default value will be 5
Iterations[5]:
Please enter the number of seconds to wait between
collecting data sets.
To ensure correct data collection, any value entered
will be added to the minimum wait time.
If you have not been given instructions for this number,
the default value will be 0
Wait[0]:
Select extended commands level.

If you have not been given instructions for this number,
the default value will be 2
level 0 : nothing
level 1 : lockstat for contention events
level 2 : L1 + lockstat profiling, threadlist,
            TNF tracing (default)
level 3 : L2 + kmastat, kmausers, memstat
Enter the level : '0', '1', '2' or '3'.
Extended[2]:

Collect mpstat -a data? [n]:
Collect ipstat and tcpstat data if able? [n]: 
Collect prstat cpu, rss, size and zones data? [n]:
Collect trapstat data? [n]: 
Collect configuration data? [y]:
Collect configuration data before performance data? [n]:
Collect VM2.0 data? [y]:
Please enter a one line statement describing the current capture environment.
Some examples are "Performance issue is present" or "System is operating normally".
This statement will be added to the INFO file so the support engineer knows the
state of the system associated with this data.
Description: High system time period
Enter the location of the output directory [/var/tmp/guds]:
Starting Data Gathering
Collecting performance data...
Begin Iteration #1
50/50
End Iteration #1
Waiting for processes to terminate, then sleeping 0 seconds
before the next iteration.
--- All processes finished. --
Begin Iteration #2
50/50
End Iteration #2
Waiting for processes to terminate, then sleeping 0 seconds
before the next iteration.
--- All processes finished. --
Begin Iteration #3
50/50
End Iteration #3
Waiting for processes to terminate, then sleeping 0 seconds
before the next iteration.
--- All processes finished. --
Begin Iteration #4
50/50
End Iteration #4
Waiting for processes to terminate, then sleeping 0 seconds
before the next iteration.
--- All processes finished. --
Begin Iteration #5
43/43
End Iteration #5
Waiting for processes to terminate, then sleeping 0 seconds
before the next iteration.
--- All processes finished. --
Collecting System Information
31/31
Creating zip file...
Please send the data to your support engineer.
The data are stored in /var/tmp/guds/3-12548564/3-12548564_guds.83f2f185.test-2011.01.20.17.44.zip

要求

至少,脚本应该在性能问题出现期间运行。
通常建议使用脚本的默认值。
为了获得最佳分析,我们应该运行此脚本两次。

  • 当系统遇到性能问题时运行脚本。
  • 当机器运行良好时再次运行它。

这将允许处理调用的工程师将不良数据与基线数据进行比较。
如果没有基线数据,有些数字就毫无意义。
当被问到时,一定要在 guds 集合中添加一个有意义的描述。
这支持工程师将收集到的数据与报告的系统状态相关联。

欢迎来到之路教程(on itroad-com)

例子

默认值是:

Hours: 0
Count: 40
Interval: 5
Iterations: 5
Wait: 0
Extended: 2
Collect mpstat -a data? no
Collect ipstat and tcpstat data if able? no   // This prompt only shows up for S11.1 and up
Collect prstat cpu, rss, size and zones data: no
Collect trapstat data? no
Collect configuration data: yes
Collect configuration data before performance data: no
Collect VM2.0 data? yes

因此,默认情况下,上述约束适用的那些命令将运行 5 次,每次以 5 秒的间隔收集 40 个示例。
等效于默认值的命令行是:

# ./guds -q -d  "One line description of system state during capture" -s[case#]

以下是在提供 -h(帮助)选项时在脚本的非交互模式输出中使用的语法和参数定义。

# ./guds -h
Usage: guds [-aCeghIMNOpPqrRStTvVZ] [-b cpuid] [-c count] [-d description] [-D dir]
                 [-H hours] [-i interval] [-L lockstat_interval] [-n iterations]
                 [-s SR#] [-w wait] [-x "extra command"] [-X level]
 -a : Collect mpstat-a.out
 -b : Bind guds to the processor cpuid
 -c : Count value for commands that require it (default: 40)
      (vmstat, prstat, iostat, mpstat, sar, ...)
 -C : Collect configuration data before performance data
 -d : A one line statement describing the state of the system during this capture
 -D : Change the default directory from /var/tmp/guds to 
 -e : Inhibit collecting network data
 -g : Skip collecting static configuration data
 -h : Display this help text
 -H : Run the script for the given number of hours, else for the given number
      of iterations if hours is zero
 -i : Interval value for commands that require it (default: 5)
      (vmstat, prstat, iostat, mpstat, sar, ...)
 -I : Inhibit collecting iostat* data
 -L : Specify the interval during which lockstat is gathering data
      (default: 2 seconds)
 -M : Allow GUDS to run in a guest LDOM
 -n : The number of iterations the script will do to collect data (default: 5)
 -N : If specified, collect ipstat and tcpstat data if able
 -O : Override check for another GUDS running and allow execution
 -p : If specified, on SPARC, and level >= 2, collect trapstat data
 -P : Overide guds exit on perl binary error
 -q : Run in non interactive mode
 -r : Collect prstat cpu,rss,size, and zones data if able
 -R : Allow script to run when uid is not root
 -s : The SR # used to create the directory where the data are going to be stored
 -S : If specified, mask all IP addresses in the data
 -t : Inhibit collecting dlstat data
 -T : Emit timestamps for commands that loop
      (vmstat, mpstat, prstat, iostat, ipstat, tcpstat)
 -v : Print the GUDS Version
 -V : Do not collect VM2.0 data
 -w : Wait time between each iteration (default: 0 seconds)
      If set to 0, then the next iteration will start when the previous finishes
 -x : Run this extra command during each iteration
      Output saved in xtra.out - Errors saved in xtra.err
 -X : Run the extended set of commands depending on specified level
      level 0 : nothing
      level 1 : lockstat for contention events
      level 2 : trapstat (if -p), lockstat profiling, threadlist, TNF tracing (default)
      level 3 : kmastat, kmausers, memstat (they can take a long time to complete
                on systems with a lot of memory)
      Increasing extended level can affect system performance.
 -Z : Allow script to run in a non-global zone

在全局区域中以 root 用户身份运行 GUDS。

更多例子:

  1. 使用默认值运行 GUDS。
    d 和 s 选项是必需的。
# ./guds -q -s3-12345678 -d "Issue Present"
  1. 每次收集以 10 秒的间隔运行 GUDS 20 个示例 2 小时。
# ./guds -q -c20 -i10 -H2 -s3-12345678 -d 'High system time period'

脚本

这是脚本的最新版本。
此文件已使用 zip 压缩。
下载文件后,我们需要使用 unzip 命令解压缩它并更改权限以使其可执行。

# unzip guds_3_11.zip
# chmod u+x guds

我们可以通过将上面的 md5 摘要与以下命令的输出进行比较来验证解压后的 guds 文件的完整性。

# digest -a md5 guds
GUDS - 收集 Solaris 性能数据的脚本

什么是GUDS?

GUDS 脚本是一个 ksh 脚本,旨在收集分析性能问题所需的数据。
该脚本收集一组特定的文件并运行一系列操作系统实用程序,这些实用程序的选择基于指定的级别。
持续时间、迭代次数和其他变量作为一组命令行参数提供给脚本,或者在交互模式下提示输入。
然后将收集的数据以标准格式打包和压缩,以交付给 Oracle 支持。

GUDS 是“Grand Unified Deprivation Script”的首字母缩写。

日期:2020-09-17 00:15:02 来源:oir作者:oir