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