Quick Way to easily see memory, cpu, and swap usage in AIX ?
Today we will see some quick commands to see CPU, memory, and swap/pagefile usage in AIX.
Lets have a look at them one by one.
1. CPU Usage
To analyze the CPU usage quickly on an AIX system, we can use sar command.
Lets say, “sar -u 1 10” to analyze CPU usage for 10 seconds.
ngeaix001 --> uname -a AIX ngeaix001 1 7 00CFC3174C9911 ngeaix001 --> ngeaix001 --> sar -u 1 10 AIX ngeaix001 1 7 00CFC3174C9911 10/18/21 System configuration: lcpu=16 ent=0.20 mode=Uncapped 12:57:04 %usr %sys %wio %idle physc %entc 12:57:05 41 20 0 39 1.57 786.4 12:57:06 42 20 0 38 1.47 734.0 12:57:07 42 18 0 39 1.61 804.4 12:57:08 43 19 0 38 1.60 800.3 12:57:09 43 17 0 40 1.58 789.5 12:57:10 41 19 0 40 1.67 833.8 12:57:11 43 19 0 39 1.64 819.2 12:57:12 40 18 0 42 1.79 895.4 12:57:13 43 18 0 39 1.55 775.1 12:57:14 45 17 0 38 1.63 813.3 Average 42 18 0 39 1.61 805.3 ngeaix001 -->
Hence here we can see only 39% cpu is idle, and rest is used by the system.
2. Check out Paging/Swap Usage.
To quickly check how much paging space is used on the system, we can use “lsps or, prtconf” command.
ngeaix002--> lsps -a Page Space Physical Volume Volume Group Size %Used Active Auto Type Chksum hd6 hdisk0 rootvg 12288MB 63 yes yes lv 0
ngeaix001 --> prtconf System Model: IBM,9080-MHE Machine Serial Number: 01AB123 Processor Type: PowerPC_POWER8 Processor Implementation Mode: POWER 8 Processor Version: PV_8_Compat Number Of Processors: 2 Processor Clock Speed: 4024 MHz CPU Type: 64-bit Kernel Type: 64-bit LPAR Info: 286 ngeaix001_NGELDB Memory Size: 14336 MB Good Memory Size: 14336 MB Platform Firmware level: SC860_205 Firmware Version: IBM,FW860.70 (SC860_205) Console Login: enable Auto Restart: true Full Core: false Network Information Host Name: ngeaix001 IP Address: 10.56.49.182 Sub Netmask: 255.255.240.0 Gateway: 10.56.48.3 Name Server: Domain Name: Paging Space Information Total Paging Space: 10240MB Percent Used: 1% Volume Groups Information ============================================================================== Active VGs ============================================================================== backupvg: PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk4 active 5438 6 00..00..00..00..06 ============================================================================== logsvg: PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk3 active 559 19 00..00..00..00..19 ============================================================================== datavg: PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk2 active 7919 4 00..00..00..00..04 ============================================================================== productsvg: PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk1 active 1118 0 00..00..00..00..00 ============================================================================== rootvg: PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk0 active 319 61 23..00..00..00..38 ============================================================================== INSTALLED RESOURCE LIST The following resources are installed on the machine. +/- = Added or deleted from Resource List. * = Diagnostic support not available. Model Architecture: chrp Model Implementation: Multiple Processor, PCI bus + sys0 System Object + sysplanar0 System Planar * vio0 Virtual I/O Bus * ent2 U9080.MHE.01AB123-V286-C13-T1 Virtual I/O Ethernet Adapter (l-lan) * ent1 U9080.MHE.01AB123-V286-C12-T1 Virtual I/O Ethernet Adapter (l-lan) * ent0 U9080.MHE.01AB123-V286-C11-T1 Virtual I/O Ethernet Adapter (l-lan) * vsa0 U9080.MHE.01AB123-V286-C0 LPAR Virtual Serial Adapter * vty0 U9080.MHE.01AB123-V286-C0-L0 Asynchronous Terminal + fcs0 U9080.MHE.01AB123-V286-C20-T1 Virtual Fibre Channel Client Adapter + fscsi0 U9080.MHE.01AB123-V286-C20-T1 FC SCSI I/O Controller Protocol Device * hdisk1 U9080.MHE.01AB123-V286-C20-T1-W22210002AC00C71D-L1000000000000 3PAR InServ Virtual Volume * hdisk2 U9080.MHE.01AB123-V286-C20-T1-W22210002AC00C71D-L2000000000000 3PAR InServ Virtual Volume * hdisk3 U9080.MHE.01AB123-V286-C20-T1-W22210002AC00C71D-L3000000000000 3PAR InServ Virtual Volume * hdisk4 U9080.MHE.01AB123-V286-C20-T1-W22210002AC00C71D-L4000000000000 3PAR InServ Virtual Volume * sfwcomm0 U9080.MHE.01AB123-V286-C20-T1-W0-L0 Fibre Channel Storage Framework Comm * hdisk0 U9080.MHE.01AB123-V286-C20-T1-W22210002AC00C71D-L0 3PAR InServ Virtual Volume + fcs1 U9080.MHE.01AB123-V286-C21-T1 Virtual Fibre Channel Client Adapter + fscsi1 U9080.MHE.01AB123-V286-C21-T1 FC SCSI I/O Controller Protocol Device * sfwcomm1 U9080.MHE.01AB123-V286-C21-T1-W0-L0 Fibre Channel Storage Framework Comm + L2cache0 L2 Cache + mem0 Memory + proc0 Processor + proc8 Processor ngeaix001 --> prtconf | more System Model: IBM,9080-MHE Machine Serial Number: 01AB123 Processor Type: PowerPC_POWER8 Processor Implementation Mode: POWER 8 Processor Version: PV_8_Compat Number Of Processors: 2 Processor Clock Speed: 4024 MHz CPU Type: 64-bit Kernel Type: 64-bit LPAR Info: 286 ngeaix001_NGELDB Memory Size: 14336 MB Good Memory Size: 14336 MB Platform Firmware level: SC860_205 Firmware Version: IBM,FW860.70 (SC860_205) Console Login: enable Auto Restart: true Full Core: false Network Information Host Name: ngeaix001 IP Address: 10.56.49.182 Sub Netmask: 255.255.240.0 Gateway: 10.56.48.3 Name Server: Domain Name: Paging Space Information Total Paging Space: 10240MB Percent Used: 1% Volume Groups Information ============================================================================== Active VGs ============================================================================== backupvg: PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk4 active 5438 6 00..00..00..00..06 ============================================================================== logsvg: PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk3 active 559 19 00..00..00..00..19 ============================================================================== datavg: PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk2 active 7919 4 00..00..00..00..04 ============================================================================== productsvg: PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk1 active 1118 0 00..00..00..00..00 ============================================================================== rootvg: PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk0 active 319 61 23..00..00..00..38 ============================================================================== INSTALLED RESOURCE LIST The following resources are installed on the machine. +/- = Added or deleted from Resource List. * = Diagnostic support not available. Model Architecture: chrp Model Implementation: Multiple Processor, PCI bus + sys0 System Object + sysplanar0 System Planar * vio0 Virtual I/O Bus * ent2 U9080.MHE.01AB123-V286-C13-T1 Virtual I/O Ethernet Adapter (l-lan) * ent1 U9080.MHE.01AB123-V286-C12-T1 Virtual I/O Ethernet Adapter (l-lan) * ent0 U9080.MHE.01AB123-V286-C11-T1 Virtual I/O Ethernet Adapter (l-lan) * vsa0 U9080.MHE.01AB123-V286-C0 LPAR Virtual Serial Adapter * vty0 U9080.MHE.01AB123-V286-C0-L0 Asynchronous Terminal + fcs0 U9080.MHE.01AB123-V286-C20-T1 Virtual Fibre Channel Client Adapter + fscsi0 U9080.MHE.01AB123-V286-C20-T1 FC SCSI I/O Controller Protocol Device * hdisk1 U9080.MHE.01AB123-V286-C20-T1-W22210002AC00C71D-L1000000000000 3PAR InServ Virtual Volume * hdisk2 U9080.MHE.01AB123-V286-C20-T1-W22210002AC00C71D-L2000000000000 3PAR InServ Virtual Volume * hdisk3 U9080.MHE.01AB123-V286-C20-T1-W22210002AC00C71D-L3000000000000 3PAR InServ Virtual Volume * hdisk4 U9080.MHE.01AB123-V286-C20-T1-W22210002AC00C71D-L4000000000000 3PAR InServ Virtual Volume * sfwcomm0 U9080.MHE.01AB123-V286-C20-T1-W0-L0 Fibre Channel Storage Framework Comm * hdisk0 U9080.MHE.01AB123-V286-C20-T1-W22210002AC00C71D-L0 3PAR InServ Virtual Volume + fcs1 U9080.MHE.01AB123-V286-C21-T1 Virtual Fibre Channel Client Adapter + fscsi1 U9080.MHE.01AB123-V286-C21-T1 FC SCSI I/O Controller Protocol Device * sfwcomm1 U9080.MHE.01AB123-V286-C21-T1-W0-L0 Fibre Channel Storage Framework Comm + L2cache0 L2 Cache + mem0 Memory + proc0 Processor + proc8 Processor ngeaix001 -->
3. Memory Usage Check
nmon is one of the best tool to analyze the memory usage in AIX.
After running nmon, press m to see memory usage.
ngeaix001 --> nmon ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ ------------------------------ │ │ N N M M OOOO N N For online help type: h │ │ NN N MM MM O O NN N For command line option help: │ │ N N N M MM M O O N N N quick-hint nmon -? │ │ N N N M M O O N N N full-details nmon -h │ │ N NN M M O O N NN To start nmon the same way every time? │ │ N N M M OOOO N N set NMON ksh variable, for example: │ │ ------------------------------ export NMON=cmt │ │ TOPAS_NMON │ │ 16 - CPUs currently │ │ 16 - CPUs configured │ │ 4024 - MHz CPU clock rate │ │ PowerPC_POWER8 - Processor │ │ 64 bit - Hardware │ │ 64 bit - Kernel │ │ 286,ngeaix001_DCCDEV5_MDM_INT_F - Logical Partition │ │ 7.1.5.38 TL05 - AIX Kernel Version │ │ ngeaix001 - Hostname │ │ ngeaix001 - Node/WPAR Name │ │ 01AB123 - Serial Number │ │ IBM,9080-MHE - Machine Type │ │ │ │ │ │ │ │ │ │ │ └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ ┌─topas_nmon──0=reset-peaks──────Host=ngeaix001───────Refresh=2 secs───13:09.48──────────────────────────────────────────────────────────┐ │ Memory ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│ │ Physical PageSpace | pages/sec In Out | FileSystemCache │ │% Used 89.9% 1.1% | to Paging Space 0.0 0.0 | (numperm) 8.1% │ │% Free 10.1% 98.9% | to File System 0.0 0.0 | Process 63.9% │ │MB Used 12886.6MB 111.3MB | Page Scans 0.0 | System 17.9% │ │MB Free 1449.4MB 10128.7MB | Page Cycles 0.0 | Free 10.1% │ │Total(MB) 14336.0MB 10240.0MB | Page Steals 0.0 | ------ │ │ | Page Faults 256.0 | Total 100.0% │ │------------------------------------------------------------ | numclient 8.1% │ │Min/Maxperm 405MB( 3%) 12142MB( 90%) <--% of RAM | maxclient 90.0% │ │Min/Maxfree 960 1088 Total Virtual 24.0GB | User 66.9% │ │Min/Maxpgahead 2 8 Accessed Virtual 11.1GB 46.2%| Pinned 24.1% │ │ | lruable pages 3453760.0 │ │───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ngeaix001 --> ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ ### Checking out top processes consuming memory ngeaix001 --> ps -ef -o "vsz rssize pmem pid comm" | sort -nr | head 141580 141708 1.0 22151620 java 124984 125112 1.0 10223870 java 124976 302576 2.0 8782264 oracle 58800 236400 2.0 60293268 oracle 40048 217648 2.0 11731444 oracle 39028 35224 0.0 5046522 qualys-cloud-agent 33904 211504 2.0 24707496 oracle 26892 58708 0.0 6094852 BESClient 22064 199664 2.0 16974088 oracle 21552 199152 2.0 1311230 oracle
So here we have seen one of the most quick ways to check cpu, memory and pagefile size in AIX.
There are many ways to analyze this on the system, and we can surely use any other way.