Home / Solaris 10 / Solaris Local zone wise Memory & CPU usage details using script

Solaris Local zone wise Memory & CPU usage details using script

I am sure many of the Solaris administrator will break their head in a order to find Solaris local zones wise resource utilization details. Because there is no simple to tool to find these details in Solaris 10. I just come across  Jeff Victor’s Blog and found this script which will be very useful in our daily Unix administration,This script will help you to find resource consumption of each Solaris local zone from global zone level.This script will give following information:
1.CPU Pool size
2.Capped Physical Memory  (aka RAM)
3.Used Physical Memory
4.Capped Swap space (Virtual Memory aka VM)
3.Used shared memory 
4.Locked Memory 
5.Used Swap space (aka virtual memory)Here i will demonstrate how to use this script and explanation about each fields in zonestat script output. 

Download the zonestat.pl script and make it executable. Here is the sample output of the script. 
I just demonstrated that in what are the ways we can  use this script .

bash-3.00# ./zonestat.pl
        |--Pool--|Pset|-------Memory-----|
Zonename| IT|Size|Used| RAM| Shm| Lkd| VM|
------------------------------------------
  global  0D    2  0.0 103M 256K 258K 431M
    sol1  0D    2  0.0  82M  0.0  0.0 169M
==TOTAL= ---    2  0.1 185M 256K 258K 1.2G

bash-3.00# ./zonestat.pl -l
        |----Pool-----|---CPU-----|----------------Memory----------------|
        |---|--Size---|Pset-------|---RAM---|---Shm---|---Lkd---|---VM---|
Zonename| IT| Max| Cur|Used|Shr|S%| Cap|Used| Cap|Used| Cap|Used| Cap|Used
--------------------------------------------------------------------------
  global  0D    2    2  0.1   1 50       91M  18E 256K  18E 258K  18E 423M
    sol1  0D    2    2  0.0   1 50       77M  18E  0.0  18E  0.0  18E 169M
==TOTAL= --- ----    2  0.1 --- -- 789M 168M 789M 256K 755M 258K 1.3G 1.2G

bash-3.00# ./zonestat.pl interval 4
        |--Pool--|Pset|-------Memory-----|
Zonename| IT|Size|Used| RAM| Shm| Lkd| VM|
------------------------------------------
  global  0D    2  0.0  92M 256K 258K 423M
    sol1  0D    2  0.0  76M  0.0  0.0 169M
==TOTAL= ---    2  0.0 168M 256K 258K 1.2G
--------
  global  0D    2  0.0  91M 256K 258K 423M
    sol1  0D    2  0.0  75M  0.0  0.0 169M
==TOTAL= ---    2  0.0 166M 256K 258K 1.2G
--------
  global  0D    2  0.0  91M 256K 258K 423M
    sol1  0D    2  0.0  75M  0.0  0.0 169M
==TOTAL= ---    2  0.0 166M 256K 258K 1.2G
--------
  global  0D    2  0.0  91M 256K 258K 423M
    sol1  0D    2  0.0  75M  0.0  0.0 169M
==TOTAL= ---    2  0.0 166M 256K 258K 1.2G

You have the help option to know the each fields in zonestat command output.

bash-3.00# ./zonestat.pl -help

 Usage: zonestat [-h] | [-l] [interval [count]]
        -h: usage information
        -l: display columns showing the configured limits

Output with -l option:
        |----Pool-----|------CPU-------|----------------Memory----------------|
        |---|--Size---|-----Pset-------|---RAM---|---Shm---|---Lkd---|---VM---|
Zonename| IT| Max| Cur| Cap|Used|Shr|S%| Cap|Used| Cap|Used| Cap|Used| Cap|Used

Pool: information about the Solaris Resource Pool to which the zone is assigned.
   I: Pool identification number for this zone's pool
   T: Type of pool: D=Default, P=Private (temporary), S=Shared
 Max: Maximum number of CPUs configured for this zone's pool
 Cur: Current number of CPUs configured for this zone's pool

CPU: information about CPU controls and usage
  Cap: CPU-cap for the zone
 Used: Amount of CPU power consumed by the zone recently
  Shr: Number of FSS shares assigned to this zone
   S%: Percentage of this pool's CPU cycles for this zone ('HH' = 100%)

Memory: information about memory controls and usage
 RAM: Physical memory information
   Cap: Maximum amount of RAM this zone can use
  Used: Amount of RAM this zone is using
 Shm: Shared memory information
   Cap: Maximum amount of shared memory this zone can use
  Used: Amount of shared memory this zone is using
 Lkd: Locked memory information
   Cap: Maximum amount of locked memory this zone can use
  Used: Amount of locked memory this zone is using
 VM: Virtual memory information
   Cap: Maximum amount of virtual memory this zone can use
  Used: Amount of virtual memory this zone is using

Thank you for reading this. Please leave a comment if you have any doubt on this.I will get back to you .

VMTURBO-CLOUD-CAPACITY

4 comments

  1. Hello,
    thank you for writing this script first off.
    my question is, I would love to run this script you have written, but I am finding it hard finding the zonestat pkg to install…. Can you point me in the right direction to find zonestat and install that first?

    thank you

    Paul….

    • As per my knowledge,zonestat package available from Solaris 11. For Solaris 10 , you need to use the script what i have attached

      Regards
      Lingeswaran

  2. Hi…

    Thanks for sharing the alternative method to execute zonestat command in Solaris 10.

    I am unable to download the perl script, getting “Server Not Found” error. Can u share the file via mail..

Leave a Reply

Your email address will not be published. Required fields are marked *