7 Ways to find CPU information from Solaris

Ramdev

I have started unixadminschool.com ( aka gurkulindia.com) in 2009 as my own personal reference blog, and later sometime i have realized that my leanings might be helpful for other unixadmins if I manage my knowledge-base in more user friendly format. And the result is today's' unixadminschool.com. You can connect me at - https://www.linkedin.com/in/unixadminschool/

Loading Facebook Comments ...

3 Responses

  1. Cicuta says:

    You missed Using prtconf
    Based on the installed drivers, you can find the information on the CPUs on the system.

    Here are some other good commands for hardware information and troubleshooting:

    usr/platform/`uname -i`/

    sbin/prtdiag -v (sun4u and sun4d only)

    arch -k

    isainfo -v

    dmesg

    iostat -En … This command is excellent to see overload of CPUs and paging and without the n switch is good to pintpoint which drive is giving problems (amber LED flashes to indicate the bad drive)

    prtfru

    cfgadm -l

    /etc/path_to_inst …….Note: This particular file must not be changed but is always a good idea to keep a backup at a different location. The file gets recycled every time the system reboots and if anything has changed hardware wise it will incorporate those changes in the file. It maps every single physical device to its logical name. It is the most important file in the system.

    Here is the link on “How to Recover From a Corrupted /etc/path_to_inst File”

    http://docs.oracle.com/cd/E19050-01/sun.cluster31/819-1405/auto22/index.html

    Have a good day and fun!

  2. Cicuta says:

    Errata:
    Actually is for I/O statistics and without the n is to pinpoint a bad drive. The command for CUP load and paging among other things is vmstat.

  3. Ben Audet says:

    Il my opinion, it lacks the most interesting CPU information in this post… …which is CPU usage! The most interesting commands in Solaris to do so are:

    The “mpstat” command, which shows usage for each CPU thread in real time (if you mention time interval as option to the command):

    # mpstat
    CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys st idl
    0 7 0 317 236 7 96 1 10 43 0 371 2 7 0 91
    1 31 0 269 60 3 343 1 35 65 1 909 6 3 0 92
    2 14 0 141 34 5 222 1 13 26 0 740 2 2 0 96
    3 7 0 68 22 1 70 0 8 14 0 179 1 1 0 98
    4 8 0 90 31 4 69 0 10 23 0 157 1 1 0 98
    5 28 0 248 69 4 270 1 29 60 1 701 4 3 0 93
    6 17 0 94 38 4 70 1 10 34 0 293 4 1 0 94
    7 8 0 82 23 4 96 0 10 17 0 323 1 1 0 98
    8 7 0 128 106 80 70 0 10 16 0 190 2 1 0 97
    9 11 0 74 25 2 87 0 10 22 0 224 2 1 0 97
    10 28 0 376 70 6 360 1 29 58 1 1103 5 3 0 92
    11 21 0 152 37 2 120 1 11 27 0 353 3 1 0 96
    12 7 0 140 28 3 67 0 11 16 0 135 1 1 0 98
    13 12 0 101 28 2 105 0 14 35 0 289 2 1 0 97
    14 28 0 253 73 6 226 1 31 50 1 561 4 2 0 94
    15 23 0 178 35 2 171 1 13 24 0 705 3 2 0 95
    16 12 0 120 33 1 154 0 15 28 0 423 3 1 0 96
    17 9 0 81 29 4 84 0 10 13 0 151 1 1 0 98
    18 10 0 79 35 4 74 0 9 22 0 179 1 1 0 98
    19 29 0 337 68 5 300 1 44 78 1 681 4 2 0 93
    20 13 0 286 33 2 71 0 10 25 0 261 3 1 0 96
    21 7 0 93 31 4 72 0 12 18 0 164 1 1 0 98
    22 11 0 158 32 2 68 0 11 22 0 161 3 1 0 96
    23 40 0 288 86 6 309 1 39 60 1 812 5 3 0 93
    24 30 0 266 64 3 329 1 32 57 1 763 5 2 0 92
    25 12 0 108 39 2 121 1 10 22 0 333 4 1 0 95
    26 6 0 104 26 3 47 0 8 19 0 105 3 1 0 96
    27 18 0 83 37 2 154 1 16 25 0 368 3 1 0 95
    28 27 0 244 71 5 196 1 22 72 1 765 7 2 0 91
    29 11 0 101 36 2 171 0 15 31 0 363 2 1 0 97
    30 6 0 37 21 3 43 0 8 12 0 98 1 0 0 99
    31 8 0 43 23 2 75 0 11 20 0 265 1 1 0 98

    In my opinion, this is the most interesting command related to CPUs in Solaris: it can show you, for example, if your applications are using threading, or if some threads are draining the whole machine down on CPU point of vue.

    The “prstat” command. There is so many options to use with this command to drill down CPU (and other resources) usage by processes, zones, and so on!! Just as an intro, just go with the most easy one: “prstat -a” will show you top processes with resource usage (RSS memory, CPU, etc.), and in the bottom of the page, you’ll find a global summary:

    # prstat -a
    PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
    1333 root 1060M 895M sleep 59 0 0:02:30 4.6% java/106
    5 root 0K 0K sleep 99 -20 0:00:08 0.0% zpool-rpool/190
    598 root 0K 0K sleep 99 -20 0:00:04 0.0% zpool-opscenter/190
    1385 root 34M 17M sleep 59 0 0:00:00 0.0% pkg.depotd/64
    878 root 5472K 4336K sleep 59 0 0:00:00 0.0% login/2
    689 root 25M 15M sleep 59 0 0:00:00 0.0% ldmd/16
    15 root 25M 25M sleep 59 0 0:01:22 0.0% svc.configd/28
    6 root 0K 0K sleep 99 -20 0:00:00 0.0% kmem_task/1
    1550 root 11M 8040K cpu5 49 0 0:00:00 0.0% prstat/1
    869 root 39M 30M sleep 59 0 0:00:06 0.0% fmd/38
    468 root 20M 10M sleep 59 0 0:00:01 0.0% nscd/32
    137 root 3608K 2712K sleep 60 -20 0:00:00 0.0% zonestatd/5
    87 root 10M 1952K sleep 59 0 0:00:00 0.0% in.mpathd/1
    58 netadm 5400K 4648K sleep 59 0 0:00:00 0.0% ipmgmtd/6
    43 netcfg 4664K 4088K sleep 59 0 0:00:00 0.0% netcfgd/4
    NPROC USERNAME SWAP RSS MEMORY TIME CPU
    61 root 1257M 1155M 14% 0:05:05 4.7%
    5 webservd 17M 14M 0.2% 0:00:00 0.0%
    5 daemon 5336K 18M 0.2% 0:00:00 0.0%
    2 netadm 4184K 14M 0.2% 0:00:00 0.0%
    1 netcfg 1992K 4744K 0.1% 0:00:00 0.0%
    Total: 79 processes, 930 lwps, load averages: 1.95, 1.01, 0.43

    Use “prstat -Z” for a summary for each non-global zones on the machine as well…:

    # prstat -Z
    PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
    29969 baudet 7552K 5088K sleep 59 0 0:00:00 0.5% sshd/1
    29990 root 4040K 3192K cpu0 49 0 0:00:00 0.4% prstat/1
    29979 root 3456K 2528K sleep 49 0 0:00:00 0.2% bash/1
    4463 noaccess 139M 92M sleep 59 0 14:40:48 0.2% java/18
    3142 101 48M 18M sleep 59 0 13:53:13 0.2% mysqld/10
    1014 noaccess 147M 96M sleep 59 0 14:58:35 0.2% java/18
    137 daemon 5040K 2800K sleep 59 0 0:00:06 0.2% kcfd/4
    2714 root 38M 33M sleep 59 0 2:38:01 0.1% named/4
    5 root 0K 0K sleep 99 -20 16:24:46 0.1% zpool-rpool/37
    29975 baudet 3456K 2496K sleep 59 0 0:00:00 0.1% bash/1
    29968 root 5592K 3576K sleep 59 0 0:00:00 0.1% sshd/1
    3400 root 2872K 1968K sleep 59 0 6:05:49 0.0% in.routed/1
    152 root 7640K 4528K sleep 59 0 1:07:18 0.0% nscd/33
    15945 root 9592K 3152K sleep 59 0 0:14:33 0.0% sendmail/1
    263 root 3088K 1920K sleep 100 – 1:12:00 0.0% xntpd/1
    2510 daemon 5208K 2128K sleep 59 0 0:36:34 0.0% nfsmapid/4
    3534 root 9920K 1216K sleep 59 0 0:37:38 0.0% snmpd/1
    2864 root 4336K 1168K sleep 59 0 2:03:29 0.0% ipmon/1
    2976 daemon 5208K 2136K sleep 59 0 0:37:16 0.0% nfsmapid/4
    284 root 3408K 1736K sleep 59 0 0:31:41 0.0% cron/1
    3544 root 9584K 3096K sleep 59 0 0:20:59 0.0% sendmail/1
    3464 root 9584K 3080K sleep 59 0 0:21:48 0.0% sendmail/1
    3296 daemon 6392K 2312K sleep 59 0 0:41:24 0.0% nfsmapid/5
    2885 root 9400K 6952K sleep 59 0 1:05:54 0.0% nscd/37
    15648 root 7520K 4312K sleep 59 0 0:22:35 0.0% nscd/29
    3974 root 9584K 3088K sleep 59 0 0:23:06 0.0% sendmail/1
    15746 daemon 5216K 2120K sleep 59 0 0:23:20 0.0% nfsmapid/4
    ZONEID NPROC SWAP RSS MEMORY TIME CPU ZONE
    0 48 219M 145M 9.4% 38:11:16 1.8% global
    4 33 206M 165M 11% 20:13:54 0.4% svprdns01
    1 29 78M 39M 2.6% 16:50:53 0.2% svprsql01
    2 31 47M 32M 2.1% 21:03:34 0.1% svprfrw01
    9 27 42M 28M 1.8% 2:28:01 0.0% svprweb01

    As well, you can use “sar” to output global percentage usage of CPU resource (as an average usage for all CPUs). Default behavior of “sar” is for CPU usage, but explicitly, use the “-u” option to show it:

    # sar

    SunOS orion 5.10 Generic_144488-17 sun4u 01/29/2015

    00:00:00 %usr %sys %wio %idle
    00:01:00 2 7 0 91
    00:02:01 1 2 0 97
    00:03:00 1 2 0 97
    00:04:00 1 2 0 97

    01:25:01 30 12 0 58
    01:26:01 32 17 0 52
    01:27:00 30 12 0 58
    01:28:00 30 12 0 58
    01:29:01 31 12 0 57

    08:37:00 5 4 0 91
    08:38:00 15 8 0 77
    08:39:00 23 11 0 66
    08:40:01 23 11 0 66
    08:41:00 13 12 0 75

    Average 3 4 0 93

    The “vmstat” command as well, will show you CPU usage a bit like “sar” does (at the right-end part):

    # vmstat
    kthr memory page disk faults cpu
    r b w swap free re mf pi po fr de sr s0 s3 s3 — in sy cs us sy id
    0 0 3 3771544 61488 20 85 0 0 0 0 1 3 3 -0 0 507 290 235 2 4 94

    And yes, this is a SHORT list!! We could pass a big part of the day drilling it down… Solaris is a MONSTER of resource management!!!

Leave a Reply

Your email address will not be published.

[contact-form to='ramkumar.ramadevu@gmail.com' subject='New Learning Request Submitted'][contact-field label='Name' type='name' required='1'/][contact-field label='Email' type='email' required='1'/][contact-field label='Learning Request' type='textarea' required='1'/][contact-field label='Are you Looking for ' type='radio' required='1' options='Paid Training,Free Training'/][/contact-form]

What is your Learning Goal for Next Six Months ? Talk to us