User Tools

Site Tools


informatique:linux:monitoring_linux

Monitoring et diagnostique

sous Linux

Ces outils permettent d'afficher l'état de santé de la machine, de détecter s'il se passe quelque chose d'anormal, ou d'investiguer sur un problème déjà connu.

Tableaux de bord

Ce sont les logiciels générique qui permettent d'afficher de multiples mesures et informations, typiquement les trucs qu'on laisse ouvert dans un screen/byobu.

saidar

Affiche l'ensemble des indicateurs de santé de la machine en mode texte : la charge (1/5/15), l'état de la mémoire (vive/swap), les statistiques des processus (running, zombi), l'utilisation du disque (read/write), l'utilisation des interfaces réseau (rx/tx) et l'état des partitions.

saidar -c

glance

Dans le même genre que saidar, en plus détaillé.

neofetch

Affiche un résumé des informations système :

$ neofetch
       _,met$$$$$gg.          dude@tyr
    ,g$$$$$$$$$$$$$$$P.       --------
  ,g$$P"     """Y$$.".        OS: Debian GNU/Linux 10 (buster) x86_64
 ,$$P'              `$$$.     Kernel: 4.19.0-13-amd64
',$$P       ,ggs.     `$$b:   Uptime: 28 days, 6 hours, 24 mins
`d$$'     ,$P"'   .    $$$    Packages: 574 (dpkg)
 $$P      d$'     ,    $$P    Shell: bash 5.0.3
 $$:      $$.   -    ,d$$'    Terminal: /dev/pts/0
 $$;      Y$b._   _,d$P'      CPU: Intel Atom N2800 (4) @ 1.862GHz
 Y$$.    `.`"Y$$$$P"'         GPU: Intel Atom Processor D2xxx/N2xxx
 `$$b      "-.__              Memory: 321MiB / 1976MiB
  `Y$$
   `Y$$.
     `$$b.
       `Y$$b.
          `"Y$b._
              `"""

inxi

A l'instar de neofetch, permet d'afficher des informations système (plus détaillées cependant).

$ inxi -F
System:    Host: tyr Kernel: 4.19.0-13-amd64 x86_64 bits: 64 Console: tty 0 Distro: Debian GNU/Linux 10 (buster)
Machine:   Type: Desktop Mobo: Intel model: DN2800MT v: AAG81515-900 serial: <root required> BIOS: Intel
           v: MTCDT10N.86A.0165.2013.0114.1540 date: 01/14/2013
CPU:       Topology: Dual Core model: Intel Atom N2800 bits: 64 type: MT MCP L2 cache: 512 KiB
           Speed: 800 MHz min/max: 798/1862 MHz Core speeds (MHz): 1: 800 2: 800 3: 800 4: 800
Graphics:  Device-1: Intel Atom Processor D2xxx/N2xxx Integrated Graphics driver: gma500 v: N/A
           Display: server: No display server data found. Headless machine? tty: 125x35
           Message: Unable to show advanced data. Required tool glxinfo missing.
Audio:     Message: No Device data found.
Network:   Device-1: Intel 82574L Gigabit Network driver: e1000e
           IF: eno0 state: up speed: 100 Mbps duplex: full mac: 00:22:4d:00:11:22
           IF-ID-1: tun0 state: unknown speed: 10 Mbps duplex: full mac: N/A
Drives:    Local Storage: total: 465.76 GiB used: 252.53 GiB (54.2%)
           ID-1: /dev/sda vendor: Toshiba model: DT01ACA050 size: 465.76 GiB
Partition: ID-1: / size: 19.10 GiB used: 4.33 GiB (22.7%) fs: ext4 dev: /dev/sda2
           ID-2: /boot size: 486.8 MiB used: 171.6 MiB (35.2%) fs: ext4 dev: /dev/sda1
           ID-3: /home size: 438.12 GiB used: 247.96 GiB (56.6%) fs: ext4 dev: /dev/sda3
           ID-4: swap-1 size: 511.0 MiB used: 76.0 MiB (14.9%) fs: swap dev: /dev/sda4
Sensors:   Missing: Required tool sensors not installed. Check --recommends
Info:      Processes: 128 Uptime: 28d 6h 37m Memory: 1.93 GiB used: 415.9 MiB (21.0%) Init: systemd runlevel: 5
           Shell: bash inxi: 3.0.32

Processus

top/htop

Afficher la liste des processus avec leur utilisation CPU, mémoire, etc… Htop est plus évolué que top et affiche également des jauges d'utilisation CPU/mémoire/swap (et en couleur !).

htop

pidstat

pidstat affiche l'activité des processus actifs

# "-d" report IOSTAT ; "-l" list process cmd name & args ; 1 interval [ 30 count ])
pidstat -d -l 1 30

ps

# lister les processus bloqués en state=D (Disk sleep (uninterruptible))
for x in `seq 1 1 10`; do ps -eo state,pid,cmd | grep "^D"; echo "---"; sleep 5; done"

Réseau

hping

iftop

Affiche l'utilisation d'une interface réseau, par connexion.

iftop -i eth0

iptraf

iptraf

jnettop

jnettop

mtr

nethogs

nethogs

nload

nmap

ntop

vnstat

zmap

System

mpstat

mpstat -P ALL 5
Linux 3.10.0-514.26.2.el7.x86_64 (ldri601z) 	02/08/2018 	_x86_64_	(8 CPU)
10:39:05     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
10:39:10     all    1,20    0,00    0,98   61,32    0,00    0,00    0,00    0,00    0,00   36,50
10:39:10       0    3,41    0,00    4,22   92,37    0,00    0,00    0,00    0,00    0,00    0,00
10:39:10       1    0,80    0,00    0,60   98,60    0,00    0,00    0,00    0,00    0,00    0,00
10:39:10       2    2,81    0,00    0,40    0,00    0,00    0,00    0,00    0,00    0,00   96,79
10:39:10       3    2,20    0,00    2,20    0,00    0,00    0,00    0,00    0,00    0,00   95,59
10:39:10       4    0,00    0,00    0,00  100,00    0,00    0,00    0,00    0,00    0,00    0,00
10:39:10       5    0,20    0,00    0,20   99,60    0,00    0,00    0,00    0,00    0,00    0,00
10:39:10       6    0,20    0,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00   99,80
10:39:10       7    0,00    0,00    0,20   99,80    0,00    0,00    0,00    0,00    0,00    0,00
[..]

vmstat

vmstat 1
procs -----------memory------------  ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free     buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  9 147484 1129764     16 1345452    0    0     1     4   16   19  2  1 91  7  0
 0  9 147484 1129640     16 1345420    0    0     0  1388  693 1545  1  1 37 61  0
 0  9 147484 1128876     16 1345420    0    0     0    44  639 1566  2  1 37 60  0

La première ligne n'est pas à prendre en compte puisqu'il affiche les stats depuis son dernier lancement.

Ici on voit un fort %age d'IOwait (60 “wa”) ce qui correspond au temps d'attente (“perdu” càd s'il est IDLE) d'accès au disque du processeur.

IO

Voir les stats d'IO d'un processus : cat /proc/<PID DU PROC>/io

iostat

iostat -x 2 5
Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
sdb               0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
sdc               0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00

iotop

iotop -p PID -k
 
# afficher le cumul des IO des processus actifs
iotop -oa

sar

Applications

apachetop

apachetop /var/log/apache2/access.log

mytop

mytop -u user -pMDP -d mysql

dnstop

dnstop -4 eth0

Liens utiles

informatique/linux/monitoring_linux.txt · Last modified: 2021/01/17 16:12 by pteu