Linux e Unix: Ferramentas de Monitoracao e Performance

From Wiki
Revision as of 11:54, 27 July 2024 by Ebasso (talk | contribs) (→‎AIX - svmon)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Informações sobre processos - Information about process

  • top (Linux)
  • nmon (Linux)
  • topas (AIX)
  • topas_nmon (AIX)

VM Statistics & CPU

  • vmstat (Linux/AIX)


Exemplo Linux:

Usage: vmstat [-V] [-n] [delay [count]]
# vmstat 
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
2  0      0 1226172  94704 991204    0    0    41    18  423  791  5  3 91  1

# vmstat  5
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
0  0      0 1226056  94920 991244    0    0    41    18  423  790  5  3 91  1
0  0      0 1226048  94936 991244    0    0     0    12  479  802  1  1 97  1
0  0      0 1225800  94936 991244    0    0     0     1  513  849  1  1 97  0

Exemplo AIX

# vmstat -lwt 5

I/O Statistics & Activity

  • iostat (Linux/AIX)
# sudo apt-get install sysstat
# iostat -x 
Linux 2.6.32-24-generic (ebasso) 	16-09-2010 	_i686_	(2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          5,02    0,23    2,92    1,18    0,00   90,65

Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm   %util
sda              14,34     7,04    2,30    2,79   162,32    77,42    47,04     0,13   25,97   5,01    2,56

# iostat 30 120 > iostat.out & 
 120 coletas a cada 30 segundos


  • dstat (Linux)
# dstat -D sde1,sdf1,sdg1,sdh1,sdi1 

You did not select any stats, using -cdngy by default.
 [7l----total-cpu-usage---- --dsk/'''sde1'''- --dsk/'''sdf1'''- --dsk/'''sdg1'''- --dsk/'''sdh1'''- --dsk/'''sdi1'''- -net/total- ---paging-- ---system--
 usr sys idl wai hiq siq| read  writ: read  writ: read  writ: read  writ: read  writ| recv  send|  in   out | int   csw 
  1   0  99   0   0   0|1122B   82k:3296B   37k:1907B   20k: 103B   52k:  83B    0 |   0     0 |   8B   46B|1009  1924 
 14   1  80   5   0   0|8192B 6184k:7988k 2024k:   0   468k:   0   228k:   0     0 | 143k  166k|   0     0 |7150  5853 
 19   2  75   5   0   0|   0     0 :8304k  168k: 112k  186k:   0   112k:   0     0 |  72k  203k|   0     0 |  19k   31k
 28   2  65   5   0   0|   0     0 :6960k  872k: 516k 1242k:   0  1732k:   0     0 | 240k 1444k|   0     0 |  12k   14k
 21   2  72   5   0   0|  32k    0 :8376k    0 :   0     0 :   0    76k:   0     0 |  60k  692k|   0     0 |  17k   25k
 

Network Statistics & Activity

  • netstat (Linux/AIX)
# netstat -i
Tabela de Interfaces do Kernel
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500 0    181181      0      0 0         24087      0      0      0 BMRU
lo        16436 0         9      0      0 0             9      0      0      0 LRU
tun0       1362 0     14411      0      0 0         14792      0      0      0 MOPRU
vmnet1     1500 0         0      0      0 0           489      0      0      0 BMRU
vmnet8     1500 0         0      0      0 0           489      0      0      0 BMRU


AIX - Topas_nmon

  • topas_nmon (AIX)
# topas_nmon
1 - CPU currently
1 - CPU configured
1904 - MHz CPU clock rate
PowerPC_POWER4 - Processor
64 bit - Hardware
32 bit - Kernel
7,P0307_HOMOL_TST_XXXXX - Logical Partition
5.3.12.1 TL12 - AIX Kernel Version
xxxx3007 - Hostname
xxxx3007 - Node/WPAR Name
0231EDD - Serial Number
IBM,7040-681 - Machine Type


Análise dos arquivos que estão no /var/nmon do AIX: http://www.ibm.com/developerworks/aix/library/au-nmon_analyser/

AIX - prtconf

  • prtconf (AIX)
# prtconf

System Model: IBM,7040-681
Machine Serial Number: 0231EDD
Processor Type: PowerPC_POWER4
Processor Implementation Mode: POWER 4
Processor Version: PV_4_2
Number Of Processors: 1
Processor Clock Speed: 1904 MHz
CPU Type: 64-bit
Kernel Type: 32-bit
LPAR Info: 7 P0307_HOMOL_TST_COLAB1
Memory Size: 16384 MB
Good Memory Size: 16384 MB
Platform Firmware level: 3H050715
Firmware Version: IBM,RG050715_d79e12_r
Console Login: enable
Auto Restart: true
Full Core: false
...

AIX - svmon

Uso de VM pelos processos:

svmon -P -O summary=basic,unit=MB
svmon -P PID

Detalhes em http://pic.dhe.ibm.com/infocenter/aix/v6r1/index.jsp?topic=%2Fcom.ibm.aix.prftungd%2Fdoc%2Fprftungd%2Fmem_use_processes.htm

AIX - Quantidade de CPU no AIX por LPAR

lparstat -i

Verificar por online ...

Memória Livre no AIX

Criar um arquivo showFreeMemory.sh

vi showFreeMemory.sh

colar esse conteúdo:

memory=`prtconf -m | awk 'BEGIN {FS=" "} {print $3/1024}'`
usedmem=`svmon -G | grep memory | awk 'BEGIN {FS=" "} {print $3/256/1024}'`
freemem=`echo $memory-$usedmem | bc -l`

# Conclusion
echo "Avai Mem: $memory GB"
echo "Free Mem: $freemem GB"
echo "Used Mem: $usedmem GB"

Salvar

Alterar a permissão

chmod 755 showFreeMemory.sh

saida é isso:

Avai Mem: 8 GB
Free Mem: 2.24053 GB
Used Mem: 5.75947 GB	16:29:02

Ver também