xref: /illumos-gate/usr/src/man/man1/zonestat.1 (revision f0a052391861a2b96cf28973c3b7f2854591aa79)
1.\"
2.\" This file and its contents are supplied under the terms of the
3.\" Common Development and Distribution License ("CDDL"), version 1.0.
4.\" You may only use this file in accordance with the terms of version
5.\" 1.0 of the CDDL.
6.\"
7.\" A full copy of the text of the CDDL should have accompanied this
8.\" source.  A copy of the CDDL is also available via the Internet at
9.\" http://www.illumos.org/license/CDDL.
10.\"
11.\" Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
12.\" Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
13.\"
14.Dd April 04, 2019
15.Dt zonestat 1
16.Os
17.Sh NAME
18.Nm zonestat
19.Nd report active zone statistics.
20.Sh SYNOPSIS
21.Nm
22.Op Fl z Ar zonelist
23.Op Fl r Ar reslist
24.Op Fl n Ar namelist
25.Op Fl T Ar u Ns | Ns Ar d Ns | Ns Ar i
26.Op Fl R Ar reports
27.Op Fl q
28.Op Fl p Oo Fl P Ar lines Oc
29.Op Fl S Ar cols
30.Ar interval
31.Oo Ar duration
32.Oo Ar report
33.Oc Oc
34.Sh DESCRIPTION
35The
36.Nm
37utility reports on the cpu, memory, and resource control utilization of the
38currently running zones.
39Each zone's utilization is reported both as a percentage of system resources
40and the zone's configured limits.
41.Pp
42The
43.Nm
44utility prints a series of interval reports at the specified interval.
45It optionally also prints one or more summary reports at a specified interval.
46.Pp
47The default output is a summary of cpu, physical, and virtual memory
48utilization.
49The -r option can be used to choose detailed output for specific resources.
50.Pp
51The following options are supported:
52.Bl -tag -width Ds
53.It Fl z Ar zonename Ns Oo Ar ,zonename Ns ... Oc
54Specify a list of zones on which to report.
55By default all zones are reported.
56In addition to a comma-separated list, multiple
57.Fl z
58options can be specified to report on a set of zones.
59The output will include any resources which have usage by the specified zone(s).
60.It Fl r Ar resource Ns Oo Ar ,resource Ns ... Oc
61Specify resource types on which to report.
62The available resources are:
63.Bd -ragged -offset indent
64.Em physical-memory ,
65.Em virtual-memory ,
66.Em locked-memory ,
67.Em processor-sets ,
68.Em processes ,
69.Em lwps ,
70.Em shm-memory ,
71.Em shm-ids ,
72.Em sem-ids ,
73.Em msg-ids ,
74.Em lofi
75.Ed
76.Pp
77The following nicknames can also be specified as resource names:
78.Bl -tag -width indent
79.It Em summary
80A summary of cpu, physical-memory, and virtual memory usage.
81.It Em memory
82physical-memory, virtual-memory, and locked memory.
83.It Em psets
84processor-sets
85.It Em default-pset
86The default pset only.
87.It Em limits
88processes, lwps, lofi
89.It Em sysv
90shm-memory, shm-ids, sem-ids msg-ids
91.It Em all
92all resource types.
93.El
94.Pp
95By default the summary resource is printed.
96.Pp
97In addition to a comma-separated list, multiple
98.Fl r
99options can be specified to report on a set of resources types.
100.Pp
101The system's cpus can be partitioned into processor sets
102(psets)  By default, all cpus are in a single pset named
103.Em pset_default .
104.Pp
105Memory is not partition-able into sets.
106The zonestat utility output for these resources will show them as named
107.Em mem_default
108and
109.Em vm_default .
110.Pp
111The
112.Em all
113resource specifies that all resource types should be reported.
114.It Fl n Ar name Ns Oo Ar ,name Oc
115Specify a list resource names on which to report.
116For pset resources, this is the name of the processor set.
117For physical-memory, locked-memory, and virtual-memory resources,
118the only names are
119.Em mem_default
120and
121.Em vm_default .
122.Pp
123Dedicated-cpu processor sets can be specified by their pset
124name, or by just their zonename.
125.Pp
126Processor sets created by psrset can be specified by their pool
127pset name, or just by their psetid.
128.Pp
129In addition to a comma-separated list, multiple
130.Fl n
131options can be specified to report on a set of resources.
132.It Fl T Ar u Ns | Ns Ar d Ns | Ns Ar i
133Include timestamp of each report.
134The following formats are supported:
135.Bl -tag -width indent
136.It u
137A printed representation of the internal representation of time;
138see
139.Xr time 2 .
140This is also known as unix time.
141.It d
142Standard date format; see
143.Xr date 1 .
144This option is not valid with
145.Fl p .
146.It i
147Time formatted as the ISO 8601 compliant format:
148.D1     YYYYMMDDThhmmssZ
149.El
150.It Fl R Ar report Ns Oo Ar ,report Oc
151Print a summary report.
152The supported report types are described below.
153In addition to a comma-separated list, multiple
154.Fl R
155options may be specified for a set of summary reports.
156.Bl -tag -width indent
157.It total
158Prints a summary report detailing the following for each resource:
159.Bl -tag -width indent
160.It psets
161Total cpu used since start of command invocation.
162The percent used for each zone includes time that a zone was not running.
163For instance, if a zone used 100% of the cpu while it was running, but the zone
164was halted for half of the intervals, then the summary report will show the
165zone used 50% of the cpu time.
166.It memory, limits, sysv
167Average resource used of all intervals reported since command invocation.
168This average factors in intervals in which a zone was not running.
169For example if a zone used on average of 100M of physical memory while it was
170running, and was only running for half the intervals, then the summary report
171will show that the zone used 50M of physical memory on average.
172.El
173.It average
174Similar to
175.Em total ,
176but only intervals in which a zone is running are factored in.
177For example, if a zone was only running for a single interval, and during that
178interval, the zone used 200M of virtual memory, then its average
179virtual-memory will be 200M, regardless of the number of intervals reported
180before the summary report.
181.It high
182Print a summary report detailing the highest usage of each resource and zone
183during any interval of the zonestat utility invocation.
184.El
185.It Fl S Ar col Ns Oo Ar ,col Oc
186Sort zones utilizing each resource.
187The following sorting columns can be specified.
188.Bl -tag -width indent
189.It name
190Sort alphanumerically by zone name.
191.It used
192Sort by quantity of resource used.
193.It cap
194Sort by configured cap.
195.It pcap
196Sort by percent of cap used.
197.It shr
198Sort by allocated share.
199.It pshru
200Sort by percent of share used.
201.El
202.Pp
203By default, output is sorted by quantity of resource used.
204.It Fl q
205Only print summary reports (requires
206.Fl R ) .
207All interval reports are omitted.
208.It Fl p
209Print output in stable, machine-parsable format.
210Individual fields will be delimited with :.
211The line format is:
212.Pp
213.D1    <report type>:<resource>:<field>[:<field>]*
214.Pp
215If
216.Fl T
217is specified each line is prefixed with a timestamp:
218.Pp
219.D1    <timestamp>:<report type>:<resource>:<field>[:<field>]*
220.Pp
221The report types are:
222.Bd -ragged -offset indent
223.Em report-total ,
224.Em report-average ,
225.Em report-high ,
226.Em interval
227.Ed
228.Pp
229The resource types are:
230.Bd -ragged -offset indent
231.Em header ,
232.Em footer ,
233.Em summary ,
234.Em physical-memory ,
235.Em virtual-memory ,
236.Em locked-memory ,
237.Em processor-set ,
238.Em processes ,
239.Em lwps ,
240.Em sysv-shared-memory ,
241.Em sysv-shmids ,
242.Em sysv-semids ,
243.Em sysv-msgids ,
244.Em lofi
245.Ed
246.Pp
247The
248.Em header
249resource is a special resource used to state the beginning of an interval or
250summary report.
251All output lines between header resources belong to the same report.
252Each header has a matching footer.
253.Pp
254The remaining fields are resource type specific.
255See the zonestat utility output for details.
256.Pp
257All existing output fields are stable.
258Future versions may introduce new report and resource types.
259Future versions may also add additional new fields to the end of existing
260output lines.
261.It Fl P Ar line Ns Oo Ar ,line Oc
262For parsable output, specify lines to output in parsable output.
263One or more of the following line types can be chosen:
264.Bl -tag -width indent
265.It resource
266The lines describing each resource.
267.It total
268The total utilization of each resource.
269.It system
270The utilization of each resource by the system.
271This includes the kernel, and any resource consumption not contributable to a
272specific zone.
273When zonestat is run from within a non-global-zone, this value will be the
274aggregate resource consumed by the system and all other zones.
275.It zones
276Lines detailing the per-zone utilization of each resource.
277.It header, footer
278Each interval and summary report has a header, which prints details such
279as the interval and count information.
280After each report, any footer is also printed
281.El
282.El
283.Ss OPERANDS
284.Bl -tag -width indent
285.It interval
286Specifies the length in seconds to pause between each interval report.
287An interval of
288.Em default
289will use the configured interval of the zones
290monitoring service - see
291.Xr zonestatd 1m .
292.Pp
293Interval is required.
294An interval of zero is not permitted.
295The interval can be specified as [nh][nm][ns], such as 10s or 1m.
296.It duration
297Specifies the number of intervals to report.
298Defaults to infinity if not specified.
299The command duration is (interval * duration).
300A duration of zero is invalid.
301A value of
302.Em inf
303can also be specified to explicitly choose infinity.
304.Pp
305Duration can also be specified as [nh][nm][ns].
306In this case, duration will be interpreted as the duration of execution time.
307The actual duration will be rounded up to the nearest multiple of the interval.
308.It report
309Specify the summary report period.
310For instance, a report of 4 would produce reports every 4 intervals.
311If the command duration is not a multiple of report, then the last report will
312be of any remaining intervals.
313.Pp
314Report can also be specified as [nh][nm][ns].
315In this case, reports will be output at the specified time period, rounded up
316to the nearest interval.
317If the command duration is not a multiple of report, then the last report will
318be of any remaining intervals.
319.Pp
320Requires
321.Fl R .
322If
323.Fl R
324is specified and report is not, the report period will be the entire command
325duration, producing the specified reports at the end of execution.
326.El
327.Ss OUTPUT
328The following list defines the column heading of the command output:
329.Bl -tag -width indent
330.It SYSTEM-MEMORY
331The total amount of memory available on the physical host.
332.It SYSTEM-LIMIT
333The maximum amount of resource available on the physical host.
334.It CPUS
335The number of cpus allocated to a processor set.
336.It ONLINE
337Of the cpus allocated to a processor set, the number of cpus
338which can execute processes.
339.It MIN/MAX
340The minimum and maximum number of cpus which may be allocated
341to the processor set by the system.
342.It ZONE
343The zone using the resource.
344In addition to zone names, this column may also contain:
345.Bl -tag -width indent
346.It [total]
347The total quantity of resource used system-wide.
348.It [system]
349The quantity of resource used by the kernel or in a manner not associated with
350any particular zone.
351.Pp
352When zonestat is used within a non-global zone, [system] designates the
353aggregate resource used by the system and by all other zones.
354.El
355.It USED
356The amount of resource used.
357.It PCT
358The amount of resource used as a percent of the total resource.
359.It %PART
360The amount of cpu uses as a percentage of the total cpu in a processor-set to
361which the zone is bound.
362A zone can only have processes bound to multiple processor sets if it is the
363global zone, or if psrset(1m) psets are used.
364If multiple binding are found for a zone, its %PART will be the fraction used
365of all bound psets.
366For [total] and [system], %PART is the percent used of all cpus on the system.
367.It CAP
368If a zone is configured to have a cap on the given resource, the cap will be
369displayed in this column.
370.It %CAP
371The amount of resource used as a percent of zone's configured cap.
372.It SHRS
373The number of shares allocated to the zone.
374For the [total] row, this will be the total number of shares allocated to all
375zones sharing the resource.
376.Pp
377If a zone is not configured to use shares, and is sharing a
378resource with other zones that are configured to use shares,
379this column will contain
380.Em no-fss
381for the zone.
382.It %SHR
383The fraction of the total shares allocated to the zone.
384For instance, if 2 zones share a processor set, each with 10 shares, then each
385zone will have a %SHR of 50%.
386.It %SHRU
387Of the share allocated to the zone, the fraction of resource
388used.
389Zones using all of their share will have a %SHRU of 100%.
390Because shares are only enforced when there is resource contention, it is
391possible for a zone to have a %SHRU in excess of 100%.
392.El
393.Sh IMPLEMENTATION NOTES
394The zonestat utility depends on the zones monitoring service:
395.Pp
396.D1 svc/system/zonestat:default
397.Pp
398If the zonestat service is stopped while the zonestat utility is running, the
399zonestat command invocation will quit without printing additional reports.
400.Pp
401The reports will be printed if zonestat is interrupted (by ctrl-c,
402.Dv SIGINT )
403before reaching the next report period.
404.Sh EXIT STATUS
405.Ex -std
406.Bl -tag -width indent
407.It 0
408Successful completion.
409.It 1
410An error occurred.
411.It 2
412Invalid usage.
413.It 3
414svc:system/zones_monitoring:default not running or not responding.
415.El
416.Sh EXAMPLES
417Example 1:  Summary of cpu and memory utilization every 5 seconds.
418.Bd -literal
419       # zonestat 5 1
420       SUMMARY
421		-----CPU------------- ----PHYSICAL--- ----VIRTUAL----
422	   ZONE USED %PART %CAP %SHRU USED  PCT  %CAP  USED  PCT %CAP
423	[total] 9.74   30%    -     - 7140M  21%    - 10.6G  22%    -
424       [system] 0.28  0.8%    -     - 6535M  19%    - 10.4G  21%    -
425	 global 9.10   28%    -     -  272M 0.8%    -  366M 0.7%    -
426	  zoneA 0.32  1.0%    -     -  256M 0.7%    -  265M 0.5%    -
427	  zoneB 0.00  0.0%    -     - 77.6M 0.2%    - 71.1M 0.1%    -
428.Ed
429.Pp
430Example 2:  Using parsable output, fetching only zone usages.
431.Pp
432The following command will produce parsable output, printing one
433line per zone using each pset resource for a 5 second interval.
434.Bd -literal
435
436       # zonestat -p -P zones -r psets 5 1
437
438.Ed
439.Pp
440Example 3:  Report on the default pset.
441.Pp
442The following command will report on the default pset once a second
443for one minute.
444.Bd -literal
445
446       # zonestat -r default-pset 1 1m
447
448.Ed
449.Pp
450Example 4:  Report total and high utilization.
451.Pp
452The following command monitors silently at a 10 second interval
453for 24 hours, producing a total and high report every 1 hour.
454.Bd -literal
455
456       # zonestat -q -R total,high 10s 24h 1h
457
458.Ed
459.Sh INTERFACE STABILITY
460Command invocation and parsable output is Committed.
461Human readable output (default output) is uncommitted.
462.Sh SECURITY
463When run from within a non-global zone (NGZ), only processor sets
464visible to the NGZ are reported.
465The NGZ output will include all of other system resources, such as memory and
466limits.
467.Pp
468For all reported resources, the NGZ's usage will be output.
469Usage of each resource by the system, global zone, and all other
470zones, will be reported as used by
471.Em system .
472.Sh SEE ALSO
473.Xr date 1 ,
474.Xr pooladm 1m ,
475.Xr poolcfg 1m ,
476.Xr prctl 1m ,
477.Xr rcapadm 1m ,
478.Xr zoneadm 1m ,
479.Xr zonecfg 1m ,
480.Xr zonestatd 1m ,
481.Xr libzonestat 3lib ,
482.Xr timezone 4 ,
483.Xr privileges 5 ,
484.Xr resource_controls 5 ,
485.Xr zones 5
486