Go to main content

手册页部分 1:用户命令

退出打印视图

更新时间: 2022年7月27日 星期三
 
 

zonestat(1)

名称

zonestat - 报告活动区域的统计信息

用法概要

zonestat [-z zonelist
] [-r reslist] [
-n namelist] [-T u | d | i]
   [-R reports] [-q] [
-x] [-b brandlist] [-p [-P lines]]
   [-S cols] interval [
duration [report]]

描述

The zonestat utility reports on the CPU, memory, networking, and resource control utilization of the currently running zones.对于每个区域的使用情况,都将报告系统资源百分比和区域所配置的限制两方面的内容。

zonestat 实用程序按指定的时间间隔输出一系列的间隔报告。它还可以按指定的时间间隔输出一个或多个摘要报告。

The default output is a summary of CPU, physical and virtual memory, and networking utilization.可使用 –r 选项为特定资源选择详细的输出。

安全性

在非全局区域 (NGZ) 内运行时,只会报告对 NGZ 可见的 pset。NGZ 输出中包括所有其他系统资源,例如内存和限制。

For all reported resources, the per-NGZ use is reported.Use of each resource by the system itself, i.e. that cannot be attributed to a particular zone, is reported as [system].

Inside a solaris-kz brand zone, only that zone's resource use is visible.

proc_info 特权是使用 zonestat 实用程序所必需的。该特权是基本特权集的成员。

选项

支持以下选项:

–n name[,name]

Specify a list of resource names on which to report.对于 pset 资源,这是 pset 的名称。对于 physical-memory、locked-memory 和 virtual-memory 资源,可指定的名称只有 mem_defaultvm_default。对于网络资源,这是数据链路的名称。

Dedicated-cpu psets can be specified by their dedicated-cpu pset name (SYSzone_<zonename>) or by just their zonename.Psets created by psrset can be specified by their psrset pset name (SYSpsrset_<id>), or just by their pset id.See resource-management(7) for more information on existing types of pools and psets.

对于 sysstatsfsstats,属于它们的所有资源名称都可用作名称。在这种情况下,仅输出名称指定的列。See example 7.

除了用逗号分隔的列表,还可以指定多个 –n 选项来报告一组资源。

–p

Parsable output.

以计算机可解析的稳定格式进行输出。各个字段以冒号 (:) 进行分隔。行的格式为:

report type:resource:field[:field]*

If the –T is specified, each line is prefixed with a timestamp:

The report types are: report-total, report-average, report-high, and interval.

For the list of existing resource types, see the –r option.

On top of the resource types defined with the –r option, the header resource is a special resource used to start the beginning of an interval or a summary report.All output lines between header resources belong to the same report.The header resource type cannot be used with the –r option.

The remaining fields are resource type specific and, save for exceptions listed below, the ordering of the fields reflects the ordering of columns in the default output for each resource type.有关详细信息,请参见 zonestat 实用程序。

For the summary resource, the remaining fields are as follows (see the OUTPUT section below for the explanation of the column headings):

line type (see –P):USED CPU:%PART:%CAP:%SHRU:USED PhysMem:
    %USED PhysMem:%CAP PhysMem:USED VirtMem:%USED VirtMem:
    %CAP VirtMem:PBYTE:%PUSE:STLN:%STLN

For the network resource, the remaining fields are as follows, for the default and extended (option –x) output, respectively:

<zone view>:zonename:RBYTE:OBYTE:TOBYTE:MAXBW:%MAXBW:
    PRBYTE:%PRBYTE:POBYTE:%POBYTE

<link view>:linkname:zonename:RBYTE:OBYTE:TOBYTE:MAXBW:%MAXBW:
    PRBYTE:%PRBYTE:POBYTE:%POBYTE

For the processor-set resource, the remaining fields are as follows:

pset type:pset ID:line type (see –P):USED CPU:%USED CPU:CAP:%CAP:
    SHRS:%SHR:%SHRU:USED CPU time [H]H-MM-SS.SS:STLN:%STLN

所有现有的输出字段都是稳定的。将来的版本可能会引入新的报告和资源类型。Future versions might also add additional new fields to the end of existing output lines.

Running in a global zone, the statistics provided for solaris-kz brand zones are from the host point of view, and may differ from those reported within the zone; see solaris-kz(7).

–P line[,line]

For parsable output, specify lines to output.可以选择下列行类型中的一个或多个:

header

Each interval and summary report has a header, which prints details such as the interval timestamp, interval number, and the seconds count.If the header line is chosen, each interval is also finalized with a footer.

resource

The lines specifying each resource limit, if applicable.For example, there are no limits specified for resources sysstats and fsstats.

system

系统对每个资源的使用率。这包括内核和不是由特定区域消耗的任何资源。当 zonestat 在非全局区域内运行时,该值是系统和所有其他区域所消耗的总体资源。不支持网络资源类型的 system 使用情况。

total

每个资源的总使用率。

zones

用于按区域详细列出每个资源的使用率的行。

By default, all lines are present in the parsable output.

–q

静默模式。只输出摘要报告(需要 –R 选项)。将忽略所有间隔报告。

–r resource[ ,resource]

指定要报告的资源类型。可用的资源包括:physical-memoryvirtual-memorylocked-memoryprocessor-setprocesseslwpsshm-memoryshm-idssem-idsmsg-idslofinetworksysstatsfsstats

In particular, sysstats shows number of total syscall, forks, vforks, fork-fails, exec, semops, while fsstats shows number of read calls, write calls, bytes read by rdwr(), bytes written by rdwr(), and the number of pathname lookups.

Additional resource names are available to provide some common resource output combinations:

summary

A summary of CPU, physical-memory, virtual-memory, and network usage is printed.

memory

An alias for "physical-memory,virtual-memory,locked-memory".

psets

Same as processor-set.

default-pset

The default pset only is reported.

limits

An alias for "processes,lwps,lofi".

sysv

An alias for "shm-memory,shm-ids,sem-ids,msg-ids".

all

All resource types.

By default the summary resource is printed.

In addition to a comma-separated list, multiple –r options can be specified to report on a set of resources types.

The system's CPUs can be partitioned into psets.By default, all CPUs are in a single pset named pset_default.

内存不能划分为不同的集。zonestat 实用程序针对这些资源的输出中将它们的名称显示为 mem_defaultvm_default

The all resource specifies that all resource types should be reported.

–b brand[,brand]

仅显示由此选项指定的标记。

–R report[,report]

列显一个摘要报告。下面介绍了支持的报告类型。In addition to a comma-separated list, multiple –R options can be specified for a set of summary reports.

total

列显为每个资源详细列出以下内容的摘要报告:

psets

Total CPU used since start of command invocation.计算每个区域所占用的百分比时会考虑区域未运行的时间。For instance, if a zone used 100% of the CPU while it was running, but the zone was halted for half of the intervals, then the summary report shows the zone used 50% of the CPU time.

memory, limits, sysv

自调用命令以来所报告的所有间隔的平均资源占用值。此平均值将区域未运行的时间间隔考虑在内。例如,如果某个区域在运行时占用的物理内存平均值为 100M,且只运行时间间隔的一半,摘要报告便会显示该区域平均占用了 50M 的物理内存。

network

由所有利用物理带宽的数据链路传输和接收的所有字节的总和。总和是自启动命令调用以来所计算的字节总数,并标准化为每秒的字节数。所使用的百分比基于总可用带宽。

sysstats, fsstats

Sum of resources used by all CPUs visible to the zone.

average

与 total 类似,但只将区域运行的时间间隔考虑在内。例如,如果某个区域只在单个时间间隔内运行,且在该时间间隔内使用了 200M 虚拟内存,无论在该摘要报告之前报告了多少个时间间隔,其使用的平均虚拟内存都为 200M。

high

列显详细列出在调用 zonestat 实用程序的任何时间间隔内每个资源和区域的最高使用率的摘要报告。

–S col[,col]

对使用每个资源的区域进行排序。

可指定以下排序列:

name

按区域名称的字母数字顺序排序。

used

按所使用的资源数量排序。对于网络资源,这与按字节排序相同。

这是缺省值。

cap

按所配置的上限排序。

pcap

按所使用的上限的百分比排序。

shr

按所分配的份额排序。

pshru

按所使用的份额的百分比排序。

bytes

按传输和接收的总字节对网络资源进行排序。

prbyte

按通过线路接收的字节百分比对网络资源进行排序。

pobyte

按通过线路传输的字节百分比对网络资源进行排序。

maxbw

按使用的带宽百分比对网络资源进行排序。

cpu

Sort by CPU usage in the summary output.这是缺省值。

physical-memory

Sort by physical memory usage in the summary output.

virtual-memory

Sort by virtual memory usage in the summary output.

network

Sort by network usage in the summary output.

exec, fork, fork-fail, name-lookup, read, readbyte, sema, syscall, vfork, write, writebyte

按使用的相应资源的数量排序。

–T u | d | i

包含每个报告的时间戳。支持下列格式:

d

Standard date format.请参见 date(1)。此选项对 –p 无效。

i

使用符合 ISO 8601 格式设置的时间:

YYYYMMDDThhmmssZ
u

时间的内部表示形式的印刷表示形式。See time(2).这也称为 unix 时间。

–x

显示具有更多详细信息的扩展视图。例如,当与网络资源一起使用时,扩展视图会列出每个虚拟数据链路的详细信息。

–z zonename[ ,zonename]

指定要报告的区域的列表。缺省情况下会报告所有区域。

除了用逗号分隔的列表外,还可以指定多个 –z 选项来报告一组区域。输出中包括指定的区域使用过的任何资源。

操作数

支持下列操作数:

interval

指定每个间隔报告之间暂停的时间长度(以秒为单位)。缺省时间间隔将使用为区域监视服务配置的时间间隔。请参见 zonestatd(8)

interval 是必需的。interval 不能为零。interval 可以指定为 [nh][nm][ns],例如 10s1m

duration

指定要报告的时间间隔数。如果未指定,则缺省使用 infinity。命令持续时间为 (interval * duration)。duration 不能为零。还可以指定一个 inf 值以显式选择 infinity。

还可以将 duration 指定为 [nh][ nm][ns]。在这种情况下,duration 被解释为执行时间的持续期。实际的 duration 会舍入到最接近的时间间隔倍数。

report

指定摘要报告周期。例如,report 为 4 时,每 4 个时间间隔生成一次报告。如果命令持续时间不是 report 的倍数,则最后一个报告为任何剩余时间间隔的内容。

还可以将 report 指定为 [nh][nm][ns]。在这种情况下,报告会按指定的时间段输出,并舍入到最近的时间间隔。如果命令 duration 不是 report 的倍数,则最后一个报告为任何剩余时间间隔的内容。

Requires –R.如果指定了 –R 但未指定 report,则报告周期为整个命令持续时间,即在命令执行结束时生成指定的报告。

输出

以下列表定义了命令输出的列标题:

SYSTEM-MEMORY

物理主机上可用的内存总量。

SYSTEM-LIMIT

物理主机上可用的最大资源量。

CPUS

The number of CPUs allocated to a pset

ONLINE

Of the CPUs allocated to a pset, the number of CPUs which can execute processes.

MIN/MAX

The minimum and maximum number of CPUs which can be allocated to the pset by the system.

ZONE

使用资源的区域。除了区域名称,此列还可以包含:

[total]

系统范围内使用的资源总量。

[system]

由内核使用的或以不与任何特定区域关联的方式使用的资源量。

当在非全局区域中使用 zonestat 时,[system] 指示由系统和所有其他区域使用的总体资源。

对于网络资源,不提供网络的系统使用情况。

USED

所使用的资源量。

%USED

所使用的资源量占总资源的百分比。

STLN

The amount of CPU time stolen from the zone.只有部分区域标记支持使用“窃取时间”。“窃取时间”的值反映因主机将 CPU 资源用于其他用途而导致区域无法运行的时间。有关“窃取时间”的更多信息,请参阅 solaris-kz(7)

对于 [system] 行,报告当前系统的窃取时间。对于 [total] 行,报告当前系统的窃取时间与系统中所有区域的窃取时间之和。

%STLN

The amount of CPU time stolen as a percent of the total CPU time available.

%PART

The amount of CPU used as a percentage of the total CPU in a processor-set to which the zone is bound.如果某个区域是全局区域,或者如果使用了 psrset(8)psets,则该区域只能将进程绑定到多个 pset。If multiple binding are found for a zone, its %PART is the fraction used of all bound psets.For [total] and [system], %PART is the percent used of all CPUs on the system.

CAP

如果为某个区域在指定资源配置了上限,则会在此列中显示该上限。

%CAP

所使用的资源量占区域中配置的上限的百分比。

SHRS

分配给区域的份额数量。对于 [total] 行,这是分配给共享此资源的所有区域的份额总数。如果某个区域未配置为使用份额,并且与配置为使用份额的其他区域共享某个资源,则此列会针对该区域包含 no-fss

%SHRS

分配给此区域的份额占总份额的百分比。例如,2 个区域共享 1 个 pset,每个具有 10 个共享,则每个区域的 %SHR 为 50%。

%SHRU

Of the share allocated to the zone, the actual used resource as the fraction of resource 100%.由于份额只会在存在资源争用时实施,因此区域可能具有超过 100% 的 %SHRU

TOBYTE

The total number of bytes transmitted and received by datalinks or virtual links.

PRBYTE

消耗物理带宽的接收字节数。

RBYTE

The number of received bytes.

POBYTE

消耗物理带宽的传输字节数。

OBYTE

The number of transmitted bytes.

%PRBYTE

用于接收 PRBYTE 的可用物理带宽百分比。

%POBYTE

用于传输 POBYTE 的可用物理带宽百分比。

PBYTE

The sum of PRBYTE and POBYTE.

%PUSE

PBYTE as a percent of the total available physical bandwidth.

LINK

数据链路的名称。

MAXBW

在数据链路上配置的最大带宽。

%MAXBW

所有传输和接收的字节总和占配置的最大带宽的百分比。

exec, fork, fork-fail, name-lookup, read, readbyte, sema, syscall, vfork, write, writebyte

每个资源名称使用的资源量。

示例

示例 1 Using zonestat to display a summary of CPU and memory utilization

The following command shows a summary of CPU and memory utilization every 2 seconds for 100 intervals:

$ zonestat 2 100
Collecting data for first interval...
Interval: 1, Duration: 0:00:02
SUMMARY       Cpus/Online: 56/56    PhysMem: 255G   VirtMem: 259G
          ----------CPU---------- --PhysMem-- --VirtMem-- --PhysNet--
     ZONE  USED %PART  STLN %STLN  USED %USED  USED %USED PBYTE %PUSE
  [total]  3.43 6.13%  0.00 0.00% 30.7G 12.0% 34.0G 13.0% 9937K 0.98%
 [system]  0.03 0.06%  0.00 0.00% 19.5G 7.65% 32.6G 12.5%     -     -
   on-sru  2.54 5.53%  0.00 0.00% 10.0G 3.91% 36.3M 0.01%     0 0.00%
   tzone1  0.54 6.76%     -     -  668M 0.25%  696M 0.26%     0 0.00%
   global  0.30 0.64%     -     -  516M 0.19%  700M 0.26% 9937K 0.98%

Interval: 2, Duration: 0:00:04
SUMMARY       Cpus/Online: 56/56    PhysMem: 255G   VirtMem: 259G
          ----------CPU---------- --PhysMem-- --VirtMem-- --PhysNet--
     ZONE  USED %PART  STLN %STLN  USED %USED  USED %USED PBYTE %PUSE
  [total]  3.64 6.51%  0.00 0.00% 30.7G 12.0% 34.0G 13.0% 14.5M 1.43%
 [system]  0.00 0.00%  0.00 0.00% 19.5G 7.65% 32.5G 12.5%     -     -
   on-sru  2.32 5.05%  0.00 0.00% 10.0G 3.91% 36.3M 0.01%     0 0.00%
   global  0.71 1.48%     -     -  516M 0.19%  700M 0.26% 14.5M 1.43%
   tzone1  0.61 7.62%     -     -  688M 0.26%  716M 0.26%     0 0.00%
<output from other intervals omitted>
示例 2 Using zonestat to produce parsable output

以下命令生成可解析的输出。For each zone, it prints a line of output for every pset usable in that zone.It separates each interval by the header and footer lines:

$ zonestat -p -P header,zones -r psets 1 100
<output omitted>
示例 3 Using zonestat to report on the default pset

以下命令在一分钟的时间内每一秒针对缺省的 pset 报告一次:

$ zonestat -r default-pset 1 1m
<output omitted>
示例 4 Using zonestat to report total and high utilization

以下命令在 24 个小时内以 10 秒的时间间隔静默监视,并每隔 1 小时生成总使用率和最高使用率报告:

$ zonestat -q -R total,high 10s 24h 1h
<output omitted>
示例 5 Using zonestat to report datalink utilization

以下命令以 5 秒的时间间隔对名为 e1000g0 的数据链路报告 5 次:

$ zonestat -r network -n net0 5 5
Collecting data for first interval...
Interval: 1, Duration: 0:00:05
NETWORK-DEVICE             SPEED        STATE        TYPE
net0                    1000mbps           up        phys
               ZONE TOBYTE  MAXBW %MAXBW PRBYTE %PRBYTE POBYTE %POBYTE
            [total]  8853K      -      -  8342K   0.26%   507K   0.01%
             global  8758K      -      -  8296K   0.26%   461K   0.01%
             tzone1  93.4K      -      -  46.3K   0.00%  46.5K   0.00%
             on-sru    602      -      -      0   0.00%    346   0.00%
<output from other intervals omitted>
示例 6 Using zonestat to report on the sysstats resources
$ zonestat -r sysstats 1 1
Collecting data for first interval...
Interval: 1, Duration: 0:00:01
SYSSTATS
	ZONE syscall  fork vfork fork-fail  exec spawn  sema
     [total]    126K   265     0         0   264     0     0
    [system]       0     0     0         0     0     0     0
      global    111K     3     0         0     3     0     0
      on-sru      22     0     0         0     0     0     0
      tzone1   14.1K   262     0         0   261     0     0
示例 7 Using zonestat to report the number of fork, exec and name-lookup related system calls only
$ zonestat -n fork,exec,name-lookup 1 1
Collecting data for first interval...
Interval: 1, Duration: 0:00:01
SYSSTATS
		ZONE  fork  exec
	     [total]   260   260
	    [system]     0     0
	      global     2     2
	      on-sru     0     0
	      tzone1   258   258
FSSTATS
		ZONE name-lookup
	     [total]        5276
	    [system]           0
	      global          97
	      on-sru           0
	      tzone1        5179

退出状态

将返回以下退出值:

0

成功完成。

1

出现错误。

2

用法无效。

3

svc:system/zones_monitoring:缺省情况下未运行或未响应。

属性

有关下列属性的说明,请参见 attributes(7)

属性类型
属性值
可用性
system/zones
接口稳定性
请参见下文。

命令调用和可解析的输出是 "Committed"(已确定)。用户可读的输出(缺省输出)是 "Uncommitted"(未确定)。

另请参见

attributes(7), date(1), pooladm(8), poolcfg(8), prctl(1), privileges(7), psrset(8), rcapadm(8), resource-controls(7), resource-management(7), solaris-kz(7), time(2), timezone(5), zoneadm(8), zonecfg(8), zonestatd(8)

附注

zonestat 实用程序依赖于区域监视服务:svc/system/zonestat:default。如果运行 zonestat 实用程序时 zonestat 服务停止,则 zonestat 命令调用将退出,且不再输出任何报告。如果在到达下一个报告周期之前,zonestat 被(CTRL/c、SIGINT)中断,则会输出报告 (–R)。