Linux e Unix: Ferramentas de Monitoracao e Performance

From Wiki
Revision as of 12:02, 13 September 2016 by Ebasso (talk | contribs) (→‎Ver também)

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

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


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/

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
...

svmon

Uso de VM pelos processos: svmon -P -O summary=basic,unit=MB svmon -P PID http://pic.dhe.ibm.com/infocenter/aix/v6r1/index.jsp?topic=%2Fcom.ibm.aix.prftungd%2Fdoc%2Fprftungd%2Fmem_use_processes.htm

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