Getting your Trinity Audio player ready... |
In this post we are going to see about how to check top process in solaris.While there are many tools available to check top process but we are going to have focus on two commands.
First Command in our list prstat command in solaris and 2nd command will be ps command in solaris.
Table of Contents
prstat command in solaris
prstat command in solaris is especially available for system administrators .It comes under system administration category of command. prstat utility is really handy and especially designed for process monitoring.
Let us see small portion of prstat man command to see what are the options available.Since man page of prstat is too long so it is not feasible to add too long man page output.
# man prstat Reformatting page. Please Wait... done System Administration Commands prstat(1M) NAME prstat - report active process statistics SYNOPSIS prstat [-acHJLmRtTv] [-C psrsetlist] [-h lgrplist] [-j projlist] [-k tasklist] [-n ntop[,nbottom]] [-p pidlist] [-P cpulist] [-s key | -S key ] [-u euidlist] [-U uidlist] [-z zoneidlist] [-Z] [interval [count]] DESCRIPTION The prstat utility iteratively examines all active processes on the system and reports statistics based on the selected output mode and sort order. prstat provides options to examine only processes matching specified PIDs, UIDs, zone IDs,CPU IDs, and processor set IDs. The -j, -k, -C, -p, -P, -u, -U, and -z options accept lists as arguments. Items in a list can be either separated by commas or enclosed in quotes and separated by commas or spaces. If you do not specify an option, prstat examines all processes and reports statistics sorted by CPU usage.
How to find top 10 most active process on CPU
Below command will give the 10 most active process by root ID on CPU1 & CPU2.Syntax of command will be like below.
# prstat -u <ID> -n 10 -P CPU1,CPU2 1 1 # prstat -u root -n 10 -P 1,2 1 1 PID USERNAME SWAP RSS STATE PRI NICE TIME CPU PROCESS/LWP 306 root 3024K 1448K sleep 58 0 0:00.00 0.3% sendmail/1 102 root 1600K 592K sleep 59 0 0:00.00 0.1% in.rdisc/1 250 root 1000K 552K sleep 58 0 0:00.00 0.0% utmpd/1 288 root 1720K 1032K sleep 58 0 0:00.00 0.0% sac/1 1 root 744K 168K sleep 58 0 0:00.00 0.0% init/1 TOTAL: 25, load averages: 0.05, 0.08, 0.12
Please refer to output it will also show how many process is running on server and load average.So you may find the reason from here if any specific process is consuming CPU resource.
How to find top 10 Process usage in Verbose
prstat command in solaris with below switch will displays verbose process usage information about processes with lowest resident set sizes owned by user root.
# prstat -S rss -n 10 -vc -u root PID USERNAME USR SYS TRP TFL DFL LCK SLP LAT VCX ICX SCL SIG PROCESS 1 root 0.0 0.0 - - - - 100 - 0 0 0 0 init/1 102 root 0.0 0.0 - - - - 100 - 0 0 3 0 in.rdisc/1 102 root 0.0 0.0 - - - - 100 - 0 0 3 0 in.rdisc/1 250 root 0.0 0.0 - - - - 100 - 0 0 0 0 utmpd/1 240 root 0.0 0.0 - - - - 100 - 0 0 0 0 powerd/4 TOTAL: 71, load averages: 0.02, 0.04, 0.08 EXIT STATUS The following exit values are returned:0 for Successful completion and 1 for an error occurred.
So let us see some other switch options you can take to have more clear view on cpu utilization.
# prstat -c -t 10 5 NPROC USERNAME SWAP RSS MEMORY TIME CPU 73 root 461M 403M 9.8% 3447:12:0 52% 1 noaccess 86M 90M 2.2% 8:21:19 0.0% 1 mysql 27M 11M 0.3% 8:17:40 0.0% 2 monitors 2504K 5568K 0.1% 1:06:58 0.0% 2 sitescop 3072K 9296K 0.2% 0:00:12 0.0% 10 nobody 5322M 2178M 53% 0:06:52 0.0% 6 daemon 9608K 5704K 0.1% 0:00:25 0.0% Total: 99 processes, 411 lwps, load averages: 1.09, 1.09, 1.11 Lets see other examples. # prstat -mLc PID USERNAME USR SYS TRP TFL DFL LCK SLP LAT VCX ICX SCL SIG PROCESS 16496 root 33 56 11 0.0 0.0 0.0 0.0 0.2 0 497 .1M 0 prstat/1 3224 root 26 0.0 0.0 0.0 0.0 0.0 73 0.2 0 107 6 0 cupsd/1 2262 root 1.9 0.3 0.0 0.0 0.0 97 0.4 0.1 7 14 3K 0 adclient/3 10606 root 1.0 1.2 0.0 0.0 0.0 0.0 98 0.0 10 9 10K 0 splunkd/47 12195 root 1.7 0.2 0.0 0.0 0.0 0.0 98 0.0 23 8 2K 0 BESClient/1 1834 root 0.4 0.0 0.0 0.0 0.0 0.0 100 0.1 9 4 9K 0 adnisd/1 10606 root 0.4 0.0 0.0 0.0 0.0 100 0.0 0.0 2 1 59 0 splunkd/48 10606 root 0.1 0.0 0.0 0.0 0.0 0.0 100 0.0 51 0 255 0 splunkd/43 2262 root 0.1 0.0 0.0 0.0 0.0 100 0.0 0.0 1 0 28 0 adclient/342 2262 root 0.1 0.0 0.0 0.0 0.0 100 0.0 0.0 2 0 28 0 adclient/441 2262 root 0.1 0.0 0.0 0.0 0.0 100 0.0 0.0 1 0 28 0 adclient/416 2262 root 0.1 0.0 0.0 0.0 0.0 100 0.0 0.0 2 0 28 0 adclient/474 2262 root 0.1 0.0 0.0 0.0 0.0 0.0 100 0.0 22 1 81 0 adclient/1 10606 root 0.0 0.0 0.0 0.0 0.0 100 0.0 0.0 5 0 154 0 splunkd/10 12195 root 0.0 0.0 0.0 0.0 0.0 0.0 100 0.0 24 0 49 0 BESClient/7 Total: 99 processes, 410 lwps, load averages: 1.10, 1.10, 1.11
How to check top 10 CPU Consuming Process in Solaris
Well lets finish review of prstat command with bingo kind of options which will give you very clear idea what is happening with server.You will get top 10 CPU Consuming Process in Solaris.
# prstat -s cpu -a -n 10
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
3224 root 7432K 2416K run 0 0 2787:01:1 48% cupsd/1
10606 root 140M 123M sleep 59 0 122:37:52 1.9% splunkd/39
22410 root 4264K 2784K cpu1 59 0 0:00:01 1.7% prstat/1
12195 root 46M 31M sleep 59 0 186:59:31 1.0% BESClient/6
22441 root 7408K 5960K sleep 0 0 0:00:00 0.9% perl/1
22394 root 7896K 6464K sleep 59 0 0:00:00 0.6% perl/1
2262 root 161M 85M sleep 59 0 284:05:37 0.5% adclient/8
22541 root 4824K 3448K run 0 0 0:00:00 0.2% perl/1
2553 noaccess 102M 88M sleep 59 0 8:21:23 0.0% java/18
22439 root 2448K 1704K sleep 59 0 0:00:00 0.0% ctrun/1
NPROC USERNAME SWAP RSS MEMORY TIME CPU
78 root 470M 415M 10% 3448:35:0 55%
1 noaccess 86M 90M 2.2% 8:21:23 0.0%
2 sitescop 3072K 9264K 0.2% 0:00:13 0.0%
2 monitors 2504K 5568K 0.1% 1:06:59 0.0%
Total: 104 processes, 415 lwps, load averages: 1.25, 1.16, 1.14
This looks amazing right first it will display top 10 cpu consuming process in solaris and down to it how much resources used by each process in terms of CPU Memory SWAP and also number of process is running by each process.
ps command in solaris
Please refer to below snap of man page for ps which clearly shows this is for getting process status.
# man ps Reformatting page. Please Wait... done NAME ps - report process status SYNOPSIS ps [-aAcdefjlLPyZ] [-g grplist] [-n namelist] [-o format] [-p proclist] [-s sidlist] [-t term] [-u uidlist] [-U uidlist] [-G gidlist] [-z zonelist] DESCRIPTION The ps command prints information about active processes.Without options, ps prints information about processes that have the same effective user ID and the same controlling terminal as the invoker. The output contains only the process ID, terminal identifier, cumulative execution time, and the command name. Otherwise, the information that is displayed is controlled by the options. Some options accept lists as arguments. Items in a list can be either separated by commas or else enclosed in quotes and separated by commas or spaces. Values for proclist and grplist must be numeric.
Let us see few ps command in solaris examples
How to check all process on solaris
# ps -ef UID PID PPID C STIME TTY TIME CMD root 0 0 0 Sep 19 ? 0:35 sched root 4 0 0 Sep 19 ? 3:03 kmem_task root 1 0 0 Sep 19 ? 158:42 /sbin/init root 2 0 0 Sep 19 ? 2:34 pageout root 3 0 1 Sep 19 ? 6731:01 fsflush root 5 0 0 Sep 19 ? 1:04 vmtasks root 2165 1 0 Sep 19 ? 8:45 /usr/lib/fm/fmd/fmd root 9 1 0 Sep 19 ? 11:42 /lib/svc/bin/svc.startd root 11 1 0 Sep 19 ? 37:42 /lib/svc/bin/svc.configd root 60 1 0 Sep 19 ? 1:55 vxconfigd -x syslog -m boot root 1736 1 0 Sep 19 ? 0:01 /usr/sbin/keyserv root 471 1 0 Sep 19 ? 73:16 /usr/lib/picl/picld root 415 1 0 Sep 19 ? 0:00 /usr/lib/sysevent/syseventd root 1833 1 0 Sep 19 ? 0:00 /usr/lib/netsvc/yp/ypbind root 2039 2038 0 Sep 19 ? 0:00 /usr/sadm/lib/smc/bin/smcboot root 544 1 0 Sep 19 ? 32:08 /sbin/vxesd root 1834 1 0 Sep 19 ? 2605:57 /usr/sbin/adnisd root 1835 1834 0 Sep 19 ? 20:40 niswatch 1834 root 2226 1 0 Sep 19 ? 10:16 /usr/sfw/sbin/snmpd root 1857 1 0 Sep 19 ? 0:00 /lib/svc/method/iscsi-initiator daemon 1860 1 0 Sep 19 ? 0:00 /usr/lib/nfs/nfs4cbd root 440 1 0 Sep 19 ? 12:40 devfsadmd root 2038 1 0 Sep 19 ? 0:00 /usr/sadm/lib/smc/bin/smcboot daemon 423 1 0 Sep 19 ? 0:18 /usr/lib/crypto/kcfd
# ps -aef UID PID PPID C STIME TTY TIME CMD root 0 0 0 Sep 19 ? 0:35 sched root 4 0 0 Sep 19 ? 3:03 kmem_task root 1 0 0 Sep 19 ? 158:42 /sbin/init root 2 0 0 Sep 19 ? 2:34 pageout root 3 0 1 Sep 19 ? 6731:01 fsflush root 5 0 0 Sep 19 ? 1:04 vmtasks root 2165 1 0 Sep 19 ? 8:45 /usr/lib/fm/fmd/fmd root 9 1 0 Sep 19 ? 11:42 /lib/svc/bin/svc.startd root 11 1 0 Sep 19 ? 37:42 /lib/svc/bin/svc.configd root 60 1 0 Sep 19 ? 1:55 vxconfigd -x syslog -m boot root 1736 1 0 Sep 19 ? 0:01 /usr/sbin/keyserv root 471 1 0 Sep 19 ? 73:16 /usr/lib/picl/picld root 415 1 0 Sep 19 ? 0:00 /usr/lib/sysevent/syseventd root 1833 1 0 Sep 19 ? 0:00 /usr/lib/netsvc/yp/ypbind root 2039 2038 0 Sep 19 ? 0:00 /usr/sadm/lib/smc/bin/smcboot root 544 1 0 Sep 19 ? 32:08 /sbin/vxesd root 1834 1 0 Sep 19 ? 2605:57 /usr/sbin/adnisd root 1835 1834 0 Sep 19 ? 20:40 niswatch 1834 root 2226 1 0 Sep 19 ? 10:16 /usr/sfw/sbin/snmpd root 1857 1 0 Sep 19 ? 0:00 /lib/svc/method/iscsi-initiator daemon 1860 1 0 Sep 19 ? 0:00 /usr/lib/nfs/nfs4cbd root 440 1 0 Sep 19 ? 12:40 devfsadmd root 2038 1 0 Sep 19 ? 0:00 /usr/sadm/lib/smc/bin/smcboot daemon 423 1 0 Sep 19 ? 0:18 /usr/lib/crypto/kcfd root 2219 1 0 Sep 19 ? 0:05 /usr/lib/snmp/snmpdx -y -c /etc/snmp/conf daemon 1865 1 0 Sep 19 ? 0:07 /usr/lib/nfs/nfsmapid daemon 1731 1 0 Sep 19 ? 0:00 /usr/sbin/rpcbind root 2040 2038 0 Sep 19 ? 0:00 /usr/sadm/lib/smc/bin/smcboot daemon 1895 1 0 Sep 19 ? 0:00 /usr/lib/nfs/statd root 671 1 0 Jan 20 ? 18:06 /usr/local/apache/bin/httpd nobody 681 671 0 Jan 20 ? 0:07 /usr/local/apache/bin/httpd root 2262 1 0 Sep 19 ? 17043:23 /usr/sbin/adclient root 7476 1 0 Sep 19 ? 0:09 /opt/VRTSsfmh/bin/vxdclid root 2149 1 0 Sep 19 ? 12:13 /usr/sbin/syslogd root 2254 1 0 Sep 19 ? 0:00 /usr/lib/dmi/dmispd root 1950 1941 0 Sep 19 ? 0:18 /usr/lib/saf/ttymon root 10606 1 0 Jun 06 ? 7356:16 splunkd -p 38089 restart nobody 683 671 0 Jan 20 ? 0:04 /usr/local/apache/bin/httpd root 2072 1 0 Sep 19 ? 0:23 /opt/VRTSpbx/bin/pbx_exchange root 2129 2128 0 Sep 19 ? 236:20 /usr/lib/autofs/automountd root 2157 1 0 Sep 19 ? 13:19 /usr/lib/ssh/sshd root 1976 1 0 Sep 19 ? 1:52 /usr/lib/utmpd root 1961 1 0 Sep 19 ? 68:20 /usr/lib/inet/xntpd nobody 686 671 0 Jan 20 ? 0:04 /usr/local/apache/bin/httpd root 4662 1 0 Sep 19 ? 0:00 /sbin/vxcloudd-shadow root 1941 9 0 Sep 19 ? 0:18 /usr/lib/saf/sac -t 300 daemon 1962 1 0 Sep 19 ? 0:00 /usr/lib/nfs/lockd root 1945 1 0 Sep 19 ? 8:57 /usr/lib/inet/inetd start root 2128 1 0 Sep 19 ? 0:00 /usr/lib/autofs/automountd root 2650 1 0 Sep 19 ? 11:27 /usr/sbin/cron root 2263 2262 0 Sep 19 ? 43:49 cdcwatch 2262 -F -M root 2126 1 0 Sep 19 ? 0:00 /usr/sbin/vold -f /etc/vold.conf root 3224 1 50 Sep 19 ? 167169:36 /opt/sfw/cups/sbin/cupsd root 5828 5826 0 Sep 19 ? 0:00 vxnotify -T -f -w 15 nobody 679 671 0 Jan 20 ? 1:57 /usr/local/apache/bin/httpd nobody 682 671 0 Jan 20 ? 0:04 /usr/local/apache/bin/httpd sitescop 19363 19362 0 17:57:48 ? 0:06 /usr/lib/ssh/sshd root 6916 1 0 Sep 19 ? 23:17 /export/opt/ctmagent/ctm/exe/p_ctmag nobody 678 671 0 Jan 20 ? 2:17 /usr/local/apache/bin/httpd nobody 680 671 0 Jan 20 ? 0:04 /usr/local/apache/bin/httpd root 7320 1 0 Sep 19 ? 98:16 /usr/sbin/tictimed root 5826 4669 0 Sep 19 ? 0:10 /sbin/sh - /usr/lib/vxvm/bin/vxrelocd root root 7091 7089 0 Sep 19 ? 7:37 /export/opt/ctmagent/ctm/exe/p_ctmatw -ATW_NAME ATW000 nobody 684 671 0 Jan 20 ? 0:04 /usr/local/apache/bin/httpd root 2836 1 0 Sep 19 ? 113:18 /usr/openv/netbackup/bin/nbdisco root 1946 2157 0 Dec 01 ? 0:12 /usr/lib/ssh/sshd root 4722 1 0 Sep 19 ? 0:00 vxcloudd root 19362 2157 0 17:57:48 ? 0:00 /usr/lib/ssh/sshd root 7744 2157 0 08:59:50 ? 0:02 /usr/lib/ssh/sshd root 7782 7758 0 09:00:05 pts/4 0:00 abash root 12172 1 0 Mar 07 ? 0:00 ypbind nobody 685 671 0 Jan 20 ? 2:15 /usr/local/apache/bin/httpd root 12195 1 1 Nov 25 ? 11218:28 /opt/BESClient/bin/BESClient root 10607 10606 0 Jun 06 ? 129:59 splunkd -p 38089 restart mysql 9307 9286 0 Jan 03 ? 497:41 /usr/local/mysql/libexec/mysqld root 18407 7782 0 16:46:22 pts/4 0:00 ps -aef sitescop 19369 19363 0 17:57:49 pts/3 0:07 bash # ps -aef |sort -nr -k 4 |head -10 root 3224 1 50 Sep 19 ? 167166:46 /opt/sfw/cups/sbin/cupsd root 12195 1 1 Nov 25 ? 11218:24 /opt/BESClient/bin/BESClient root 3 0 1 Sep 19 ? 6730:59 fsflush sitescop 19369 19363 0 17:57:49 pts/3 0:07 bash sitescop 19363 19362 0 17:57:48 ? 0:06 /usr/lib/ssh/sshd
# ps -aef |sort -nr -k 3 |head -10 sitescop 19369 19363 0 17:57:49 pts/3 0:07 bash sitescop 19363 19362 0 17:57:48 ? 0:06 /usr/lib/ssh/sshd root 10607 10606 0 Jun 06 ? 129:59 splunkd -p 38089 restart root 8059 8058 0 Sep 19 ? 0:00 vxnotify root 18235 7782 0 16:43:55 pts/4 0:00 sort -nr -k 3 root 18234 7782 0 16:43:55 pts/4 0:00 ps -aef root 7782 7758 0 09:00:05 pts/4 0:00 abash
So we have gone through and seen how these two commands in solaris can help you to find the answer to how to check top process in solaris.
That`s it for now.If you like our work please subscribe to our blog and share it as much as you can and allow post will be able to help as many as possible.
Please read this as well.