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

       # zonestat -p -P zones -r psets 5 1

.Ed
.Pp
Example 3:  Report on the default pset.
.Pp
The following command will report on the default pset once a second
for one minute.
.Bd -literal

       # zonestat -r default-pset 1 1m

.Ed
.Pp
Example 4:  Report total and high utilization.
.Pp
The following command monitors silently at a 10 second interval
for 24 hours, producing a total and high report every 1 hour.
.Bd -literal

       # zonestat -q -R total,high 10s 24h 1h

.Ed
.Sh INTERFACE STABILITY
Command invocation and parsable output is Committed.
Human readable output (default output) is uncommitted.
.Sh SECURITY
When run from within a non-global zone (NGZ), only processor sets
visible to the NGZ are reported.
The NGZ output will include all of other system resources, such as memory and
limits.
.Pp
For all reported resources, the NGZ's usage will be output.
Usage of each resource by the system, global zone, and all other
zones, will be reported as used by
.Em system .
.Sh SEE ALSO
.Xr date 1 ,
.Xr prctl 1 ,
.Xr libzonestat 3lib ,
.Xr timezone 5 ,
.Xr privileges 7 ,
.Xr resource_controls 7 ,
.Xr zones 7 ,
.Xr pooladm 8 ,
.Xr poolcfg 8 ,
.Xr rcapadm 8 ,
.Xr zoneadm 8 ,
.Xr zonecfg 8 ,
.Xr zonestatd 8