GNU/Linux >> Tutoriales Linux >  >> Ubuntu

Instale y use la herramienta de monitoreo de rendimiento de Collectl en Ubuntu 18.04 LTS

Supervisar los recursos del sistema y el análisis del rendimiento es una tarea importante de cualquier administrador de sistemas. Hay muchas herramientas disponibles para que Linux supervise el rendimiento del sistema, incluidas top, htop, free, etc. disk, memory, network, Infiniband, lustre, memory, nfs, slabs y muchos más. A diferencia de otras herramientas de monitoreo, Collectl se enfoca en un pequeño conjunto de estadísticas. Collectl es capaz de monitorear diferentes parámetros al mismo tiempo y reportarlos de manera adecuada. Collectl viene con una variedad de opciones que lo ayudan a identificar cualquier tipo de problema de rendimiento del sistema. Usando collectl, puede generar la misma salida de mpstat, netstat, nfsstat, sar, ps, top e iostat.

Características

  • Capacidad de mostrar la salida en muchos formatos.
  • Exportar los datos en varios formatos de archivo.
  • Capacidad de ejecutarse como un servicio para monitorear máquinas remotas.
  • Supervise casi cualquier subsistema.

En este tutorial, aprenderemos cómo instalar y usar Collectl en el servidor Ubuntu 18.04.

Requisitos

  • Un servidor con Ubuntu 18.04.
  • Se ha configurado una contraseña de root para su servidor.

Cómo empezar

Antes de comenzar, deberá actualizar su sistema con la última versión. Puede hacerlo ejecutando el siguiente comando:

apt-get update -y
apt-get upgrade -y

Una vez que su servidor esté actualizado, reinícielo para aplicar los cambios.

Instalar Collectl

De forma predeterminada, Collectl está disponible en el repositorio predeterminado de Ubuntu 18.04. Puede instalarlo ejecutando el siguiente comando:

apt-get install collectl -y

Una vez que se haya completado la instalación, puede ejecutar el siguiente comando para enumerar todas las opciones disponibles con collectl:

collectl --h

Debería ver el siguiente resultado:

This is a subset of the most common switches and even the descriptions are
abbreviated.  To see all type 'collectl -x', to get started just type 'collectl'

usage: collectl [switches]
  -c, --count      count      collect this number of samples and exit
  -f, --filename   file       name of directory/file to write to
  -i, --interval   int        collection interval in seconds [default=1]
  -o, --options    options    misc formatting options, --showoptions for all
                                d|D - include date in output
                                  T - include time in output
                                  z - turn off compression of plot files
  -p, --playback   file       playback results from 'file' (be sure to quote
			      if wild carded) or the shell might mess it up
  -P, --plot                  generate output in 'plot' format
  -s, --subsys     subsys     specify one or more subsystems [default=cdn]
      --verbose               display output in verbose format (automatically
                              selected when brief doesn't make sense)

Various types of help
  -h, --help                  print this text
  -v, --version               print version
  -V, --showdefs              print operational defaults
  -x, --helpextend            extended help, more details descriptions too
  -X, --helpall               shows all help concatenated together

  --showoptions               show all the options
  --showsubsys                show all the subsystems
  --showsubopts               show all subsystem specific options
  --showtopopts               show --top options

  --showheader                show file header that 'would be' generated
  --showcolheaders            show column headers that 'would be' generated
  --showslabaliases           for SLUB allocator, show non-root aliases
  --showrootslabs             same as --showslabaliases but use 'root' names

Copyright 2003-2016 Hewlett-Packard Development Company, L.P.
collectl may be copied only under the terms of either the Artistic License
or the GNU General Public License, which may be found in the source kit

Trabajando con Collectl

Ahora, ejecute el recopilador sin ninguna opción que mostrará información sobre las estadísticas de la CPU, el disco y la red en un formato muy corto y legible por humanos.

collectl

Debería ver el siguiente resultado:

waiting for 1 second sample...
#<--------cpu--------><----------disks-----------><----------network---------->
#cpu sys inter  ctxsw KBRead  Reads KBWrit Writes   KBIn  PktIn  KBOut  PktOut 
  17  11   503    320      4      1     20      3      0      0      0       0 
   2   1   565    165      0      0      0      0      0      2      0       2 
   6   3   545     83      0      0      0      0      0      2      0       2 
   0   0   508     39      0      0      0      0      0      2      0       2 
   1   1   517     42      0      0      0      0      0      2      0       2 
   1   1   442     37      0      0      0      0      0      2      0       2 
   1   1   538     65      0      0     20      2      0      2      0       2 
   1   1   443     39      0      0      0      0      0      2      0       2 
   1   1   409     39      0      0      0      0      0      2      0       2 
   1   1   381     38      0      0      0      0      0      2      0       2 
   1   1   451     44      0      0      0      0      0      2      0       2 
   3   2   482     42      0      0      0      0      0      2      0       2 
   9   2   528    101      0      0      0      0      0      2      0       2 
   1   1   428     39      0      0      0      0      0      2      0       2 

También puede enumerar las estadísticas de todos los subsistemas con el siguiente comando:

collectl --all

Salida:

waiting for 1 second sample...
#<--------cpu--------><-----------------memory-----------------><----------disks-----------><----------network----------><-------tcp--------><------sockets-----><----files---><------nfs totals------="">
#cpu sys inter  ctxsw Cpu0 Free Buff Cach Inac Slab  Map   Fragments KBRead  Reads KBWrit Writes   KBIn  PktIn  KBOut  PktOut   IP  Tcp  Udp Icmp  Tcp  Udp  Raw Frag Handle Inodes  Reads Writes Meta Comm 
   3   0   459     48  459 139M  63M 573M 413M  93M 136M jibaa4a59ab      0      0      0      0      0      0      0       0    0    0    0    0  144    0    0    0   1088  44711      0      0    0    0 
  12   7   528    142  530 139M  63M 573M 413M  93M 136M jhbaa5959ab      0      0      0      0      0      2      1       2    0    0    0    0  144    0    0    0   1088  44711      0      0    0    0 
   3   1   477     57  477 139M  63M 573M 413M  93M 136M jhbaa5959ab      0      0      0      0      0      2      0       2    0    0    0    0  144    0    0    0   1088  44711      0      0    0    0 
   5   2   437     55  435 139M  63M 573M 413M  93M 136M jhbaa5959ab      0      0      0      0      0      2      0       2    0    0    0    0  144    0    0    0   1088  44711      0      0    0    0 
   1   0   426     43  426 139M  63M 573M 413M  93M 136M jhbaa5959ab      0      0      0      0      0      2      0       2    0    0    0    0  144    0    0    0   1088  44711      0      0    0    0 
   4   1   435     54  435 139M  63M 573M 413M  93M 136M jhbaa5959ab      0      0      0      0      0      2      0       2    0    0    0    0  144    0    0    0   1088  44711      0      0    0    0 
   4   2   471     49  472 139M  63M 573M 413M  93M 136M jhbaa5959ab      0      0      0      0      0      2      0       2    0    0    0    0  144    0    0    0   1088  44712      0      0    0    0 

También puede usar el comando collectl con la opción --top como se muestra a continuación:

collectl --top

Salida:

# TOP PROCESSES sorted by time (counters are /sec) 14:14:24
# PID  User     PR  PPID THRD S   VSZ   RSS CP  SysT  UsrT Pct  AccuTime  RKB  WKB MajF MinF Command
 5194  root     20  1233    0 R   66M   27M  0  0.06  0.13  19  00:02.79    0    0    0    0 /usr/bin/perl 
    8  root     20     2    0 I     0     0  0  0.01  0.00   1  00:01.86    0    0    0    0 rcu_sched 
 1165  root     20   866    0 S  103M    7M  0  0.01  0.00   1  00:05.00    0    0    0    0 sshd: 
 3593  root     20     2    0 I     0     0  0  0.01  0.00   1  00:01.45    0    0    0    0 kworker/0:0 
    1  root     20     0    0 S   76M    9M  0  0.00  0.00   0  00:10.28    0    0    0    0 /sbin/init 
    2  root     20     0    0 S     0     0  0  0.00  0.00   0  00:00.02    0    0    0    0 kthreadd 
    4  root      0     2    0 I     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 kworker/0:0H 
    6  root      0     2    0 I     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 mm_percpu_wq 
    7  root     20     2    0 S     0     0  0  0.00  0.00   0  00:02.75    0    0    0    0 ksoftirqd/0 
    9  root     20     2    0 I     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 rcu_bh 
   10  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 migration/0 
   11  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.03    0    0    0    0 watchdog/0 
   12  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 cpuhp/0 
   13  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 kdevtmpfs 
   14  root      0     2    0 I     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 netns 
   15  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 rcu_tasks_kthre 
   16  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 kauditd 

Supervise el uso de CPU, memoria y disco

Puede monitorear el uso de la CPU ejecutando la opción collectl con -sc:

collectl -sc

Salida:

waiting for 1 second sample...
#<--------cpu-------->
#cpu sys inter  ctxsw 
   1   1   461     35 
   2   2   631     71 
  11   0   472    109 
   1   1   552     48 
   1   1   457     39 
   0   0   566     46 
   5   3   572    101 
   0   0   543     38 
   1   1   445     40 
   1   1   591     43 
   1   1   441     36 
   0   0   565     51 

También puede ver información detallada sobre el uso de la CPU con el siguiente comando:

collectl -sC

Salida:

waiting for 1 second sample...

# SINGLE CPU STATISTICS
#   Cpu  User Nice  Sys Wait IRQ  Soft Steal Guest NiceG Idle
      0     2    0    3    0    0    0     0     0     0   94
      0     0    0    1    0    0    0     0     0     0   98
      0     0    0    1    0    0    0     0     0     0   98
      0     0    0    0    0    0    1     0     0     0   98
      0     0    0    0    0    0    0     0     0     0  100
      0     0    0    0    0    0    0     0     0     0  100
      0     1    0    1    0    0    0     0     0     0   97
      0     0    0    0    0    0    0     0     0     0  100
      0     0    0    1    1    0    1     0     0     0   96
      0     0    0    0    0    0    0     0     0     0  100
      0     0    0    1    0    0    0     0     0     0   98

Para monitorear el uso de memoria de su sistema, ejecute el siguiente comando:

collectl -sm

Salida:

waiting for 1 second sample...
#<-----------memory----------->
#Free Buff Cach Inac Slab  Map 
 139M  63M 573M 413M  93M 136M 
 139M  63M 573M 413M  93M 136M 
 139M  63M 573M 413M  93M 136M 
 139M  63M 573M 413M  93M 136M 
 139M  63M 573M 413M  93M 136M 
 139M  63M 573M 413M  93M 136M 
 139M  63M 573M 413M  93M 136M 
 139M  63M 573M 413M  93M 136M 
 139M  63M 573M 413M  93M 136M 

Supervise el uso de la memoria con información detallada con el siguiente comando:

collectl -sM

Salida:

waiting for 1 second sample...

# MEMORY STATISTICS 
# Node    Total     Used     Free     Slab   Mapped     Anon    AnonH   Locked    Inact HitPct
     0     985M  866844K  142800K   95928K   46160K   93416K        0    5408K  423952K 100.00
     0     985M  866844K  142800K   95928K   46160K   93416K        0    5408K  423952K 100.00
     0     985M  866844K  142800K   95928K   46160K   93416K        0    5408K  423952K 100.00
     0     985M  866844K  142800K   95928K   46160K   93416K        0    5408K  423952K 100.00
     0     985M  866844K  142800K   95928K   46160K   93416K        0    5408K  423952K 100.00
     0     985M  866844K  142800K   95928K   46160K   93416K        0    5408K  423952K 100.00
     0     985M  866968K  142676K   95928K   46160K   93416K        0    5408K  423952K 100.00

Puede monitorear el uso del disco con el siguiente comando:

collectl -sd

Salida:

waiting for 1 second sample...
#<----------disks----------->
#KBRead  Reads KBWrit Writes 
      0      0      0      0 
      0      0      0      0 
      0      0      0      0 
      0      0      0      0 
      0      0      0      0 
      0      0      8      0 
      0      0      0      2

Supervise el uso del disco con información detallada con el siguiente comando:

collectl -sD

Salida:

waiting for 1 second sample...

# DISK STATISTICS (/sec)
#          <---------reads---------------><---------writes--------------><--------averages--------> Pct
#Name       KBytes Merged  IOs Size  Wait  KBytes Merged  IOs Size  Wait  RWSize  QLen  Wait SvcTim Util
sda              0      0    0    0     0       0      0    0    0     0       0     0     0      0    0
sda              0      0    0    0     0       0      0    0    0     0       0     0     0      0    0
sda              0      0    0    0     0       0      0    0    0     0       0     0     0      0    0
sda              0      0    0    0     0       0      0    0    0     0       0     0     0      0    0
sda              0      0    0    0     0       0      0    0    0     0       0     0     0      0    0
sda              0      0    0    0     0       0      0    0    0     0       0     0     0      0    0
sda              0      0    0    0     0      20      1    1   20     0      20     0     0      0    0
sda              0      0    0    0     0       0      0    0    0     0       0     0     0      0    0

Supervise la CPU, la memoria y el disco a la vez

Puede monitorear el uso de la CPU, la memoria y el disco ejecutando el comando único:

collectl -scmd

Salida:

waiting for 1 second sample...
#<--------cpu--------><-----------memory-----------><----------disks----------->
#cpu sys inter  ctxsw Free Buff Cach Inac Slab  Map KBRead  Reads KBWrit Writes 
   1   0   518     43 140M  63M 573M 413M  93M 135M      0      0      0      0 
   7   2   509    104 140M  63M 573M 413M  93M 135M      0      0     20      1 
   3   1   518     52 140M  63M 573M 413M  93M 135M      0      0      0      0 
   1   1   445     43 140M  63M 573M 413M  93M 135M      0      0      0      0 
   2   1   482     51 140M  63M 573M 413M  93M 135M      0      0      0      0 
   1   1   535     56 140M  63M 573M 413M  93M 135M      0      0      0      0 
   3   1   499     48 140M  63M 573M 413M  93M 135M      0      0      0      0 
   2   1   482     53 140M  63M 573M 413M  93M 135M      0      0     20      2 

Conclusión

En el artículo anterior, proporcioné una breve descripción general de collectl. Collectl viene con muchas opciones que facilitan el monitoreo de su sistema Linux.


Ubuntu
  1. Cómo instalar la herramienta de monitoreo Zabbix en Ubuntu 18.04 LTS

  2. Cómo instalar y usar iostat en Ubuntu 16.04 LTS

  3. Cómo instalar y usar sosreport en Ubuntu 18.04 LTS

  4. Cómo instalar y usar Telnet en Ubuntu 20.04 LTS

  5. Instale y use Linuxbrew en el sistema Ubuntu 20.04 LTS Linux

Cómo instalar y usar Wireshark en Ubuntu 20.04 LTS

Cómo instalar y usar la herramienta de captura de pantalla del obturador en Ubuntu 20.04

Cómo instalar y usar R en Ubuntu

Cómo instalar y usar Jenkins en Ubuntu 18.04 y 16.04 LTS

3 formas de instalar y usar HandBrake Ubuntu 22.04 | 20.04 LTS

Cómo instalar y usar la herramienta de monitoreo de recursos Bpytop en Ubuntu 20.04