Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
elearning:workbooks:centos:8:avance:l112 [2024/10/01 07:41] – removed admin | elearning:workbooks:centos:8:avance:l112 [2024/10/01 08:07] (Version actuelle) – admin | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | ~~PDF: | ||
+ | Version : **2024.01** | ||
+ | |||
+ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
+ | |||
+ | ======LCF604 - Gestion des Paramètres du matériel et les Ressources====== | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# sed -i ' | ||
+ | [root@centos8 ~]# sed -i ' | ||
+ | </ | ||
+ | |||
+ | =====Contenu du Module===== | ||
+ | |||
+ | * **LCF604 - Gestion des Paramètres et les Ressources du Matériel** | ||
+ | * Contenu du Module | ||
+ | * Présentation des Fichiers Spéciaux | ||
+ | * LAB #1 - Découvrir le Matériel | ||
+ | * 1.1 - La Commande lspci | ||
+ | * 1.2 - La Commande lsusb | ||
+ | * 1.3 - La Commande lsblk | ||
+ | * 1.4 - La Commande lsscsi | ||
+ | * 1.5 - La Commande lscpu | ||
+ | * 1.6 - La Commande lshw | ||
+ | * 1.7 - La Commande dmidecode | ||
+ | * 1.8 - La Commande smartctl | ||
+ | * 1.9 - Les Commandes accton et dump-acct | ||
+ | * 1.10 - La Commande lastcomm | ||
+ | * 1.11 - La Commande sa | ||
+ | * 1.12 - La Commande ac | ||
+ | * LAB #2 - La Commande sysctl | ||
+ | * 2.1 - Répertoire /proc | ||
+ | * Fichiers | ||
+ | * Processeur | ||
+ | * Interruptions système | ||
+ | * Canaux DMA | ||
+ | * Plages d' | ||
+ | * Périphériques | ||
+ | * Modules | ||
+ | * Statistiques de l' | ||
+ | * Partitions | ||
+ | * Espaces de pagination | ||
+ | * Statistiques d' | ||
+ | * Statistiques d' | ||
+ | * Version du noyau | ||
+ | * Répertoires | ||
+ | * ide/scsi | ||
+ | * acpi | ||
+ | * bus | ||
+ | * net | ||
+ | * sys | ||
+ | * 2.2 - Utilisation de la Commande sysctl | ||
+ | * LAB #3 - Interprétation des informations dans /proc | ||
+ | * 3.1 - free | ||
+ | * 3.2 - uptime ou w | ||
+ | * 3.3 - iostat | ||
+ | * 3.4 - hdparm | ||
+ | * 3.5 - vmstat | ||
+ | * 3.6 - mpstat | ||
+ | * 3.7 - sar | ||
+ | * Modules usb | ||
+ | * udev | ||
+ | * La Commande udevadm | ||
+ | * Système de fichiers /sys | ||
+ | * LAB #4 - Limiter les Ressources | ||
+ | * 4.1 - ulimit | ||
+ | * 4.2 - Groupes de Contrôle | ||
+ | * La Limitation de la Mémoire | ||
+ | * La Commande cgcreate | ||
+ | * La Commande cgdelete | ||
+ | * Le Fichier / | ||
+ | * La Commande cgconfigparser | ||
+ | |||
+ | =====Présentation des Fichiers Spéciaux===== | ||
+ | |||
+ | Dans l' | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Les périphériques qui nécessitent à ce que l' | ||
+ | </ | ||
+ | |||
+ | Consultez le contenu du répertoire /dev : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ls -l /dev | more | ||
+ | total 0 | ||
+ | crw-r--r--. | ||
+ | drwxr-xr-x. | ||
+ | drwxr-xr-x. | ||
+ | drwxr-xr-x. | ||
+ | lrwxrwxrwx. | ||
+ | drwxr-xr-x. | ||
+ | drwxr-xr-x. | ||
+ | crw-------. | ||
+ | lrwxrwxrwx. | ||
+ | drwxr-xr-x. 10 root root 200 Jun 28 02:04 cpu | ||
+ | crw-------. | ||
+ | drwxr-xr-x. | ||
+ | brw-rw----. | ||
+ | brw-rw----. | ||
+ | drwxr-xr-x. | ||
+ | crw-rw----. | ||
+ | lrwxrwxrwx. | ||
+ | crw-rw-rw-. | ||
+ | crw-rw-rw-. | ||
+ | crw-------. | ||
+ | crw-------. | ||
+ | drwxr-xr-x. | ||
+ | crw-------. | ||
+ | lrwxrwxrwx. | ||
+ | drwxr-xr-x. | ||
+ | crw-r--r--. | ||
+ | lrwxrwxrwx. | ||
+ | crw-rw----. | ||
+ | crw-rw----. | ||
+ | crw-rw----. | ||
+ | crw-rw----. | ||
+ | crw-rw----. | ||
+ | drwxr-xr-x. | ||
+ | crw-------. | ||
+ | crw-r-----. | ||
+ | drwxrwxrwt. | ||
+ | drwxr-xr-x. | ||
+ | crw-rw-rw-. | ||
+ | --More-- | ||
+ | </ | ||
+ | |||
+ | On peut noter dans la sortie de la commande que certains fichiers sont de type **bloc** (**b**), tandis que d' | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | brw-rw----. | ||
+ | ... | ||
+ | crw-rw-rw-. | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | La différence entre les deux repose sur le type de communication entre le système et le module. Dans le premier cas le système accède au périphérique par des coordonnées du bloc de données sur le support tandis que dans le deuxième cas la communication d' | ||
+ | |||
+ | Les deux informations clefs du fichier spécial sont situées à la place de la taille d'un fichier normal et se nomment le **majeur** et le **mineur** : | ||
+ | |||
+ | * le **majeur** identifie le pilote du périphérique et donc son contrôleur, | ||
+ | * le **mineur** identifie le périphérique ou une particularité du périphérique telle une partition d'un disque. | ||
+ | |||
+ | =====LAB #1 - Découvrir le Matériel===== | ||
+ | |||
+ | ====1.1 - La Commande lspci==== | ||
+ | |||
+ | Cette commande vous renseigne sur les adaptateurs reliés aux bus PCI, AGP et PCI express : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lspci | ||
+ | 00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02) | ||
+ | 00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/ | ||
+ | 00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/ | ||
+ | 00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/ | ||
+ | 00:01.3 Bridge: Intel Corporation 82371AB/ | ||
+ | 00:02.0 VGA compatible controller: Device 1234:1111 (rev 02) | ||
+ | 00:03.0 Unclassified device [00ff]: Red Hat, Inc. Virtio memory balloon | ||
+ | 00:07.0 SATA controller: Intel Corporation 82801IR/ | ||
+ | 00:12.0 Ethernet controller: Red Hat, Inc. Virtio network device | ||
+ | 00:1e.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge | ||
+ | 00:1f.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge | ||
+ | </ | ||
+ | |||
+ | Pour obtenir de l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lspci -v -s 00:03.0 | ||
+ | 00:03.0 Unclassified device [00ff]: Red Hat, Inc. Virtio memory balloon | ||
+ | Subsystem: Red Hat, Inc. Device 0005 | ||
+ | Physical Slot: 3 | ||
+ | Flags: bus master, fast devsel, latency 0, IRQ 10 | ||
+ | I/O ports at e000 [size=64] | ||
+ | Memory at fe400000 (64-bit, prefetchable) [size=16K] | ||
+ | Capabilities: | ||
+ | Capabilities: | ||
+ | Capabilities: | ||
+ | Capabilities: | ||
+ | Capabilities: | ||
+ | Kernel driver in use: virtio-pci | ||
+ | </ | ||
+ | |||
+ | ou : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lspci -vv -s 00:03.0 | ||
+ | 00:03.0 Unclassified device [00ff]: Red Hat, Inc. Virtio memory balloon | ||
+ | Subsystem: Red Hat, Inc. Device 0005 | ||
+ | Physical Slot: 3 | ||
+ | Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx- | ||
+ | Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- | ||
+ | Latency: 0 | ||
+ | Interrupt: pin A routed to IRQ 10 | ||
+ | Region 0: I/O ports at e000 [size=64] | ||
+ | Region 4: Memory at fe400000 (64-bit, prefetchable) [size=16K] | ||
+ | Capabilities: | ||
+ | BAR=0 offset=00000000 size=00000000 | ||
+ | Capabilities: | ||
+ | BAR=4 offset=00003000 size=00001000 multiplier=00000004 | ||
+ | Capabilities: | ||
+ | BAR=4 offset=00002000 size=00001000 | ||
+ | Capabilities: | ||
+ | BAR=4 offset=00001000 size=00001000 | ||
+ | Capabilities: | ||
+ | BAR=4 offset=00000000 size=00001000 | ||
+ | Kernel driver in use: virtio-pci | ||
+ | </ | ||
+ | |||
+ | ===Options de la commande=== | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lspci --help | ||
+ | lspci: invalid option -- ' | ||
+ | Usage: lspci [< | ||
+ | |||
+ | Basic display modes: | ||
+ | -mm | ||
+ | -t Show bus tree | ||
+ | |||
+ | Display options: | ||
+ | -v Be verbose (-vv or -vvv for higher verbosity) | ||
+ | -k Show kernel drivers handling each device | ||
+ | -x Show hex-dump of the standard part of the config space | ||
+ | -xxx Show hex-dump of the whole config space (dangerous; root only) | ||
+ | -xxxx Show hex-dump of the 4096-byte extended config space (root only) | ||
+ | -b Bus-centric view (addresses and IRQ's as seen by the bus) | ||
+ | -D Always show domain numbers | ||
+ | -P Display bridge path in addition to bus and device number | ||
+ | -PP | ||
+ | |||
+ | Resolving of device ID's to names: | ||
+ | -n Show numeric ID's | ||
+ | -nn Show both textual and numeric ID's (names & numbers) | ||
+ | -q Query the PCI ID database for unknown ID's via DNS | ||
+ | -qq As above, but re-query locally cached entries | ||
+ | -Q Query the PCI ID database for all ID's via DNS | ||
+ | |||
+ | Selection of devices: | ||
+ | -s [[[[< | ||
+ | -d [< | ||
+ | |||
+ | Other options: | ||
+ | -i < | ||
+ | -p < | ||
+ | -M Enable `bus | ||
+ | </ | ||
+ | |||
+ | ====1.2 - La Commande lsusb==== | ||
+ | |||
+ | Cette commande vous renseigne sur les adaptateurs reliés au bus usb : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lsusb | ||
+ | Bus 001 Device 002: ID 0627:0001 Adomax Technology Co., Ltd | ||
+ | Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub | ||
+ | |||
+ | [root@centos8 ~]# lsusb -vt | ||
+ | /: Bus 01.Port 1: Dev 1, Class=root_hub, | ||
+ | |__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, | ||
+ | </ | ||
+ | |||
+ | ===Options de la commande=== | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lsusb --help | ||
+ | Usage: lsusb [options]... | ||
+ | List USB devices | ||
+ | -v, --verbose | ||
+ | Increase verbosity (show descriptors) | ||
+ | -s [[bus]: | ||
+ | Show only devices with specified device and/or | ||
+ | bus numbers (in decimal) | ||
+ | -d vendor: | ||
+ | Show only devices with the specified vendor and | ||
+ | product ID numbers (in hexadecimal) | ||
+ | .LAB#1 | ||
+ | -D device | ||
+ | Selects which device lsusb will examine | ||
+ | -t, --tree | ||
+ | Dump the physical USB device hierarchy as a tree | ||
+ | -V, --version | ||
+ | Show version of program | ||
+ | -h, --help | ||
+ | Show usage and help | ||
+ | </ | ||
+ | |||
+ | ====1.3 - La Commande lsblk==== | ||
+ | |||
+ | Cette commande vous rensigne sur les partitions des disques : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lsblk | ||
+ | NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT | ||
+ | sda | ||
+ | ├─sda1 | ||
+ | └─sda2 | ||
+ | ├─cl_centos8-root 253:0 0 27.8G 0 lvm / | ||
+ | └─cl_centos8-swap 253:1 0 3.2G 0 lvm [SWAP] | ||
+ | sdb | ||
+ | sdc | ||
+ | └─sdc1 | ||
+ | sdd | ||
+ | sr0 11:0 1 1024M 0 rom | ||
+ | |||
+ | [root@centos8 ~]# lsblk -l | ||
+ | NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT | ||
+ | sda | ||
+ | sda1 8:1 0 1G 0 part /boot | ||
+ | sda2 8:2 0 | ||
+ | sdb | ||
+ | sdc | ||
+ | sdc1 8:33 | ||
+ | sdd | ||
+ | sr0 11:0 1 1024M 0 rom | ||
+ | cl_centos8-root 253:0 0 27.8G 0 lvm / | ||
+ | cl_centos8-swap 253:1 0 3.2G 0 lvm [SWAP] | ||
+ | </ | ||
+ | |||
+ | ===Options de la commande=== | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lsblk --help | ||
+ | |||
+ | Usage: | ||
+ | lsblk [options] [< | ||
+ | |||
+ | List information about block devices. | ||
+ | |||
+ | Options: | ||
+ | -a, --all print all devices | ||
+ | -b, --bytes | ||
+ | -d, --nodeps | ||
+ | -D, --discard | ||
+ | -z, --zoned | ||
+ | -e, --exclude < | ||
+ | -f, --fs | ||
+ | -i, --ascii | ||
+ | -I, --include < | ||
+ | -J, --json | ||
+ | -l, --list | ||
+ | -T, --tree | ||
+ | -m, --perms | ||
+ | -n, --noheadings | ||
+ | -o, --output < | ||
+ | -O, --output-all | ||
+ | -p, --paths | ||
+ | -P, --pairs | ||
+ | -r, --raw use raw output format | ||
+ | -s, --inverse | ||
+ | -S, --scsi | ||
+ | -t, --topology | ||
+ | -x, --sort < | ||
+ | |||
+ | -h, --help | ||
+ | -V, --version | ||
+ | |||
+ | Available output columns: | ||
+ | NAME device name | ||
+ | | ||
+ | | ||
+ | FSTYPE | ||
+ | MOUNTPOINT | ||
+ | | ||
+ | UUID filesystem UUID | ||
+ | PARTTYPE | ||
+ | | ||
+ | PARTUUID | ||
+ | | ||
+ | RA read-ahead of the device | ||
+ | RO read-only device | ||
+ | RM removable device | ||
+ | | ||
+ | | ||
+ | SERIAL | ||
+ | SIZE size of the device | ||
+ | | ||
+ | | ||
+ | | ||
+ | MODE device node permissions | ||
+ | | ||
+ | MIN-IO | ||
+ | OPT-IO | ||
+ | | ||
+ | | ||
+ | ROTA rotational device | ||
+ | | ||
+ | | ||
+ | TYPE device type | ||
+ | DISC-ALN | ||
+ | | ||
+ | DISC-MAX | ||
+ | | ||
+ | | ||
+ | | ||
+ | RAND adds randomness | ||
+ | PKNAME | ||
+ | HCTL Host: | ||
+ | TRAN device transport type | ||
+ | SUBSYSTEMS | ||
+ | | ||
+ | VENDOR | ||
+ | | ||
+ | |||
+ | For more details see lsblk(8). | ||
+ | </ | ||
+ | |||
+ | ====1.4 - La Commande lsscsi==== | ||
+ | |||
+ | Cette commmande vous renseigne sur les périphériques SCSI et NVMe : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lsscsi | ||
+ | [1: | ||
+ | [2: | ||
+ | [3: | ||
+ | [4: | ||
+ | [5: | ||
+ | </ | ||
+ | |||
+ | ===Options de la commande=== | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# man lsscsi | ||
+ | [root@centos8 ~]# lsscsi --help | ||
+ | Usage: lsscsi | ||
+ | [--help] [--hosts] [--kname] [--list] [--long] [--long-unit] | ||
+ | [--lunhex] [--no-nvme] [--pdt] [--protection] [--prot-mode] | ||
+ | [--scsi_id] [--size] [--sz-lbs] [--sysfsroot=PATH] [--transport] | ||
+ | [--unit] [--verbose] [--version] [--wwn] | ||
+ | where: | ||
+ | --brief|-b | ||
+ | --classic|-c | ||
+ | --controllers|-C | ||
+ | like SCSI hosts | ||
+ | --device|-d | ||
+ | --generic|-g | ||
+ | --help|-h | ||
+ | --hosts|-H | ||
+ | --kname|-k | ||
+ | --list|-L | ||
+ | attribute=value per line | ||
+ | --long|-l | ||
+ | --long-unit|-U | ||
+ | ' | ||
+ | --lunhex|-x | ||
+ | use twice to get full 16 digit hexadecimal LUN | ||
+ | --no-nvme|-N | ||
+ | --pdt|-D | ||
+ | --protection|-p | ||
+ | --protmode|-P | ||
+ | --scsi_id|-i | ||
+ | --size|-s | ||
+ | twice for power of two (e.g. 2.7 GiB), | ||
+ | thrice for number of blocks)) | ||
+ | --sysfsroot=PATH|-y PATH set sysfs mount point to PATH (def: /sys) | ||
+ | --sz-lbs|-S | ||
+ | adds comma followed by logical block size in bytes | ||
+ | --transport|-t | ||
+ | given, for initiator | ||
+ | --unit|-u | ||
+ | --verbose|-v | ||
+ | --version|-V | ||
+ | --wwn|-w | ||
+ | < | ||
+ | < | ||
+ | <' | ||
+ | |||
+ | List SCSI devices or hosts, followed by NVMe namespaces or controllers. | ||
+ | Many storage devices (e.g. SATA disks and USB attached storage) use SCSI | ||
+ | command sets and hence are also listed by this utility. Hyphenated long | ||
+ | options can also take underscore (and vice versa). | ||
+ | </ | ||
+ | |||
+ | ====1.5 - La Commande lscpu==== | ||
+ | |||
+ | Cett commande vous renseigne sur l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lscpu | ||
+ | Architecture: | ||
+ | CPU op-mode(s): | ||
+ | Byte Order: | ||
+ | CPU(s): | ||
+ | On-line CPU(s) list: 0-7 | ||
+ | Thread(s) per core: 1 | ||
+ | Core(s) per socket: | ||
+ | Socket(s): | ||
+ | NUMA node(s): | ||
+ | Vendor ID: | ||
+ | BIOS Vendor ID: QEMU | ||
+ | CPU family: | ||
+ | Model: | ||
+ | Model name: Intel(R) Xeon(R) CPU E3-1270 v6 @ 3.80GHz | ||
+ | BIOS Model name: | ||
+ | Stepping: | ||
+ | CPU MHz: | ||
+ | BogoMIPS: | ||
+ | Virtualization: | ||
+ | Hypervisor vendor: | ||
+ | Virtualization type: full | ||
+ | L1d cache: | ||
+ | L1i cache: | ||
+ | L2 cache: | ||
+ | L3 cache: | ||
+ | NUMA node0 CPU(s): | ||
+ | Flags: | ||
+ | </ | ||
+ | |||
+ | ===Options de la commande=== | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lscpu --help | ||
+ | |||
+ | Usage: | ||
+ | lscpu [options] | ||
+ | |||
+ | Display information about the CPU architecture. | ||
+ | |||
+ | Options: | ||
+ | -a, --all print both online and offline CPUs (default for -e) | ||
+ | -b, --online | ||
+ | -c, --offline | ||
+ | -J, --json | ||
+ | -e, --extended[=< | ||
+ | -p, --parse[=< | ||
+ | -s, --sysroot < | ||
+ | -x, --hex print hexadecimal masks rather than lists of CPUs | ||
+ | -y, --physical | ||
+ | |||
+ | -h, --help | ||
+ | -V, --version | ||
+ | |||
+ | Available output columns: | ||
+ | | ||
+ | CORE logical core number | ||
+ | SOCKET | ||
+ | | ||
+ | NODE logical NUMA node number | ||
+ | BOOK logical book number | ||
+ | DRAWER | ||
+ | | ||
+ | POLARIZATION | ||
+ | | ||
+ | CONFIGURED | ||
+ | ONLINE | ||
+ | MAXMHZ | ||
+ | MINMHZ | ||
+ | |||
+ | For more details see lscpu(1). | ||
+ | </ | ||
+ | |||
+ | ====1.6 - La Command lshw==== | ||
+ | |||
+ | Cette commande vous renseigne sur le matériel selon la **classe** de celui-ci. Commencez par visualiser les périphériques et leurs classes répectives : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lshw -businfo | ||
+ | Bus info Device | ||
+ | ==================================================== | ||
+ | system | ||
+ | bus Motherboard | ||
+ | memory | ||
+ | cpu@0 | ||
+ | cpu@1 | ||
+ | memory | ||
+ | memory | ||
+ | pci@0000: | ||
+ | pci@0000: | ||
+ | input PnP device PNP0303 | ||
+ | input PnP device PNP0f13 | ||
+ | storage | ||
+ | system | ||
+ | pci@0000: | ||
+ | scsi@1: | ||
+ | pci@0000: | ||
+ | usb@1 | ||
+ | usb@1: | ||
+ | pci@0000: | ||
+ | pci@0000: | ||
+ | pci@0000: | ||
+ | virtio@0 | ||
+ | pci@0000: | ||
+ | scsi@2: | ||
+ | scsi@2: | ||
+ | scsi@2: | ||
+ | scsi@3: | ||
+ | scsi@4: | ||
+ | scsi@4: | ||
+ | scsi@5: | ||
+ | pci@0000: | ||
+ | virtio@1 | ||
+ | pci@0000: | ||
+ | virtio@2 | ||
+ | pci@0000: | ||
+ | pci@0000: | ||
+ | input0 | ||
+ | input1 | ||
+ | input3 | ||
+ | input4 | ||
+ | input6 | ||
+ | </ | ||
+ | |||
+ | Consultez maintenant le matériel de la classe **system** : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lshw -c system | ||
+ | centos8.ittraining.loc | ||
+ | description: | ||
+ | product: Standard PC (i440FX + PIIX, 1996) | ||
+ | vendor: QEMU | ||
+ | version: pc-i440fx-7.0 | ||
+ | width: 64 bits | ||
+ | capabilities: | ||
+ | configuration: | ||
+ | *-pnp00:03 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | Consultez maintenant le matériel des autres classes principales : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lshw -c memory | ||
+ | *-firmware | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | date: 04/01/2014 | ||
+ | size: 96KiB | ||
+ | *-memory | ||
+ | | ||
+ | | ||
+ | size: 16GiB | ||
+ | | ||
+ | | ||
+ | | ||
+ | description: | ||
+ | vendor: QEMU | ||
+ | physical id: 0 | ||
+ | slot: DIMM 0 | ||
+ | |||
+ | [root@centos8 ~]# lshw -c video | ||
+ | *-display | ||
+ | | ||
+ | | ||
+ | | ||
+ | bus info: pci@0000: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | |||
+ | [root@centos8 ~]# lshw -c storage | ||
+ | *-pnp00: | ||
+ | | ||
+ | | ||
+ | | ||
+ | *-ide | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | bus info: pci@0000: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | *-sata | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | bus info: pci@0000: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | |||
+ | [root@centos8 ~]# lshw -c disk | ||
+ | *-cdrom | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | bus info: scsi@1: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | *-disk:0 | ||
+ | | ||
+ | | ||
+ | | ||
+ | bus info: scsi@2: | ||
+ | | ||
+ | | ||
+ | | ||
+ | size: 32GiB (34GB) | ||
+ | | ||
+ | | ||
+ | *-disk:1 | ||
+ | | ||
+ | | ||
+ | | ||
+ | bus info: scsi@3: | ||
+ | | ||
+ | | ||
+ | | ||
+ | size: 4GiB (4294MB) | ||
+ | | ||
+ | *-disk:2 | ||
+ | | ||
+ | | ||
+ | | ||
+ | bus info: scsi@4: | ||
+ | | ||
+ | | ||
+ | | ||
+ | size: 64GiB (68GB) | ||
+ | | ||
+ | | ||
+ | *-disk:3 | ||
+ | | ||
+ | | ||
+ | | ||
+ | bus info: scsi@5: | ||
+ | | ||
+ | | ||
+ | | ||
+ | size: 32GiB (34GB) | ||
+ | | ||
+ | |||
+ | |||
+ | [root@centos8 ~]# lshw -c volume | ||
+ | *-volume: | ||
+ | | ||
+ | | ||
+ | | ||
+ | bus info: scsi@2: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | size: 1GiB | ||
+ | | ||
+ | | ||
+ | | ||
+ | *-volume:1 | ||
+ | | ||
+ | | ||
+ | bus info: scsi@2: | ||
+ | | ||
+ | | ||
+ | size: 30GiB | ||
+ | | ||
+ | | ||
+ | *-volume | ||
+ | | ||
+ | | ||
+ | | ||
+ | bus info: scsi@4: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | size: 63GiB | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | [root@centos8 ~]# lshw -c network | ||
+ | *-network: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | bus info: pci@0000: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | description: | ||
+ | physical id: 0 | ||
+ | bus info: virtio@1 | ||
+ | logical name: ens18 | ||
+ | serial: 5e: | ||
+ | capabilities: | ||
+ | configuration: | ||
+ | *-network:1 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | bus info: pci@0000: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | description: | ||
+ | physical id: 0 | ||
+ | bus info: virtio@2 | ||
+ | logical name: ens19 | ||
+ | serial: ea: | ||
+ | capabilities: | ||
+ | configuration: | ||
+ | </ | ||
+ | |||
+ | ===Options de la commande=== | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lshw -h | ||
+ | Hardware Lister (lshw) - B.02.19.2 | ||
+ | usage: lshw [-format] [-options ...] | ||
+ | lshw -version | ||
+ | |||
+ | -version | ||
+ | |||
+ | format can be | ||
+ | -html | ||
+ | -xml output hardware tree as XML | ||
+ | -json | ||
+ | -short | ||
+ | -businfo | ||
+ | |||
+ | options can be | ||
+ | -dump filename | ||
+ | -class CLASS only show a certain class of hardware | ||
+ | -C CLASS same as ' | ||
+ | -c CLASS same as ' | ||
+ | -disable TEST | ||
+ | -enable TEST enable a test (like pci, isapnp, cpuid, etc. ) | ||
+ | -quiet | ||
+ | -sanitize | ||
+ | -numeric | ||
+ | -notime | ||
+ | </ | ||
+ | |||
+ | ====1.7 - La Commande dmidecode==== | ||
+ | |||
+ | La commande **dmidecode** lit la table **DMI** (//Desktop Management Interface// | ||
+ | |||
+ | * l' | ||
+ | * les extensions possibles. | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# dmidecode | ||
+ | # dmidecode 3.2 | ||
+ | Getting SMBIOS data from sysfs. | ||
+ | SMBIOS 2.8 present. | ||
+ | 11 structures occupying 511 bytes. | ||
+ | Table at 0x000F5870. | ||
+ | |||
+ | Handle 0x0000, DMI type 0, 24 bytes | ||
+ | BIOS Information | ||
+ | Vendor: SeaBIOS | ||
+ | Version: rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org | ||
+ | Release Date: 04/01/2014 | ||
+ | Address: 0xE8000 | ||
+ | Runtime Size: 96 kB | ||
+ | ROM Size: 64 kB | ||
+ | Characteristics: | ||
+ | BIOS characteristics not supported | ||
+ | Targeted content distribution is supported | ||
+ | BIOS Revision: 0.0 | ||
+ | |||
+ | Handle 0x0100, DMI type 1, 27 bytes | ||
+ | System Information | ||
+ | Manufacturer: | ||
+ | Product Name: Standard PC (i440FX + PIIX, 1996) | ||
+ | Version: pc-i440fx-5.2 | ||
+ | Serial Number: Not Specified | ||
+ | UUID: 95bd69e3-4a74-44a7-b58c-b74fbfb86df2 | ||
+ | Wake-up Type: Power Switch | ||
+ | SKU Number: Not Specified | ||
+ | Family: Not Specified | ||
+ | |||
+ | Handle 0x0300, DMI type 3, 22 bytes | ||
+ | Chassis Information | ||
+ | Manufacturer: | ||
+ | Type: Other | ||
+ | Lock: Not Present | ||
+ | Version: pc-i440fx-5.2 | ||
+ | Serial Number: Not Specified | ||
+ | Asset Tag: Not Specified | ||
+ | Boot-up State: Safe | ||
+ | Power Supply State: Safe | ||
+ | Thermal State: Safe | ||
+ | Security Status: Unknown | ||
+ | OEM Information: | ||
+ | Height: Unspecified | ||
+ | Number Of Power Cords: Unspecified | ||
+ | Contained Elements: 0 | ||
+ | SKU Number: Not Specified | ||
+ | |||
+ | Handle 0x0400, DMI type 4, 42 bytes | ||
+ | Processor Information | ||
+ | Socket Designation: | ||
+ | Type: Central Processor | ||
+ | Family: Other | ||
+ | Manufacturer: | ||
+ | ID: 61 0F 00 00 FF FB 8B 07 | ||
+ | Version: pc-i440fx-5.2 | ||
+ | Voltage: Unknown | ||
+ | External Clock: Unknown | ||
+ | Max Speed: 2000 MHz | ||
+ | Current Speed: 2000 MHz | ||
+ | Status: Populated, Enabled | ||
+ | Upgrade: Other | ||
+ | L1 Cache Handle: Not Provided | ||
+ | L2 Cache Handle: Not Provided | ||
+ | L3 Cache Handle: Not Provided | ||
+ | Serial Number: Not Specified | ||
+ | Asset Tag: Not Specified | ||
+ | Part Number: Not Specified | ||
+ | Core Count: 4 | ||
+ | Core Enabled: 4 | ||
+ | Thread Count: 1 | ||
+ | Characteristics: | ||
+ | |||
+ | Handle 0x0401, DMI type 4, 42 bytes | ||
+ | Processor Information | ||
+ | Socket Designation: | ||
+ | Type: Central Processor | ||
+ | Family: Other | ||
+ | Manufacturer: | ||
+ | ID: 61 0F 00 00 FF FB 8B 07 | ||
+ | Version: pc-i440fx-5.2 | ||
+ | Voltage: Unknown | ||
+ | External Clock: Unknown | ||
+ | Max Speed: 2000 MHz | ||
+ | Current Speed: 2000 MHz | ||
+ | Status: Populated, Enabled | ||
+ | Upgrade: Other | ||
+ | L1 Cache Handle: Not Provided | ||
+ | L2 Cache Handle: Not Provided | ||
+ | L3 Cache Handle: Not Provided | ||
+ | Serial Number: Not Specified | ||
+ | Asset Tag: Not Specified | ||
+ | Part Number: Not Specified | ||
+ | Core Count: 4 | ||
+ | Core Enabled: 4 | ||
+ | Thread Count: 1 | ||
+ | Characteristics: | ||
+ | |||
+ | Handle 0x1000, DMI type 16, 23 bytes | ||
+ | Physical Memory Array | ||
+ | Location: Other | ||
+ | Use: System Memory | ||
+ | Error Correction Type: Multi-bit ECC | ||
+ | Maximum Capacity: 4 GB | ||
+ | Error Information Handle: Not Provided | ||
+ | Number Of Devices: 1 | ||
+ | |||
+ | Handle 0x1100, DMI type 17, 40 bytes | ||
+ | Memory Device | ||
+ | Array Handle: 0x1000 | ||
+ | Error Information Handle: Not Provided | ||
+ | Total Width: Unknown | ||
+ | Data Width: Unknown | ||
+ | Size: 4 GB | ||
+ | Form Factor: DIMM | ||
+ | Set: None | ||
+ | Locator: DIMM 0 | ||
+ | Bank Locator: Not Specified | ||
+ | Type: RAM | ||
+ | Type Detail: Other | ||
+ | Speed: Unknown | ||
+ | Manufacturer: | ||
+ | Serial Number: Not Specified | ||
+ | Asset Tag: Not Specified | ||
+ | Part Number: Not Specified | ||
+ | Rank: Unknown | ||
+ | Configured Memory Speed: Unknown | ||
+ | Minimum Voltage: Unknown | ||
+ | Maximum Voltage: Unknown | ||
+ | Configured Voltage: Unknown | ||
+ | |||
+ | Handle 0x1300, DMI type 19, 31 bytes | ||
+ | Memory Array Mapped Address | ||
+ | Starting Address: 0x00000000000 | ||
+ | Ending Address: 0x000BFFFFFFF | ||
+ | Range Size: 3 GB | ||
+ | Physical Array Handle: 0x1000 | ||
+ | Partition Width: 1 | ||
+ | |||
+ | Handle 0x1301, DMI type 19, 31 bytes | ||
+ | Memory Array Mapped Address | ||
+ | Starting Address: 0x00100000000 | ||
+ | Ending Address: 0x0013FFFFFFF | ||
+ | Range Size: 1 GB | ||
+ | Physical Array Handle: 0x1000 | ||
+ | Partition Width: 1 | ||
+ | |||
+ | Handle 0x2000, DMI type 32, 11 bytes | ||
+ | System Boot Information | ||
+ | Status: No errors detected | ||
+ | |||
+ | Handle 0x7F00, DMI type 127, 4 bytes | ||
+ | End Of Table | ||
+ | </ | ||
+ | |||
+ | ===Options de la commande=== | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# dmidecode --help | ||
+ | Usage: dmidecode [OPTIONS] | ||
+ | Options are: | ||
+ | -d, --dev-mem FILE Read memory from device FILE (default: /dev/mem) | ||
+ | -h, --help | ||
+ | -q, --quiet | ||
+ | -s, --string KEYWORD | ||
+ | -t, --type TYPE Only display the entries of given type | ||
+ | -u, --dump | ||
+ | | ||
+ | | ||
+ | -V, --version | ||
+ | </ | ||
+ | |||
+ | ====1.8 - La Commande smartctl==== | ||
+ | |||
+ | **smartctl** contrôle le système SMART (Self-Monitoring, | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# smartctl --smart=on --saveauto=on --offlineauto=on /dev/sdb | ||
+ | |||
+ | [root@centos8 ~]# smartctl -a /dev/sdb | ||
+ | smartctl 7.1 2020-04-05 r5049 [x86_64-linux-4.18.0-305.7.1.el8_4.x86_64] (local build) | ||
+ | Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org | ||
+ | |||
+ | === START OF INFORMATION SECTION === | ||
+ | Device Model: | ||
+ | Serial Number: | ||
+ | Firmware Version: 2.5+ | ||
+ | User Capacity: | ||
+ | Sector Size: 512 bytes logical/ | ||
+ | Device is: Not in smartctl database [for details use: -P showall] | ||
+ | ATA Version is: | ||
+ | Local Time is: Sun Nov 13 09:12:18 2022 CET | ||
+ | SMART support is: Available - device has SMART capability. | ||
+ | SMART support is: Enabled | ||
+ | |||
+ | === START OF READ SMART DATA SECTION === | ||
+ | SMART overall-health self-assessment test result: PASSED | ||
+ | |||
+ | General SMART Values: | ||
+ | Offline data collection status: | ||
+ | was completed without error. | ||
+ | Auto Offline Data Collection: Disabled. | ||
+ | Self-test execution status: | ||
+ | without error or no self-test has ever | ||
+ | been run. | ||
+ | Total time to complete Offline | ||
+ | data collection: | ||
+ | Offline data collection | ||
+ | capabilities: | ||
+ | No Auto Offline data collection support. | ||
+ | Suspend Offline collection upon new | ||
+ | command. | ||
+ | Offline surface scan supported. | ||
+ | Self-test supported. | ||
+ | No Conveyance Self-test supported. | ||
+ | No Selective Self-test supported. | ||
+ | SMART capabilities: | ||
+ | power-saving mode. | ||
+ | Supports SMART auto save timer. | ||
+ | Error logging capability: | ||
+ | No General Purpose Logging support. | ||
+ | Short self-test routine | ||
+ | recommended polling time: ( 2) minutes. | ||
+ | Extended self-test routine | ||
+ | recommended polling time: ( 54) minutes. | ||
+ | |||
+ | SMART Attributes Data Structure revision number: 1 | ||
+ | Vendor Specific SMART Attributes with Thresholds: | ||
+ | ID# ATTRIBUTE_NAME | ||
+ | 1 Raw_Read_Error_Rate | ||
+ | 3 Spin_Up_Time | ||
+ | 4 Start_Stop_Count | ||
+ | 5 Reallocated_Sector_Ct | ||
+ | 9 Power_On_Hours | ||
+ | 12 Power_Cycle_Count | ||
+ | 190 Airflow_Temperature_Cel 0x0003 | ||
+ | |||
+ | SMART Error Log Version: 1 | ||
+ | No Errors Logged | ||
+ | |||
+ | SMART Self-test log structure revision number 1 | ||
+ | No self-tests have been logged. | ||
+ | |||
+ | Selective Self-tests/ | ||
+ | </ | ||
+ | |||
+ | ===Options de la commande=== | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# smartctl --help | ||
+ | smartctl 7.1 2020-04-05 r5049 [x86_64-linux-4.18.0-305.7.1.el8_4.x86_64] (local build) | ||
+ | Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org | ||
+ | |||
+ | Usage: smartctl [options] device | ||
+ | |||
+ | ============================================ SHOW INFORMATION OPTIONS ===== | ||
+ | |||
+ | -h, --help, --usage | ||
+ | | ||
+ | |||
+ | -V, --version, --copyright, | ||
+ | Print license, copyright, and version information and exit | ||
+ | |||
+ | -i, --info | ||
+ | Show identity information for device | ||
+ | |||
+ | --identify[=[w][nvb]] | ||
+ | Show words and bits from IDENTIFY DEVICE data (ATA) | ||
+ | |||
+ | -g NAME, --get=NAME | ||
+ | Get device setting: all, aam, apm, dsn, lookahead, security, | ||
+ | wcache, rcache, wcreorder, wcache-sct | ||
+ | |||
+ | -a, --all | ||
+ | Show all SMART information for device | ||
+ | |||
+ | -x, --xall | ||
+ | Show all information for device | ||
+ | |||
+ | --scan | ||
+ | Scan for devices | ||
+ | |||
+ | --scan-open | ||
+ | Scan for devices and try to open each device | ||
+ | |||
+ | ================================== SMARTCTL RUN-TIME BEHAVIOR OPTIONS ===== | ||
+ | |||
+ | -j, --json[=[cgiosuv]] | ||
+ | Print output in JSON format | ||
+ | |||
+ | -q TYPE, --quietmode=TYPE | ||
+ | Set smartctl quiet mode to one of: errorsonly, silent, noserial | ||
+ | |||
+ | -d TYPE, --device=TYPE | ||
+ | | ||
+ | ata, scsi[+TYPE], | ||
+ | |||
+ | -T TYPE, --tolerance=TYPE | ||
+ | | ||
+ | |||
+ | -b TYPE, --badsum=TYPE | ||
+ | Set action on bad checksum to one of: warn, exit, ignore | ||
+ | |||
+ | -r TYPE, --report=TYPE | ||
+ | | ||
+ | |||
+ | -n MODE[, | ||
+ | No check if: never, sleep, standby, idle (see man page) | ||
+ | |||
+ | ============================== DEVICE FEATURE ENABLE/ | ||
+ | |||
+ | -s VALUE, --smart=VALUE | ||
+ | Enable/ | ||
+ | |||
+ | -o VALUE, --offlineauto=VALUE | ||
+ | Enable/ | ||
+ | |||
+ | -S VALUE, --saveauto=VALUE | ||
+ | Enable/ | ||
+ | |||
+ | -s NAME[, | ||
+ | Enable/ | ||
+ | dsn, | ||
+ | standby, | ||
+ | wcreorder, | ||
+ | |||
+ | ======================================= READ AND DISPLAY DATA OPTIONS ===== | ||
+ | |||
+ | -H, --health | ||
+ | Show device SMART health status | ||
+ | |||
+ | -c, --capabilities | ||
+ | Show device SMART capabilities | ||
+ | |||
+ | -A, --attributes | ||
+ | Show device SMART vendor-specific Attributes and values | ||
+ | |||
+ | -f FORMAT, --format=FORMAT | ||
+ | Set output format for attributes: old, brief, hex[, | ||
+ | |||
+ | -l TYPE, --log=TYPE | ||
+ | Show device log. TYPE: error, selftest, selective, directory[, | ||
+ | xerror[, | ||
+ | sasphy[, | ||
+ | scttempint, | ||
+ | gplog, | ||
+ | |||
+ | -v N,OPTION , --vendorattribute=N, | ||
+ | Set display OPTION for vendor Attribute N (see man page) | ||
+ | |||
+ | -F TYPE, --firmwarebug=TYPE | ||
+ | Use firmware bug workaround: | ||
+ | none, nologdir, samsung, samsung2, samsung3, xerrorlba, swapid | ||
+ | |||
+ | -P TYPE, --presets=TYPE | ||
+ | Drive-specific presets: use, ignore, show, showall | ||
+ | |||
+ | -B [+]FILE, --drivedb=[+]FILE | ||
+ | Read and replace [add] drive database from FILE | ||
+ | [default is +/ | ||
+ | and then / | ||
+ | |||
+ | ============================================ DEVICE SELF-TEST OPTIONS ===== | ||
+ | |||
+ | -t TEST, --test=TEST | ||
+ | Run test. TEST: offline, short, long, conveyance, force, vendor,N, | ||
+ | select,M-N, pending,N, afterselect, | ||
+ | |||
+ | -C, --captive | ||
+ | Do test in captive mode (along with -t) | ||
+ | |||
+ | -X, --abort | ||
+ | Abort any non-captive test on device | ||
+ | |||
+ | =================================================== SMARTCTL EXAMPLES ===== | ||
+ | |||
+ | smartctl --all / | ||
+ | |||
+ | smartctl --smart=on --offlineauto=on --saveauto=on /dev/sda | ||
+ | (Enables SMART on first disk) | ||
+ | |||
+ | smartctl --test=long / | ||
+ | |||
+ | smartctl --attributes --log=selftest --quietmode=errorsonly /dev/sda | ||
+ | (Prints Self-Test & Attribute errors) | ||
+ | smartctl --all --device=3ware, | ||
+ | smartctl --all --device=3ware, | ||
+ | smartctl --all --device=3ware, | ||
+ | smartctl --all --device=3ware, | ||
+ | (Prints all SMART info for 3rd ATA disk on 3ware RAID controller) | ||
+ | smartctl --all --device=hpt, | ||
+ | (Prints all SMART info for the SATA disk attached to the 3rd PMPort | ||
+ | of the 1st channel on the 1st HighPoint RAID controller) | ||
+ | smartctl --all --device=areca, | ||
+ | (Prints all SMART info for 3rd ATA disk of the 1st enclosure | ||
+ | on Areca RAID controller) | ||
+ | </ | ||
+ | |||
+ | ====1.9 - Les Commandes accton et dump-acct==== | ||
+ | |||
+ | Cette commande permet d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# accton on | ||
+ | Turning on process accounting, file set to the default '/ | ||
+ | [root@centos8 ~]# systemctl status psacct | ||
+ | ● psacct.service - Kernel process accounting | ||
+ | | ||
+ | | ||
+ | ...skipping... | ||
+ | ● psacct.service - Kernel process accounting | ||
+ | | ||
+ | | ||
+ | |||
+ | [root@centos8 ~]# systemctl enable psacct | ||
+ | Created symlink / | ||
+ | |||
+ | [root@centos8 ~]# systemctl start psacct | ||
+ | |||
+ | [root@centos8 ~]# systemctl status psacct | ||
+ | ● psacct.service - Kernel process accounting | ||
+ | | ||
+ | | ||
+ | Process: 39765 ExecStart=/ | ||
+ | Process: 39763 ExecStartPre=/ | ||
+ | Main PID: 39765 (code=exited, | ||
+ | |||
+ | Nov 13 09:35:16 centos8.ittraining.loc systemd[1]: Starting Kernel process accounting> | ||
+ | Nov 13 09:35:16 centos8.ittraining.loc accton[39765]: | ||
+ | Nov 13 09:35:16 centos8.ittraining.loc systemd[1]: Started Kernel process accounting. | ||
+ | </ | ||
+ | |||
+ | Par contre le fichier **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | #pcKaccton pcEusleep%$pcu, | ||
+ | </ | ||
+ | |||
+ | La commande **dump-acct** permet de voir son contenu mais pas de l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# dump-acct / | ||
+ | accton | ||
+ | sleep | ||
+ | awk | ||
+ | ksmtuned | ||
+ | pgrep | ||
+ | ksmtuned | ||
+ | ksmtuned | ||
+ | awk | ||
+ | ksmtuned | ||
+ | less |v3| | ||
+ | systemctl | ||
+ | sleep | ||
+ | awk | ||
+ | ksmtuned | ||
+ | pgrep | ||
+ | ksmtuned | ||
+ | ksmtuned | ||
+ | awk | ||
+ | ksmtuned | ||
+ | rpc-pipefs-gene |v3| | ||
+ | nfs-server-gene |v3| | ||
+ | systemd-cryptse |v3| | ||
+ | systemd-system- |v3| | ||
+ | systemd-hiberna |v3| | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | ===Options de la commande=== | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# dump-acct --help | ||
+ | Usage: dump-acct [-hrR] [-n < | ||
+ | [--num < | ||
+ | [--format < | ||
+ | [--ahz < | ||
+ | |||
+ | The system' | ||
+ | </ | ||
+ | |||
+ | ====1.10 - La Commande lastcomm==== | ||
+ | |||
+ | Cette commande vous renseigne sur l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lastcomm | ||
+ | bash F root | ||
+ | gdbus X root | ||
+ | ksmtuned | ||
+ | awk root | ||
+ | kworker/ | ||
+ | ksmtuned | ||
+ | ksmtuned | ||
+ | pgrep root | ||
+ | ksmtuned | ||
+ | awk root | ||
+ | sleep root | ||
+ | kworker/ | ||
+ | kworker/ | ||
+ | kworker/ | ||
+ | dump-acct | ||
+ | ksmtuned | ||
+ | awk root | ||
+ | ksmtuned | ||
+ | ksmtuned | ||
+ | pgrep root | ||
+ | ksmtuned | ||
+ | awk root | ||
+ | sleep root | ||
+ | dump-acct | ||
+ | man root | ||
+ | less | ||
+ | kworker/ | ||
+ | ksmtuned | ||
+ | awk root | ||
+ | ksmtuned | ||
+ | ksmtuned | ||
+ | pgrep root | ||
+ | ksmtuned | ||
+ | awk root | ||
+ | sleep root | ||
+ | man | ||
+ | nroff root | ||
+ | groff root | ||
+ | grotty | ||
+ | troff root | ||
+ | nroff | ||
+ | locale | ||
+ | tbl root | ||
+ | preconv | ||
+ | man | ||
+ | man | ||
+ | man | ||
+ | man | ||
+ | man | ||
+ | man | ||
+ | man | ||
+ | ksmtuned | ||
+ | awk root | ||
+ | ksmtuned | ||
+ | ksmtuned | ||
+ | pgrep root | ||
+ | ksmtuned | ||
+ | awk root | ||
+ | sleep root | ||
+ | dump-acct | ||
+ | kworker/ | ||
+ | ksmtuned | ||
+ | awk root | ||
+ | ksmtuned | ||
+ | ksmtuned | ||
+ | pgrep root | ||
+ | ksmtuned | ||
+ | awk root | ||
+ | sleep root | ||
+ | cat root | ||
+ | ksmtuned | ||
+ | awk root | ||
+ | ksmtuned | ||
+ | ksmtuned | ||
+ | pgrep root | ||
+ | ksmtuned | ||
+ | awk root | ||
+ | sleep root | ||
+ | kworker/ | ||
+ | systemctl | ||
+ | less | ||
+ | systemd-cgroups | ||
+ | systemd-cgroups | ||
+ | systemctl | ||
+ | systemd-tty-ask | ||
+ | accton | ||
+ | accton | ||
+ | accton-create | ||
+ | systemctl | ||
+ | (sd-executor) | ||
+ | systemd-gpt-aut | ||
+ | systemd-getty-g | ||
+ | systemd-veritys | ||
+ | systemd-sysv-ge | ||
+ | systemd-debug-g | ||
+ | selinux-autorel | ||
+ | grep | ||
+ | ostree-system-g | ||
+ | systemd-rc-loca | ||
+ | anaconda-genera | ||
+ | lvm2-activation | ||
+ | kdump-dep-gener | ||
+ | selinuxenabled | ||
+ | lvmconfig | ||
+ | grep | ||
+ | readlink | ||
+ | systemd-fstab-g | ||
+ | systemd-hiberna | ||
+ | systemd-system- | ||
+ | systemd-cryptse | ||
+ | nfs-server-gene | ||
+ | rpc-pipefs-gene | ||
+ | ksmtuned | ||
+ | awk root | ||
+ | ksmtuned | ||
+ | ksmtuned | ||
+ | pgrep root | ||
+ | ksmtuned | ||
+ | awk root | ||
+ | sleep root | ||
+ | systemctl | ||
+ | less | ||
+ | ksmtuned | ||
+ | awk root | ||
+ | ksmtuned | ||
+ | ksmtuned | ||
+ | pgrep root | ||
+ | ksmtuned | ||
+ | awk root | ||
+ | sleep root | ||
+ | accton | ||
+ | |||
+ | [root@centos8 ~]# lastcomm grep | ||
+ | grep | ||
+ | grep | ||
+ | grep | ||
+ | grep | ||
+ | </ | ||
+ | |||
+ | ===Options de la commande=== | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lastcomm --help | ||
+ | Usage: lastcomm [-hpV] [-f file] [command] ... [user] ... [terminal] ... | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | The system' | ||
+ | </ | ||
+ | |||
+ | ====1.11 - La Commande sa==== | ||
+ | |||
+ | Cette commande vous renseigne sur les statistiques sur les processus lancés et leurs ressources systèmes: | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# sa -u | egrep " | ||
+ | root 0.00 cpu 1090k mem 0 io accton | ||
+ | root 0.00 cpu 1827k mem 0 io sleep | ||
+ | root 0.00 cpu 6378k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 11276k mem 0 io pgrep | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6528k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6344k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 2426k mem 0 io less | ||
+ | root 0.00 cpu 23376k mem 0 io systemctl | ||
+ | root 0.00 cpu 1827k mem 0 io sleep | ||
+ | root 0.00 cpu 6378k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 11276k mem 0 io pgrep | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6528k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6344k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 9688k mem 0 io rpc-pipefs-gene | ||
+ | root 0.00 cpu 9720k mem 0 io nfs-server-gene | ||
+ | root 0.00 cpu 22592k mem 0 io systemd-cryptse | ||
+ | root 0.00 cpu 22592k mem 0 io systemd-system- | ||
+ | root 0.00 cpu 22592k mem 0 io systemd-hiberna | ||
+ | root 0.00 cpu 22592k mem 0 io systemd-fstab-g | ||
+ | root 0.00 cpu 1098k mem 0 io readlink | ||
+ | root 0.00 cpu 2302k mem 0 io grep | ||
+ | root 0.00 cpu 16260k mem 0 io lvmconfig | ||
+ | root 0.00 cpu 3350k mem 0 io selinuxenabled | ||
+ | root 0.00 cpu 5862k mem 0 io kdump-dep-gener | ||
+ | root 0.00 cpu 8406k mem 0 io lvm2-activation | ||
+ | root 0.00 cpu 5764k mem 0 io anaconda-genera | ||
+ | root 0.00 cpu 22592k mem 0 io systemd-rc-loca | ||
+ | root 0.01 cpu 38192k mem 0 io ostree-system-g | ||
+ | root 0.00 cpu 2302k mem 0 io grep | ||
+ | root 0.00 cpu 5764k mem 0 io selinux-autorel | ||
+ | root 0.00 cpu 22592k mem 0 io systemd-debug-g | ||
+ | root 0.00 cpu 22592k mem 0 io systemd-sysv-ge | ||
+ | root 0.00 cpu 22592k mem 0 io systemd-veritys | ||
+ | root 0.00 cpu 22592k mem 0 io systemd-getty-g | ||
+ | root 0.00 cpu 22592k mem 0 io systemd-gpt-aut | ||
+ | root 0.00 cpu 63728k mem 0 io (sd-executor) | ||
+ | root 0.00 cpu 23632k mem 0 io systemctl | ||
+ | root 0.00 cpu 6496k mem 0 io accton-create | ||
+ | root 0.00 cpu 0k mem 0 io accton | ||
+ | root 0.00 cpu 1090k mem 0 io accton | ||
+ | root 0.00 cpu 22592k mem 0 io systemd-tty-ask | ||
+ | root 0.00 cpu 23376k mem 0 io systemctl | ||
+ | root 0.00 cpu 22592k mem 0 io systemd-cgroups | ||
+ | root 0.00 cpu 22592k mem 0 io systemd-cgroups | ||
+ | root 0.00 cpu 2426k mem 0 io less | ||
+ | root 0.00 cpu 23376k mem 0 io systemctl | ||
+ | root 0.00 cpu 0k mem 0 io kworker/ | ||
+ | root 0.00 cpu 1827k mem 0 io sleep | ||
+ | root 0.00 cpu 6378k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 11276k mem 0 io pgrep | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6528k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6344k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 1828k mem 0 io cat | ||
+ | root 0.00 cpu 1827k mem 0 io sleep | ||
+ | root 0.00 cpu 6378k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 11276k mem 0 io pgrep | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6528k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6344k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 0k mem 0 io kworker/ | ||
+ | root 0.00 cpu 1994k mem 0 io dump-acct | ||
+ | root 0.00 cpu 1827k mem 0 io sleep | ||
+ | root 0.00 cpu 6378k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 11276k mem 0 io pgrep | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6528k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6344k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 4582k mem 0 io man * | ||
+ | root 0.00 cpu 4804k mem 0 io man * | ||
+ | root 0.00 cpu 4804k mem 0 io man * | ||
+ | root 0.00 cpu 4804k mem 0 io man * | ||
+ | root 0.00 cpu 4804k mem 0 io man * | ||
+ | root 0.00 cpu 4804k mem 0 io man * | ||
+ | root 0.00 cpu 4844k mem 0 io man * | ||
+ | root 0.00 cpu 4186k mem 0 io preconv | ||
+ | root 0.00 cpu 3476k mem 0 io tbl | ||
+ | root 0.00 cpu 1831k mem 0 io locale | ||
+ | root 0.00 cpu 3182k mem 0 io nroff * | ||
+ | root 0.00 cpu 4186k mem 0 io troff | ||
+ | root 0.00 cpu 3674k mem 0 io grotty | ||
+ | root 0.00 cpu 3496k mem 0 io groff | ||
+ | root 0.00 cpu 3182k mem 0 io nroff | ||
+ | root 0.00 cpu 4804k mem 0 io man * | ||
+ | root 0.00 cpu 1827k mem 0 io sleep | ||
+ | root 0.00 cpu 6378k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 11276k mem 0 io pgrep | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6528k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6344k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 0k mem 0 io kworker/ | ||
+ | root 0.00 cpu 2426k mem 0 io less | ||
+ | root 0.01 cpu 4770k mem 0 io man | ||
+ | root 0.00 cpu 1994k mem 0 io dump-acct | ||
+ | root 0.00 cpu 1827k mem 0 io sleep | ||
+ | root 0.00 cpu 6378k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 11276k mem 0 io pgrep | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6528k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6344k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 2094k mem 0 io dump-acct | ||
+ | root 0.00 cpu 0k mem 0 io kworker/ | ||
+ | root 0.00 cpu 0k mem 0 io kworker/ | ||
+ | root 0.00 cpu 0k mem 0 io kworker/ | ||
+ | root 0.00 cpu 1827k mem 0 io sleep | ||
+ | root 0.00 cpu 6378k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 11276k mem 0 io pgrep | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6528k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 0k mem 0 io kworker/ | ||
+ | root 0.00 cpu 6344k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 93648k mem 0 io gdbus | ||
+ | root 0.00 cpu 6888k mem 0 io bash * | ||
+ | root 0.00 cpu 5410k mem 0 io lastcomm | ||
+ | root 0.00 cpu 1827k mem 0 io sleep | ||
+ | root 0.00 cpu 6378k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 11276k mem 0 io pgrep | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6528k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6344k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 4570k mem 0 io man * | ||
+ | root 0.00 cpu 4804k mem 0 io man * | ||
+ | root 0.00 cpu 4804k mem 0 io man * | ||
+ | root 0.00 cpu 4804k mem 0 io man * | ||
+ | root 0.00 cpu 4804k mem 0 io man * | ||
+ | root 0.00 cpu 4804k mem 0 io man * | ||
+ | root 0.00 cpu 4844k mem 0 io man * | ||
+ | root 0.00 cpu 4186k mem 0 io preconv | ||
+ | root 0.00 cpu 3476k mem 0 io tbl | ||
+ | root 0.00 cpu 1831k mem 0 io locale | ||
+ | root 0.00 cpu 3182k mem 0 io nroff * | ||
+ | root 0.00 cpu 4186k mem 0 io troff | ||
+ | root 0.00 cpu 3706k mem 0 io grotty | ||
+ | root 0.00 cpu 3496k mem 0 io groff | ||
+ | root 0.00 cpu 3182k mem 0 io nroff | ||
+ | root 0.00 cpu 4804k mem 0 io man * | ||
+ | root 0.00 cpu 1827k mem 0 io sleep | ||
+ | root 0.00 cpu 6378k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 11276k mem 0 io pgrep | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6528k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6344k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 2426k mem 0 io less | ||
+ | root 0.00 cpu 4770k mem 0 io man | ||
+ | root 0.00 cpu 4604k mem 0 io man * | ||
+ | root 0.00 cpu 4760k mem 0 io man * | ||
+ | root 0.00 cpu 4804k mem 0 io man * | ||
+ | root 0.00 cpu 4804k mem 0 io man * | ||
+ | root 0.00 cpu 4804k mem 0 io man * | ||
+ | root 0.00 cpu 4804k mem 0 io man * | ||
+ | root 0.00 cpu 4804k mem 0 io man * | ||
+ | root 0.00 cpu 4844k mem 0 io man * | ||
+ | root 0.00 cpu 4186k mem 0 io preconv | ||
+ | root 0.00 cpu 3476k mem 0 io tbl | ||
+ | root 0.00 cpu 1831k mem 0 io locale | ||
+ | root 0.00 cpu 3182k mem 0 io nroff * | ||
+ | root 0.00 cpu 4186k mem 0 io troff | ||
+ | root 0.00 cpu 3700k mem 0 io grotty | ||
+ | root 0.00 cpu 3496k mem 0 io groff | ||
+ | root 0.00 cpu 3182k mem 0 io nroff | ||
+ | root 0.00 cpu 4804k mem 0 io man * | ||
+ | root 0.00 cpu 1827k mem 0 io sleep | ||
+ | root 0.00 cpu 6378k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 11276k mem 0 io pgrep | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6528k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6344k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 1827k mem 0 io sleep | ||
+ | root 0.00 cpu 6378k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 11276k mem 0 io pgrep | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6528k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6344k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 0k mem 0 io kworker/ | ||
+ | root 0.00 cpu 2426k mem 0 io less | ||
+ | root 0.00 cpu 4770k mem 0 io man | ||
+ | root 0.00 cpu 5312k mem 0 io sa | ||
+ | root 0.00 cpu 3034k mem 0 io grep | ||
+ | root 0.00 cpu 5312k mem 0 io sa | ||
+ | root 0.00 cpu 1827k mem 0 io sleep | ||
+ | root 0.00 cpu 6378k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 11276k mem 0 io pgrep | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6528k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 6344k mem 0 io awk | ||
+ | root 0.00 cpu 6658k mem 0 io ksmtuned | ||
+ | root 0.00 cpu 0k mem 0 io kworker/ | ||
+ | </ | ||
+ | |||
+ | ===Options de la commande=== | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# sa --help | ||
+ | |||
+ | Usage: sa [ options ] [ file ] | ||
+ | | ||
+ | options: [-abcdfiljkmnprstuDKP] [-v < | ||
+ | [--other-acct-file < | ||
+ | [--print-seconds] [--dont-read-summary-files] [--debug] | ||
+ | | ||
+ | | ||
+ | [--list-all-names] [--not-interactive] [--threshold < | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | The system' | ||
+ | |||
+ | raw process accounting data: / | ||
+ | summary by command name: / | ||
+ | summary by username: / | ||
+ | </ | ||
+ | |||
+ | ====1.12 - La Commande ac==== | ||
+ | |||
+ | Cette commande vous renseigne sur les statistiques des temps de connexion des utilisateurs : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ac -p | ||
+ | trainee | ||
+ | total 247.51 | ||
+ | |||
+ | [root@centos8 ~]# ac -d | ||
+ | Jun 16 total 6.41 | ||
+ | Jun 17 total 12.09 | ||
+ | Jul 19 total 6.94 | ||
+ | Jul 20 total 38.95 | ||
+ | Sep 2 total 0.03 | ||
+ | Sep 3 total 0.01 | ||
+ | Sep 5 total 11.01 | ||
+ | Oct 9 total 0.92 | ||
+ | Oct 11 total 4.17 | ||
+ | Oct 12 total 5.45 | ||
+ | Nov 7 total 19.40 | ||
+ | Nov 8 total 54.12 | ||
+ | Nov 9 total 67.32 | ||
+ | Nov 10 total 8.48 | ||
+ | Nov 11 total 3.01 | ||
+ | Today | ||
+ | </ | ||
+ | |||
+ | ===Options de la commande=== | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ac --help | ||
+ | |||
+ | Usage: ac [OPTION] ... | ||
+ | |||
+ | OPTIONS: | ||
+ | -d, --daily-totals | ||
+ | -p, --individual-totals | ||
+ | -f, --file < | ||
+ | --complain | ||
+ | --reboots | ||
+ | --supplants | ||
+ | --timewarps | ||
+ | --compatibility | ||
+ | -a, --all-days | ||
+ | --tw-leniency < | ||
+ | --tw-suspicious < | ||
+ | --print-year | ||
+ | --print-zeros | ||
+ | --debug | ||
+ | -V, --version | ||
+ | -h, --help | ||
+ | |||
+ | The system' | ||
+ | </ | ||
+ | |||
+ | =====LAB #2 - La commande sysctl===== | ||
+ | |||
+ | ====2.1 - Répertoire /proc==== | ||
+ | |||
+ | Le répertoire /proc contient des fichiers et des répertoires virtuels. Le contenu de ces fichiers est créé dynamiquement lors de la consultation. Seul root peut consulter la totalité des informations dans le répertoire /proc. | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ls /proc | ||
+ | 1 16391 19 2212 2427 2622 431 | ||
+ | 10 | ||
+ | 1007 | ||
+ | 11 | ||
+ | 11805 16593 2 | ||
+ | 12 | ||
+ | 1219 | ||
+ | 1228 | ||
+ | 1232 | ||
+ | 1234 | ||
+ | 1235 | ||
+ | 1247 | ||
+ | 13 | ||
+ | 1307 | ||
+ | 1339 | ||
+ | 1356 | ||
+ | 14 | ||
+ | 1441 | ||
+ | 1443 | ||
+ | 1444 | ||
+ | 1446 | ||
+ | 14977 1828 | ||
+ | 15 | ||
+ | 15067 183 2167 2330 2571 422 | ||
+ | 1536 | ||
+ | 1553 | ||
+ | 15594 186 2187 2358 259 | ||
+ | 15735 187 2190 2373 2593 427 | ||
+ | 16 | ||
+ | 16165 1883 | ||
+ | 16167 1888 | ||
+ | </ | ||
+ | |||
+ | ===Fichiers=== | ||
+ | |||
+ | ==Processeur== | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | processor | ||
+ | vendor_id | ||
+ | cpu family | ||
+ | model : 6 | ||
+ | model name : Common KVM processor | ||
+ | stepping | ||
+ | microcode | ||
+ | cpu MHz : 1999.987 | ||
+ | cache size : 16384 KB | ||
+ | physical id : 0 | ||
+ | siblings | ||
+ | core id : 0 | ||
+ | cpu cores : 4 | ||
+ | apicid | ||
+ | initial apicid | ||
+ | fpu : yes | ||
+ | fpu_exception | ||
+ | cpuid level : 13 | ||
+ | wp : yes | ||
+ | flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti | ||
+ | bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit | ||
+ | bogomips | ||
+ | clflush size : 64 | ||
+ | cache_alignment : 128 | ||
+ | address sizes : 40 bits physical, 48 bits virtual | ||
+ | power management: | ||
+ | |||
+ | processor | ||
+ | vendor_id | ||
+ | cpu family | ||
+ | model : 6 | ||
+ | model name : Common KVM processor | ||
+ | stepping | ||
+ | microcode | ||
+ | cpu MHz : 1999.987 | ||
+ | cache size : 16384 KB | ||
+ | physical id : 0 | ||
+ | siblings | ||
+ | core id : 1 | ||
+ | cpu cores : 4 | ||
+ | apicid | ||
+ | initial apicid | ||
+ | fpu : yes | ||
+ | fpu_exception | ||
+ | cpuid level : 13 | ||
+ | wp : yes | ||
+ | flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti | ||
+ | bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit | ||
+ | bogomips | ||
+ | clflush size : 64 | ||
+ | cache_alignment : 128 | ||
+ | address sizes : 40 bits physical, 48 bits virtual | ||
+ | power management: | ||
+ | |||
+ | processor | ||
+ | vendor_id | ||
+ | cpu family | ||
+ | model : 6 | ||
+ | model name : Common KVM processor | ||
+ | stepping | ||
+ | microcode | ||
+ | cpu MHz : 1999.987 | ||
+ | cache size : 16384 KB | ||
+ | physical id : 0 | ||
+ | siblings | ||
+ | core id : 2 | ||
+ | cpu cores : 4 | ||
+ | apicid | ||
+ | initial apicid | ||
+ | fpu : yes | ||
+ | fpu_exception | ||
+ | cpuid level : 13 | ||
+ | wp : yes | ||
+ | flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti | ||
+ | bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit | ||
+ | bogomips | ||
+ | clflush size : 64 | ||
+ | cache_alignment : 128 | ||
+ | address sizes : 40 bits physical, 48 bits virtual | ||
+ | power management: | ||
+ | |||
+ | processor | ||
+ | vendor_id | ||
+ | cpu family | ||
+ | model : 6 | ||
+ | model name : Common KVM processor | ||
+ | stepping | ||
+ | microcode | ||
+ | cpu MHz : 1999.987 | ||
+ | cache size : 16384 KB | ||
+ | physical id : 0 | ||
+ | siblings | ||
+ | core id : 3 | ||
+ | cpu cores : 4 | ||
+ | apicid | ||
+ | initial apicid | ||
+ | fpu : yes | ||
+ | fpu_exception | ||
+ | cpuid level : 13 | ||
+ | wp : yes | ||
+ | flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti | ||
+ | bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit | ||
+ | bogomips | ||
+ | clflush size : 64 | ||
+ | cache_alignment : 128 | ||
+ | address sizes : 40 bits physical, 48 bits virtual | ||
+ | power management: | ||
+ | |||
+ | processor | ||
+ | vendor_id | ||
+ | cpu family | ||
+ | model : 6 | ||
+ | model name : Common KVM processor | ||
+ | stepping | ||
+ | microcode | ||
+ | cpu MHz : 1999.987 | ||
+ | cache size : 16384 KB | ||
+ | physical id : 1 | ||
+ | siblings | ||
+ | core id : 0 | ||
+ | cpu cores : 4 | ||
+ | apicid | ||
+ | initial apicid | ||
+ | fpu : yes | ||
+ | fpu_exception | ||
+ | cpuid level : 13 | ||
+ | wp : yes | ||
+ | flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti | ||
+ | bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit | ||
+ | bogomips | ||
+ | clflush size : 64 | ||
+ | cache_alignment : 128 | ||
+ | address sizes : 40 bits physical, 48 bits virtual | ||
+ | power management: | ||
+ | |||
+ | processor | ||
+ | vendor_id | ||
+ | cpu family | ||
+ | model : 6 | ||
+ | model name : Common KVM processor | ||
+ | stepping | ||
+ | microcode | ||
+ | cpu MHz : 1999.987 | ||
+ | cache size : 16384 KB | ||
+ | physical id : 1 | ||
+ | siblings | ||
+ | core id : 1 | ||
+ | cpu cores : 4 | ||
+ | apicid | ||
+ | initial apicid | ||
+ | fpu : yes | ||
+ | fpu_exception | ||
+ | cpuid level : 13 | ||
+ | wp : yes | ||
+ | flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti | ||
+ | bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit | ||
+ | bogomips | ||
+ | clflush size : 64 | ||
+ | cache_alignment : 128 | ||
+ | address sizes : 40 bits physical, 48 bits virtual | ||
+ | power management: | ||
+ | |||
+ | processor | ||
+ | vendor_id | ||
+ | cpu family | ||
+ | model : 6 | ||
+ | model name : Common KVM processor | ||
+ | stepping | ||
+ | microcode | ||
+ | cpu MHz : 1999.987 | ||
+ | cache size : 16384 KB | ||
+ | physical id : 1 | ||
+ | siblings | ||
+ | core id : 2 | ||
+ | cpu cores : 4 | ||
+ | apicid | ||
+ | initial apicid | ||
+ | fpu : yes | ||
+ | fpu_exception | ||
+ | cpuid level : 13 | ||
+ | wp : yes | ||
+ | flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti | ||
+ | bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit | ||
+ | bogomips | ||
+ | clflush size : 64 | ||
+ | cache_alignment : 128 | ||
+ | address sizes : 40 bits physical, 48 bits virtual | ||
+ | power management: | ||
+ | |||
+ | processor | ||
+ | vendor_id | ||
+ | cpu family | ||
+ | model : 6 | ||
+ | model name : Common KVM processor | ||
+ | stepping | ||
+ | microcode | ||
+ | cpu MHz : 1999.987 | ||
+ | cache size : 16384 KB | ||
+ | physical id : 1 | ||
+ | siblings | ||
+ | core id : 3 | ||
+ | cpu cores : 4 | ||
+ | apicid | ||
+ | initial apicid | ||
+ | fpu : yes | ||
+ | fpu_exception | ||
+ | cpuid level : 13 | ||
+ | wp : yes | ||
+ | flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti | ||
+ | bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit | ||
+ | bogomips | ||
+ | clflush size : 64 | ||
+ | cache_alignment : 128 | ||
+ | address sizes : 40 bits physical, 48 bits virtual | ||
+ | power management: | ||
+ | </ | ||
+ | |||
+ | ==Interruptions système== | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | | ||
+ | 0: 109 0 0 0 0 0 0 0 | ||
+ | 1: 0 0 0 0 9 0 0 0 | ||
+ | 8: 0 0 0 0 0 1 0 0 | ||
+ | 9: 0 0 0 0 0 0 0 0 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | NMI: 0 0 0 0 0 0 0 0 | ||
+ | LOC: | ||
+ | SPU: 0 0 0 0 0 0 0 0 | ||
+ | PMI: 0 0 0 0 0 0 0 0 | ||
+ | IWI: 0 0 0 0 2 0 0 0 IRQ work interrupts | ||
+ | RTR: 0 0 0 0 0 0 0 0 APIC ICR read retries | ||
+ | RES: | ||
+ | CAL: 11095 11007 10841 10343 14679 | ||
+ | TLB: | ||
+ | TRM: 0 0 0 0 0 0 0 0 | ||
+ | THR: 0 0 0 0 0 0 0 0 | ||
+ | DFR: 0 0 0 0 0 0 0 0 | ||
+ | MCE: 0 0 0 0 0 0 0 0 | ||
+ | MCP: 288 288 288 288 288 288 288 288 | ||
+ | HYP: 0 0 0 0 0 0 0 0 | ||
+ | HRE: 0 0 0 0 0 0 0 0 | ||
+ | HVS: 0 0 0 0 0 0 0 0 | ||
+ | ERR: 0 | ||
+ | MIS: 0 | ||
+ | PIN: 0 0 0 0 0 0 0 0 | ||
+ | NPI: 0 0 0 0 0 0 0 0 | ||
+ | PIW: 0 0 0 0 0 0 0 0 | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Un pilote de périphérique demande au processeur de fournir un service en utilisant un IRQ. Quand la demande est faite, le processeur interrompe ses activités et passe le contrôle au pilote identifié par l'IRQ. Techniquement l' | ||
+ | </ | ||
+ | |||
+ | ==Canaux DMA== | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat /proc/dma | ||
+ | 4: cascade | ||
+ | </ | ||
+ | |||
+ | ==Plages d' | ||
+ | |||
+ | < | ||
+ | root@centos8 ~]# cat / | ||
+ | 0000-0cf7 : PCI Bus 0000:00 | ||
+ | 0000-001f : dma1 | ||
+ | 0020-0021 : pic1 | ||
+ | 0040-0043 : timer0 | ||
+ | 0050-0053 : timer1 | ||
+ | 0060-0060 : keyboard | ||
+ | 0064-0064 : keyboard | ||
+ | 0070-0077 : rtc0 | ||
+ | 0080-008f : dma page reg | ||
+ | 00a0-00a1 : pic2 | ||
+ | 00c0-00df : dma2 | ||
+ | 00f0-00ff : fpu | ||
+ | 0170-0177 : 0000: | ||
+ | 0170-0177 : ata_piix | ||
+ | 01f0-01f7 : 0000: | ||
+ | 01f0-01f7 : ata_piix | ||
+ | 0376-0376 : 0000: | ||
+ | 0376-0376 : ata_piix | ||
+ | 03c0-03df : vga+ | ||
+ | 03f6-03f6 : 0000: | ||
+ | 03f6-03f6 : ata_piix | ||
+ | --More-- | ||
+ | </ | ||
+ | |||
+ | <WRAP center round alert 60%> | ||
+ | **Important** - Si deux périphériques ont le même port, les **deux** périphériques seront inutilisables. | ||
+ | </ | ||
+ | |||
+ | ==Périphériques== | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | Character devices: | ||
+ | 1 mem | ||
+ | 4 /dev/vc/0 | ||
+ | 4 tty | ||
+ | 4 ttyS | ||
+ | 5 /dev/tty | ||
+ | 5 / | ||
+ | 5 /dev/ptmx | ||
+ | 7 vcs | ||
+ | 10 misc | ||
+ | 13 input | ||
+ | 21 sg | ||
+ | 29 fb | ||
+ | 128 ptm | ||
+ | 136 pts | ||
+ | 162 raw | ||
+ | 180 usb | ||
+ | 188 ttyUSB | ||
+ | 189 usb_device | ||
+ | 202 cpu/msr | ||
+ | 203 cpu/cpuid | ||
+ | 226 drm | ||
+ | 244 aux | ||
+ | 245 hidraw | ||
+ | 246 usbmon | ||
+ | 247 bsg | ||
+ | 248 watchdog | ||
+ | 249 ptp | ||
+ | 250 pps | ||
+ | 251 rtc | ||
+ | 252 dax | ||
+ | 253 tpm | ||
+ | 254 gpiochip | ||
+ | |||
+ | Block devices: | ||
+ | 8 sd | ||
+ | 9 md | ||
+ | 11 sr | ||
+ | 65 sd | ||
+ | 66 sd | ||
+ | 67 sd | ||
+ | 68 sd | ||
+ | 69 sd | ||
+ | 70 sd | ||
+ | 71 sd | ||
+ | 128 sd | ||
+ | 129 sd | ||
+ | 130 sd | ||
+ | 131 sd | ||
+ | 132 sd | ||
+ | 133 sd | ||
+ | 134 sd | ||
+ | 135 sd | ||
+ | 253 device-mapper | ||
+ | 254 mdp | ||
+ | 259 blkext | ||
+ | </ | ||
+ | |||
+ | ==Modules== | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | xt_CHECKSUM 16384 1 - Live 0xffffffffc09a8000 | ||
+ | ipt_MASQUERADE 16384 3 - Live 0xffffffffc09a3000 | ||
+ | xt_conntrack 16384 1 - Live 0xffffffffc099e000 | ||
+ | ipt_REJECT 16384 2 - Live 0xffffffffc0999000 | ||
+ | nft_compat 20480 16 - Live 0xffffffffc0993000 | ||
+ | nf_nat_tftp 16384 0 - Live 0xffffffffc098b000 | ||
+ | nft_objref 16384 1 - Live 0xffffffffc0986000 | ||
+ | nf_conntrack_tftp 16384 3 nf_nat_tftp, | ||
+ | nft_counter 16384 33 - Live 0xffffffffc097c000 | ||
+ | tun 53248 1 - Live 0xffffffffc096e000 | ||
+ | bridge 192512 0 - Live 0xffffffffc093e000 | ||
+ | stp 16384 1 bridge, Live 0xffffffffc0939000 | ||
+ | llc 16384 2 bridge,stp, Live 0xffffffffc0930000 | ||
+ | nft_fib_inet 16384 1 - Live 0xffffffffc08f5000 | ||
+ | nft_fib_ipv4 16384 1 nft_fib_inet, | ||
+ | nft_fib_ipv6 16384 1 nft_fib_inet, | ||
+ | nft_fib 16384 3 nft_fib_inet, | ||
+ | nft_reject_inet 16384 5 - Live 0xffffffffc08de000 | ||
+ | nf_reject_ipv4 16384 2 ipt_REJECT, | ||
+ | nf_reject_ipv6 16384 1 nft_reject_inet, | ||
+ | nft_reject 16384 1 nft_reject_inet, | ||
+ | --More-- | ||
+ | </ | ||
+ | |||
+ | ==Statistiques de l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 11 0 sr0 10 0 4 2 0 0 0 0 0 9 2 0 0 0 0 | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | ==Partitions== | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | major minor # | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 11 0 1048575 sr0 | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | ==Espaces de pagination== | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat /proc/swaps | ||
+ | Filename | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | ==Statistiques d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | 0.00 0.00 0.00 1/697 16936 | ||
+ | </ | ||
+ | |||
+ | ==Statistiques d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | MemTotal: | ||
+ | MemFree: | ||
+ | MemAvailable: | ||
+ | Buffers: | ||
+ | Cached: | ||
+ | SwapCached: | ||
+ | Active: | ||
+ | Inactive: | ||
+ | Active(anon): | ||
+ | Inactive(anon): | ||
+ | Active(file): | ||
+ | Inactive(file): | ||
+ | Unevictable: | ||
+ | Mlocked: | ||
+ | SwapTotal: | ||
+ | SwapFree: | ||
+ | Dirty: | ||
+ | Writeback: | ||
+ | AnonPages: | ||
+ | Mapped: | ||
+ | Shmem: | ||
+ | KReclaimable: | ||
+ | Slab: | ||
+ | SReclaimable: | ||
+ | SUnreclaim: | ||
+ | KernelStack: | ||
+ | PageTables: | ||
+ | NFS_Unstable: | ||
+ | Bounce: | ||
+ | WritebackTmp: | ||
+ | CommitLimit: | ||
+ | Committed_AS: | ||
+ | VmallocTotal: | ||
+ | VmallocUsed: | ||
+ | VmallocChunk: | ||
+ | Percpu: | ||
+ | HardwareCorrupted: | ||
+ | AnonHugePages: | ||
+ | ShmemHugePages: | ||
+ | ShmemPmdMapped: | ||
+ | FileHugePages: | ||
+ | FilePmdMapped: | ||
+ | HugePages_Total: | ||
+ | HugePages_Free: | ||
+ | HugePages_Rsvd: | ||
+ | HugePages_Surp: | ||
+ | Hugepagesize: | ||
+ | Hugetlb: | ||
+ | DirectMap4k: | ||
+ | DirectMap2M: | ||
+ | </ | ||
+ | |||
+ | ==Version du noyau== | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | Linux version 4.18.0-305.3.1.el8.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.4.1 20200928 (Red Hat 8.4.1-1) (GCC)) #1 SMP Tue Jun 1 16:14:33 UTC 2021 | ||
+ | </ | ||
+ | |||
+ | ===Répertoires=== | ||
+ | |||
+ | ==ide/ | ||
+ | |||
+ | Ce répertoire contient des répertoires dans lesquels se trouvent des informations sur la capacité, le type et la géométrie des disques. | ||
+ | |||
+ | ==acpi== | ||
+ | |||
+ | Ce répertoire contient des informations sur la gestion de l' | ||
+ | |||
+ | ==bus== | ||
+ | |||
+ | Ce répertoire contient un sous-répertoire par bus. | ||
+ | |||
+ | ==net== | ||
+ | |||
+ | Ce répertoire contient des informations sur le réseau. | ||
+ | |||
+ | ==sys== | ||
+ | |||
+ | Ce répertoire contient des paramètres du noyau. Certains des fichiers dans ce répertoire sont accessibles en écriture par root en temps réel. Par exemple pour éviter des attaques réseau **%%DoS%%** utilisant la commande **ping**, saisissez la commande suivante : | ||
+ | |||
+ | # echo 1 > / | ||
+ | |||
+ | Cette commande a pour résultat d' | ||
+ | |||
+ | ====2.2 - Utilisation de la Commande sysctl==== | ||
+ | |||
+ | Les fichiers dans le répertoire **/ | ||
+ | |||
+ | La commande **sysctl** applique les règles consignés dans le fichier **/ | ||
+ | |||
+ | Saisissez la commande : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | # sysctl settings are defined through files in | ||
+ | # / | ||
+ | # | ||
+ | # Vendors settings live in / | ||
+ | # To override a whole file, create a new file with the same in | ||
+ | # / | ||
+ | # only specific settings, add a file with a lexically later | ||
+ | # name in / | ||
+ | # | ||
+ | # For more information, | ||
+ | |||
+ | [root@centos8 ~]# ls -l / | ||
+ | total 0 | ||
+ | lrwxrwxrwx. 1 root root 14 Mar 16 15:42 99-sysctl.conf -> ../ | ||
+ | [root@centos8 ~]# ls -l / | ||
+ | total 24 | ||
+ | -rw-r--r--. 1 root root 1810 Dec 22 2020 10-default-yama-scope.conf | ||
+ | -rw-r--r--. 1 root root 524 Mar 16 15:42 50-coredump.conf | ||
+ | -rw-r--r--. 1 root root 1270 Mar 16 15:42 50-default.conf | ||
+ | -rw-r--r--. 1 root root 246 Jun 15 2020 50-libkcapi-optmem_max.conf | ||
+ | -rw-r--r--. 1 root root 636 Mar 16 15:42 50-pid-max.conf | ||
+ | -rw-r--r--. 1 root root 499 Nov 26 2019 60-libvirtd.conf | ||
+ | |||
+ | [root@centos8 ~]# cat / | ||
+ | # This file is part of systemd. | ||
+ | # | ||
+ | # systemd is free software; you can redistribute it and/or modify it | ||
+ | # under the terms of the GNU Lesser General Public License as published by | ||
+ | # the Free Software Foundation; either version 2.1 of the License, or | ||
+ | # (at your option) any later version. | ||
+ | |||
+ | # See sysctl.d(5) and core(5) for documentation. | ||
+ | |||
+ | # To override settings in this file, create a local file in /etc | ||
+ | # (e.g. / | ||
+ | # there. | ||
+ | |||
+ | # System Request functionality of the kernel (SYNC) | ||
+ | # | ||
+ | # Use kernel.sysrq = 1 to allow all keys. | ||
+ | # See https:// | ||
+ | # of values and keys. | ||
+ | kernel.sysrq = 16 | ||
+ | |||
+ | # Append the PID to the core filename | ||
+ | kernel.core_uses_pid = 1 | ||
+ | |||
+ | # https:// | ||
+ | kernel.kptr_restrict = 1 | ||
+ | |||
+ | # Source route verification | ||
+ | net.ipv4.conf.all.rp_filter = 1 | ||
+ | |||
+ | # Do not accept source routing | ||
+ | net.ipv4.conf.all.accept_source_route = 0 | ||
+ | |||
+ | # Promote secondary addresses when the primary address is removed | ||
+ | net.ipv4.conf.all.promote_secondaries = 1 | ||
+ | |||
+ | # Fair Queue CoDel packet scheduler to fight bufferbloat | ||
+ | net.core.default_qdisc = fq_codel | ||
+ | |||
+ | # Enable hard and soft link protection | ||
+ | fs.protected_hardlinks = 1 | ||
+ | fs.protected_symlinks = 1 | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **sysctl** sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# sysctl --help | ||
+ | |||
+ | Usage: | ||
+ | | ||
+ | |||
+ | Options: | ||
+ | -a, --all display all variables | ||
+ | -A alias of -a | ||
+ | -X alias of -a | ||
+ | --deprecated | ||
+ | -b, --binary | ||
+ | -e, --ignore | ||
+ | -N, --names | ||
+ | -n, --values | ||
+ | -p, --load[=< | ||
+ | -f alias of -p | ||
+ | --system | ||
+ | -r, --pattern < | ||
+ | | ||
+ | -q, --quiet | ||
+ | -w, --write | ||
+ | -o does nothing | ||
+ | -x does nothing | ||
+ | -d alias of -h | ||
+ | |||
+ | -h, --help | ||
+ | -V, --version | ||
+ | |||
+ | For more details see sysctl(8). | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Consultez la page de la traduction du manuel de **sysctl** **[[http:// | ||
+ | </ | ||
+ | |||
+ | =====LAB#3 - Interprétation des informations dans /proc===== | ||
+ | |||
+ | Les informations brutes stockées dans /proc peuvent être interprétées grâce à l' | ||
+ | |||
+ | * free, | ||
+ | * uptime et w, | ||
+ | * iostat, | ||
+ | * hdparm, | ||
+ | * vmstat, | ||
+ | * mpstat, | ||
+ | * sar. | ||
+ | |||
+ | ====3.1 - La Commande free==== | ||
+ | |||
+ | La commande **free** permet de donner l’état de la mémoire totale, libre, partagée, swap et bufferisée. Saisissez donc la commande suivante : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# free -m | ||
+ | total used free shared | ||
+ | Mem: | ||
+ | Swap: 3279 | ||
+ | </ | ||
+ | |||
+ | Dans le cas de cet exemple, nous pouvons constater que l’affichage montre : | ||
+ | |||
+ | * 3735 Mo de mémoire physique totale, | ||
+ | * 1135 Mo de mémoire physique utilisée et 1818 Mo de mémoire physique libre, | ||
+ | * 3279 Mo de mémoire swap totale et 0 Mo de swap utilisé | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# free --help | ||
+ | |||
+ | Usage: | ||
+ | free [options] | ||
+ | |||
+ | Options: | ||
+ | -b, --bytes | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | -k, --kibi | ||
+ | -m, --mebi | ||
+ | -g, --gibi | ||
+ | | ||
+ | | ||
+ | -h, --human | ||
+ | | ||
+ | -l, --lohi | ||
+ | -t, --total | ||
+ | -s N, --seconds N | ||
+ | -c N, --count N | ||
+ | -w, --wide | ||
+ | |||
+ | | ||
+ | -V, --version | ||
+ | |||
+ | For more details see free(1). | ||
+ | </ | ||
+ | |||
+ | ====3.2 - Les Commandes uptime et w==== | ||
+ | |||
+ | Chacune des ces commandes indique la charge moyenne du ou des processeurs depuis 1 minute, 5 minutes et 15 minutes : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# uptime | ||
+ | | ||
+ | |||
+ | [root@centos8 ~]# w | ||
+ | | ||
+ | USER | ||
+ | trainee | ||
+ | </ | ||
+ | |||
+ | Les valeurs **load average** ou //charge moyenne// indiquent le nombre moyen de processus en cours de traitement ou en attente pour la période concernée. | ||
+ | |||
+ | Par exemple si les valeurs sur un système muni d'un seul processeur étaient **3, | ||
+ | |||
+ | * 2,48 processus en attente dans la dernière minute, | ||
+ | * 3,00 processus en attente dans les dernières 5 minutes, | ||
+ | * 2,85 processus en attente dans les dernières 15 minutes. | ||
+ | |||
+ | Les options de ces commandes sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# uptime --help | ||
+ | |||
+ | Usage: | ||
+ | | ||
+ | |||
+ | Options: | ||
+ | -p, --pretty | ||
+ | -h, --help | ||
+ | -s, --since | ||
+ | -V, --version | ||
+ | |||
+ | For more details see uptime(1). | ||
+ | |||
+ | [root@centos8 ~]# w --help | ||
+ | |||
+ | Usage: | ||
+ | w [options] | ||
+ | |||
+ | Options: | ||
+ | -h, --no-header | ||
+ | -u, --no-current | ||
+ | -s, --short | ||
+ | -f, --from | ||
+ | -o, --old-style | ||
+ | -i, --ip-addr | ||
+ | |||
+ | | ||
+ | -V, --version | ||
+ | |||
+ | For more details see w(1). | ||
+ | </ | ||
+ | |||
+ | ====3.3 - La Commande iostat==== | ||
+ | |||
+ | La commande **iostat** affiche des statistiques sur l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# iostat | ||
+ | bash: iostat: command not found... | ||
+ | Install package ' | ||
+ | |||
+ | |||
+ | * Waiting in queue... | ||
+ | The following packages have to be installed: | ||
+ | | ||
+ | | ||
+ | Proceed with changes? [N/y] y | ||
+ | |||
+ | |||
+ | * Waiting in queue... | ||
+ | * Waiting for authentication... | ||
+ | * Waiting in queue... | ||
+ | * Downloading packages... | ||
+ | * Requesting data... | ||
+ | * Testing changes... | ||
+ | * Installing packages... | ||
+ | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | ||
+ | |||
+ | avg-cpu: | ||
+ | | ||
+ | |||
+ | Device | ||
+ | sda | ||
+ | sdb | ||
+ | scd0 0.00 | ||
+ | dm-0 0.26 | ||
+ | dm-1 0.00 | ||
+ | </ | ||
+ | |||
+ | Au-dessous de la première ligne indiquant la version du noyau du système et son nom d' | ||
+ | |||
+ | * **%user** - Pourcentage de temps passé en mode utilisateur (exécutant des applications, | ||
+ | * **%nice** - Pourcentage de temps passé en mode utilisateur (pour les processus qui ont modifié leur priorité de programmation à l'aide de la commande nice) | ||
+ | * **%system** - Pourcentage de temps passé en mode noyau | ||
+ | * **%steal** - Pourcentage du temps passé par des CPU virtuels en attendant que l' | ||
+ | * **%iowait** - Pourcentage du temps passé à attendre les entrées et les sorties des disques. | ||
+ | * **%idle** - Pourcentage de temps passé en inactivité | ||
+ | |||
+ | Notez la valeur de **%iowait**. Dans le cas où ce pourcentage est trop élévé, ceci indique que le processeur passe son temps à attendre les entrées et les sorties de disque. | ||
+ | |||
+ | Au-dessous du rapport d' | ||
+ | |||
+ | * La spécification du périphérique. | ||
+ | * Le nombre de transferts (ou opérations d'E/S) par seconde. | ||
+ | * Le nombre de blocs de KB lus par seconde. | ||
+ | * Le nombre de blocs de KB écrits par seconde. | ||
+ | * Le nombre total de KB lus. | ||
+ | * Le nombre total de KB écrits. | ||
+ | | ||
+ | Dernièrement, | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# iostat -d -x | ||
+ | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | ||
+ | |||
+ | Device | ||
+ | sda 0.20 0.16 | ||
+ | sdb 0.00 0.00 0.02 0.00 | ||
+ | scd0 | ||
+ | dm-0 | ||
+ | dm-1 | ||
+ | </ | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# iostat --help | ||
+ | Usage: iostat [ options ] [ < | ||
+ | Options are: | ||
+ | [ -c ] [ -d ] [ -h ] [ -k | -m ] [ -N ] [ -s ] [ -t ] [ -V ] [ -x ] [ -y ] [ -z ] | ||
+ | [ -j { ID | LABEL | PATH | UUID | ... } ] [ --human ] [ -o JSON ] | ||
+ | [ [ -H ] -g < | ||
+ | [ < | ||
+ | </ | ||
+ | |||
+ | ====3.4 - La Commande hdparm==== | ||
+ | |||
+ | Pour surveiller la vitesse des entrées et des sorties du disque, vous pouvez utiliser la commande **hdparm** : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# hdparm -t /dev/sda | ||
+ | |||
+ | /dev/sda: | ||
+ | | ||
+ | </ | ||
+ | |||
+ | ====3.5 - La Commande vmstat==== | ||
+ | |||
+ | La commande **vmstat** affiche des statistiques sur la mémoire, la pagination et la charge ponctuelle du processeur : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# vmstat 1 10 | ||
+ | procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | La première ligne subdivise le champ en six catégories à savoir : processus, mémoire, swap, E/S, système et CPU sur lesquelles elle donne des statistiques. La seconde ligne identifie de manière encore plus détaillée chacun des champs, permettant ainsi de parcourir simplement et rapidement l' | ||
+ | |||
+ | Les champs relatifs aux processus sont les suivants : | ||
+ | |||
+ | * r — Le nombre de processus exécutables attendant d' | ||
+ | * b — Le nombre de processus exécutables dans un état de veille qui ne peut être interrompu | ||
+ | |||
+ | Les champs relatifs à la mémoire sont les suivants : | ||
+ | |||
+ | * swpd — La quantité de mémoire virtuelle utilisée | ||
+ | * free — La quantité de mémoire libre | ||
+ | * buff — La quantité de mémoire utilisée par les tampons (ou buffers) | ||
+ | * cache — La quantité de mémoire utilisée comme cache de pages | ||
+ | |||
+ | Les champs relatifs au swap sont les suivants : | ||
+ | |||
+ | * si — La quantité de mémoire chargée depuis le disque | ||
+ | * so — La quantité de mémoire déchargée sur le disque | ||
+ | |||
+ | Les champs relatifs aux Entrées/ | ||
+ | |||
+ | * bi — Blocs envoyés vers un périphérique blocs | ||
+ | * bo— Blocs reçus d'un périphérique blocs | ||
+ | |||
+ | Les champs relatifs au système sont les suivants : | ||
+ | |||
+ | * in — Nombre d' | ||
+ | * cs — Nombre de changements de contexte par seconde | ||
+ | |||
+ | Les champs relatifs au CPU sont les suivants : | ||
+ | |||
+ | * us — Le pourcentage de temps pendant lequel le CPU exécute un code de niveau utilisateur | ||
+ | * sy — Le pourcentage de temps pendant lequel le CPU exécute un code de niveau système | ||
+ | * id — Le pourcentage de temps pendant lequel le CPU était inoccupé | ||
+ | * wa — Attente d'E/S | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# vmstat --help | ||
+ | |||
+ | Usage: | ||
+ | | ||
+ | |||
+ | Options: | ||
+ | -a, --active | ||
+ | -f, --forks | ||
+ | -m, --slabs | ||
+ | -n, --one-header | ||
+ | -s, --stats | ||
+ | -d, --disk | ||
+ | -D, --disk-sum | ||
+ | -p, --partition < | ||
+ | -S, --unit < | ||
+ | -w, --wide | ||
+ | -t, --timestamp | ||
+ | |||
+ | -h, --help | ||
+ | -V, --version | ||
+ | |||
+ | For more details see vmstat(8). | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Par défaut la commande vmstat affiche des informations depuis le démarrage du système. | ||
+ | </ | ||
+ | |||
+ | ====3.6 - La Commande mpstat==== | ||
+ | |||
+ | La commande **mpstat** affiche des statistiques détaillées sur le CPU : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mpstat | ||
+ | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | ||
+ | |||
+ | 04: | ||
+ | 04: | ||
+ | </ | ||
+ | |||
+ | Dans le cas où vous avez plusieurs processeurs ou coeurs, vous pouvez visualiser ces mêmes informations par unité de traitement : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mpstat -P ALL | ||
+ | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | ||
+ | |||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | </ | ||
+ | |||
+ | Pour afficher 5 jeux de statistiques à des intervales de 2 secondes pour tous les unités de traitement, il convient d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mpstat -P ALL 2 5 | ||
+ | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | ||
+ | |||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | |||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | |||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | |||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | |||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | 04: | ||
+ | |||
+ | Average: | ||
+ | Average: | ||
+ | Average: | ||
+ | Average: | ||
+ | Average: | ||
+ | Average: | ||
+ | Average: | ||
+ | Average: | ||
+ | Average: | ||
+ | Average: | ||
+ | </ | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mpstat --help | ||
+ | Usage: mpstat [ options ] [ < | ||
+ | Options are: | ||
+ | [ -A ] [ -n ] [ -u ] [ -V ] [ -I { SUM | CPU | SCPU | ALL } ] | ||
+ | [ -N { < | ||
+ | </ | ||
+ | |||
+ | ====3.7 - La Commande sar==== | ||
+ | |||
+ | La commande **sar** (**S**ystem **A**ctivity **R**eporter) permet de surveiller toutes les ressources du système selon l' | ||
+ | |||
+ | Sous RHEL/CentOS 8 la commande **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ls / | ||
+ | sa1 sa2 sadc | ||
+ | </ | ||
+ | |||
+ | Le script **/ | ||
+ | |||
+ | ^ Option ^ Description ^ | ||
+ | | -t | L' | ||
+ | | -n | Nombre de collectes | | ||
+ | |||
+ | Le script **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ls / | ||
+ | sa29 s | ||
+ | |||
+ | |||
+ | ar29 | ||
+ | </ | ||
+ | |||
+ | Sous CentOS / RHEL 8, l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | # / | ||
+ | # (C) 2014 Tomasz Torcz < | ||
+ | # | ||
+ | # sysstat-11.7.3 systemd unit file: | ||
+ | # Activates activity collector every 10 minutes | ||
+ | |||
+ | [Unit] | ||
+ | Description=Run system activity accounting tool every 10 minutes | ||
+ | |||
+ | [Timer] | ||
+ | OnCalendar=*: | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=sysstat.service | ||
+ | </ | ||
+ | |||
+ | La valeur de **OnCalendar** indique un collecte toutes les dix minutes. | ||
+ | |||
+ | Pour modifier l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# systemctl edit sysstat-collect.timer | ||
+ | [root@centos8 ~]# cat / | ||
+ | [Unit] | ||
+ | Description=Run system activity accounting tool every 2 minutes | ||
+ | |||
+ | [Timer] | ||
+ | OnCalendar= | ||
+ | OnCalendar=*: | ||
+ | AccuracySec=0 | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Notez la ligne **OnCalendar=** qui est necessaire afin de surcharger la valeur par défaut. | ||
+ | </ | ||
+ | |||
+ | Vérifiez ensuite la prise en compte de la configuration : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# systemctl status sysstat-collect.timer | ||
+ | ● sysstat-collect.timer - Run system activity accounting tool every 2 minutes | ||
+ | | ||
+ | Drop-In: / | ||
+ | | ||
+ | | ||
+ | Trigger: Tue 2021-06-29 09:20:00 EDT; 1min 19s left | ||
+ | |||
+ | Jun 29 06:16:04 centos8.ittraining.loc systemd[1]: Started Run system activity accounting tool every 10 minutes. | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# journalctl -g sysstat-collect.service | ||
+ | -- Logs begin at Mon 2021-06-28 02:04:10 EDT, end at Tue 2021-06-29 09:18:00 EDT. -- | ||
+ | Jun 29 06:20:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: | ||
+ | Jun 29 06:26:29 centos8.ittraining.loc systemd[1]: sysstat-collect.service: | ||
+ | Jun 29 06:30:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: | ||
+ | Jun 29 06:40:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: | ||
+ | Jun 29 06:50:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: | ||
+ | Jun 29 07:00:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: | ||
+ | Jun 29 07:10:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: | ||
+ | Jun 29 07:20:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: | ||
+ | Jun 29 07:30:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: | ||
+ | Jun 29 07:40:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: | ||
+ | Jun 29 07:50:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: | ||
+ | Jun 29 07:53:56 centos8.ittraining.loc systemd[1]: sysstat-collect.service: | ||
+ | Jun 29 07:54:00 centos8.ittraining.loc systemd[1]: sysstat-collect.service: | ||
+ | Jun 29 07:56:00 centos8.ittraining.loc systemd[1]: sysstat-collect.service: | ||
+ | Jun 29 07:58:00 centos8.ittraining.loc systemd[1]: sysstat-collect.service: | ||
+ | Jun 29 08:00:00 centos8.ittraining.loc systemd[1]: sysstat-collect.service: | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | Saisissez la commande suivante : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# sar | ||
+ | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | ||
+ | |||
+ | 06: | ||
+ | |||
+ | 06: | ||
+ | 06: | ||
+ | 06: | ||
+ | 06: | ||
+ | 06: | ||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | Average: | ||
+ | |||
+ | 07: | ||
+ | |||
+ | 07: | ||
+ | 07: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 08: | ||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | |||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | Average: | ||
+ | </ | ||
+ | |||
+ | ===Statistiques d' | ||
+ | |||
+ | Visualisez maintenant les statistiques d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# sar -u 5 3 | ||
+ | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | ||
+ | |||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | Average: | ||
+ | </ | ||
+ | |||
+ | D' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# sar -u ALL 5 3 | ||
+ | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | ||
+ | |||
+ | 01: | ||
+ | 01: | ||
+ | 01: | ||
+ | 01: | ||
+ | Average: | ||
+ | </ | ||
+ | |||
+ | Pour consulter les statistiques d'un coeur spécifique, | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# sar -u -P 1 5 3 | ||
+ | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | ||
+ | |||
+ | 01: | ||
+ | 01: | ||
+ | 01: | ||
+ | 01: | ||
+ | Average: | ||
+ | [root@centos8 ~]# sar -u -P 5 5 3 | ||
+ | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | ||
+ | |||
+ | 01: | ||
+ | 01: | ||
+ | 01: | ||
+ | 01: | ||
+ | Average: | ||
+ | </ | ||
+ | |||
+ | ===Statistiques d' | ||
+ | |||
+ | Utilisez l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# sar -r 5 3 | ||
+ | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | ||
+ | |||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | Average: | ||
+ | </ | ||
+ | |||
+ | Utilisez l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# sar -S 5 3 | ||
+ | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | ||
+ | |||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | Average: | ||
+ | </ | ||
+ | |||
+ | ===Statistiques des E/S=== | ||
+ | |||
+ | Utilisez l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# sar -b 5 3 | ||
+ | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | ||
+ | |||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | Average: | ||
+ | </ | ||
+ | |||
+ | ===Statistiques des E/S par Disque=== | ||
+ | |||
+ | Utilisez l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# sar -d 5 3 | ||
+ | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | ||
+ | |||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | |||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | |||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | 09: | ||
+ | |||
+ | Average: | ||
+ | Average: | ||
+ | Average: | ||
+ | Average: | ||
+ | Average: | ||
+ | Average: | ||
+ | </ | ||
+ | |||
+ | La colonne **DEV** indentifie les disques par leurs majeurs et mineurs. Pour voir les informations avec les noms des disques, ajoutez l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# sar -p -d 5 3 | ||
+ | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | ||
+ | |||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | |||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | |||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | 07: | ||
+ | |||
+ | Average: | ||
+ | Average: | ||
+ | Average: | ||
+ | Average: | ||
+ | Average: | ||
+ | Average: | ||
+ | </ | ||
+ | |||
+ | Les options de la commande sar sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# sar --help | ||
+ | Usage: sar [ options ] [ < | ||
+ | Main options and reports (report name between square brackets): | ||
+ | -B Paging statistics [A_PAGE] | ||
+ | -b I/O and transfer rate statistics [A_IO] | ||
+ | -d Block devices statistics [A_DISK] | ||
+ | -F [ MOUNT ] | ||
+ | Filesystems statistics [A_FS] | ||
+ | -H Hugepages utilization statistics [A_HUGE] | ||
+ | -I { < | ||
+ | Interrupts statistics [A_IRQ] | ||
+ | -m { < | ||
+ | Power management statistics [A_PWR_...] | ||
+ | Keywords are: | ||
+ | CPU CPU instantaneous clock frequency | ||
+ | FAN Fans speed | ||
+ | FREQ CPU average clock frequency | ||
+ | IN Voltage inputs | ||
+ | TEMP Devices temperature | ||
+ | USB USB devices plugged into the system | ||
+ | -n { < | ||
+ | Network statistics [A_NET_...] | ||
+ | Keywords are: | ||
+ | DEV | ||
+ | EDEV Network interfaces (errors) | ||
+ | NFS NFS client | ||
+ | NFSD NFS server | ||
+ | SOCK Sockets (v4) | ||
+ | IP IP traffic | ||
+ | EIP IP traffic | ||
+ | ICMP ICMP traffic | ||
+ | EICMP ICMP traffic | ||
+ | TCP TCP traffic | ||
+ | ETCP TCP traffic | ||
+ | UDP UDP traffic | ||
+ | SOCK6 | ||
+ | IP6 IP traffic | ||
+ | EIP6 IP traffic | ||
+ | ICMP6 ICMP traffic | ||
+ | EICMP6 | ||
+ | UDP6 UDP traffic | ||
+ | FC Fibre channel HBAs | ||
+ | SOFT Software-based network processing | ||
+ | -q Queue length and load average statistics [A_QUEUE] | ||
+ | -r [ ALL ] | ||
+ | Memory utilization statistics [A_MEMORY] | ||
+ | -S Swap space utilization statistics [A_MEMORY] | ||
+ | -u [ ALL ] | ||
+ | CPU utilization statistics [A_CPU] | ||
+ | -v Kernel tables statistics [A_KTABLES] | ||
+ | -W Swapping statistics [A_SWAP] | ||
+ | -w Task creation and system switching statistics [A_PCSW] | ||
+ | -y TTY devices statistics [A_SERIAL] | ||
+ | </ | ||
+ | |||
+ | =====Modules usb===== | ||
+ | |||
+ | L' | ||
+ | |||
+ | ^ Version USB ^ Module ^ Nom Complet ^ | ||
+ | | 1.0\1.1 | ||
+ | | ::: | **OHCI** | //Open Controller Host Interface// | | ||
+ | | 2.0 | **EHCI** | //Enhanced Host Controller Interface// | | ||
+ | | 3.0 | **XHCI** | // | ||
+ | |||
+ | Le tableau suivant liste les modules courrament chargés en fonction du périphérique utilisé : | ||
+ | |||
+ | ^ Module ^ Type de Périphérique ^ | ||
+ | | **usb_storage** | ||
+ | | **usbhid** | ||
+ | | **snd-usb-audio** | ||
+ | | **usbvidéo** | ||
+ | | **irda-usb** | ||
+ | | **usbnet** | ||
+ | |||
+ | Les modules peuvent être chargés par un des moyens suivants : | ||
+ | |||
+ | * INITrd, | ||
+ | * Le processus init (systemd), | ||
+ | * kmod, d'une manière dynamique et transparente lors du branchement du périphérique, | ||
+ | * udev, | ||
+ | * manuellement. | ||
+ | |||
+ | =====udev===== | ||
+ | |||
+ | Depuis le noyau Linux 2.6 Linux est capable de détecter des périphériques branchés à chaud. Cette technologie s' | ||
+ | |||
+ | * Udev, | ||
+ | * HAL, | ||
+ | * Dbus. | ||
+ | |||
+ | Les rôles de chaque composant sont les suivants : | ||
+ | |||
+ | * Udev se charge de créer et supprimer d'une manière dynamique les nœuds dans le répertoire **/dev**, | ||
+ | * HAL obtient des informations à partir d'Udev et créé un fichier au format XML représentant le périphérique branché. Il informe ensuite Nautilus en utilisant le Dbus, | ||
+ | * Dbus joue le rôle d'un bus système qui est utilisé pour la communication inter-processus. | ||
+ | |||
+ | Lors de démarrage de Linux, Udev joue un rôle important : | ||
+ | |||
+ | * Au démarrage **tmpfs** est monté sur /dev, | ||
+ | * Udev copie les éventuels nœuds statiques de **/ | ||
+ | * le démon **udevd** collecte des données appelées **uevents** du noyau et cherche une règle correspondante dans le répertoire **/ | ||
+ | * Udev crée les nœuds et liens symboliques spécifiés dans la règle identifiée, | ||
+ | * Udev stocke les règles contenues dans **/ | ||
+ | * En cas de modification des ces règles, Udev met à jour la mémoire. | ||
+ | |||
+ | Udev repose sur le filesystem **sysfs** monté sur /sys qui permet de rendre les périphériques visibles à Udev dans l'// | ||
+ | |||
+ | Le fichier de configuration principal d'Udev est **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | # see udev.conf(5) for details | ||
+ | # | ||
+ | # udevd is also started in the initrd. | ||
+ | # also want to rebuild the initrd, so that it will include the modified configuration. | ||
+ | |||
+ | # | ||
+ | </ | ||
+ | |||
+ | Les fichiers de règles se trouvent dans **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ls / | ||
+ | 01-md-raid-creating.rules | ||
+ | 10-dm.rules | ||
+ | 11-dm-lvm.rules | ||
+ | 11-dm-mpath.rules | ||
+ | 11-dm-parts.rules | ||
+ | 13-dm-disk.rules | ||
+ | 39-usbmuxd.rules | ||
+ | 40-elevator.rules | ||
+ | 40-libgphoto2.rules | ||
+ | 40-redhat.rules | ||
+ | 40-usb-blacklist.rules | ||
+ | 40-usb_modeswitch.rules | ||
+ | 50-udev-default.rules | ||
+ | 60-alias-kmsg.rules | ||
+ | 60-block.rules | ||
+ | 60-cdrom_id.rules | ||
+ | 60-drm.rules | ||
+ | 60-evdev.rules | ||
+ | 60-fido-id.rules | ||
+ | 60-input-id.rules | ||
+ | 60-libfprint-2-autosuspend.rules | ||
+ | 60-net.rules | ||
+ | 60-persistent-alsa.rules | ||
+ | 60-persistent-input.rules | ||
+ | 60-persistent-storage.rules | ||
+ | 60-persistent-storage-tape.rules | ||
+ | 60-persistent-v4l.rules | ||
+ | 60-raw.rules | ||
+ | 60-rdma-ndd.rules | ||
+ | 60-rdma-persistent-naming.rules | ||
+ | 60-sensor.rules | ||
+ | 60-serial.rules | ||
+ | 60-tpm-udev.rules | ||
+ | 61-gdm.rules | ||
+ | 61-gnome-bluetooth-rfkill.rules | ||
+ | 61-gnome-settings-daemon-rfkill.rules | ||
+ | 61-scsi-sg3_id.rules | ||
+ | 62-multipath.rules | ||
+ | 63-fc-wwpn-id.rules | ||
+ | 63-md-raid-arrays.rules | ||
+ | 63-scsi-sg3_symlink.rules | ||
+ | 64-btrfs.rules | ||
+ | 64-md-raid-assembly.rules | ||
+ | 65-libwacom.rules | ||
+ | 65-md-incremental.rules | ||
+ | 65-sane-backends.rules | ||
+ | 66-kpartx.rules | ||
+ | 68-del-part-nodes.rules | ||
+ | 69-btattach-bcm.rules | ||
+ | 69-cd-sensors.rules | ||
+ | 69-dm-lvm-metad.rules | ||
+ | 69-libmtp.rules | ||
+ | 69-md-clustered-confirm-device.rules | ||
+ | 70-hypervfcopy.rules | ||
+ | 70-hypervkvp.rules | ||
+ | 70-hypervvss.rules | ||
+ | 70-joystick.rules | ||
+ | 70-mouse.rules | ||
+ | 70-nvmf-autoconnect.rules | ||
+ | 70-power-switch.rules | ||
+ | 70-printers.rules | ||
+ | 70-spice-vdagentd.rules | ||
+ | 70-touchpad.rules | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Il vous est possible d' | ||
+ | </ | ||
+ | |||
+ | Comme indique le nom de chaque fichier, le contenu est composé de règles à l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | # do not edit this file, it will be overwritten on update | ||
+ | |||
+ | # run a command on remove events | ||
+ | ACTION==" | ||
+ | ACTION==" | ||
+ | |||
+ | SUBSYSTEM==" | ||
+ | |||
+ | # select " | ||
+ | SUBSYSTEM==" | ||
+ | SUBSYSTEM==" | ||
+ | |||
+ | SUBSYSTEM==" | ||
+ | ENV{MODALIAS}!="", | ||
+ | |||
+ | ACTION!=" | ||
+ | |||
+ | SUBSYSTEM==" | ||
+ | SUBSYSTEM==" | ||
+ | SUBSYSTEM==" | ||
+ | SUBSYSTEM==" | ||
+ | SUBSYSTEM==" | ||
+ | SUBSYSTEM==" | ||
+ | SUBSYSTEM==" | ||
+ | KERNEL==" | ||
+ | |||
+ | SUBSYSTEM==" | ||
+ | |||
+ | SUBSYSTEM==" | ||
+ | SUBSYSTEM==" | ||
+ | |||
+ | SUBSYSTEM==" | ||
+ | SUBSYSTEM==" | ||
+ | SUBSYSTEM==" | ||
+ | SUBSYSTEM==" | ||
+ | SUBSYSTEM==" | ||
+ | SUBSYSTEM==" | ||
+ | |||
+ | SUBSYSTEM==" | ||
+ | SUBSYSTEM==" | ||
+ | |||
+ | SUBSYSTEM==" | ||
+ | OPTIONS+=" | ||
+ | --More-- | ||
+ | </ | ||
+ | |||
+ | Chaque règle prend la forme suivante : | ||
+ | |||
+ | KEY, [KEY, ...] NAME [, SYMLINK] | ||
+ | |||
+ | Chaque KEY est un champ au format **type=valeur** qui doit correspondre à un périphérique unique. La valeur de type peut prendre plusieurs formes : | ||
+ | |||
+ | ^ Type ^ Description ^ Exemples ^ | ||
+ | | BUS | Type de bus | usb, scsi, ide | | ||
+ | | KERNEL | Le nom par défault du périphérique donné par le noyau | hda, ttyUSB0, lp0 | | ||
+ | | SUBSYSTEM | Le nom noyau du sous-système, | ||
+ | | DRIVER | Le nom du pilote qui contrôle le périphérique | usb-storage | | ||
+ | | ID | Le numéro du périphérique sur son bus | PCI bus id, USB id | | ||
+ | | PLACE | Ne concerne que les périphériques USB et donne la position topologique du périphérique sur son bus | S/O | | ||
+ | | SYSFS{filename} | Le nom du fichier dans /sys pour le périphérique. Ce fichier contient le fabricant, le label, le numéro de série et UUID du périphérique. La vérification de jusqu' | ||
+ | | PROGRAM | Ceci permet à Udev d' | ||
+ | | RESULT | Valeur à comparer au résultat de PROGRAM | S/O | | ||
+ | |||
+ | NAME et SYMLINK sont utilisées pour stipuler ce que Udev doit faire avec le périphérique : | ||
+ | |||
+ | ^ Type ^ Description ^ Exemples ^ | ||
+ | | NAME | Le nome du nœud dans /dev | S/O | | ||
+ | | SYMLINK | Le ou les lien(s) symbolique(s) qui pointe(nt) vers le NAME | S/O | | ||
+ | |||
+ | ====La commande udevadm==== | ||
+ | |||
+ | Pour obtenir de l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# udevadm info --query=all -n /dev/sda | ||
+ | P: / | ||
+ | N: sda | ||
+ | S: disk/ | ||
+ | S: disk/ | ||
+ | S: disk/ | ||
+ | S: disk/ | ||
+ | S: disk/ | ||
+ | E: DEVLINKS=/ | ||
+ | E: DEVNAME=/ | ||
+ | E: DEVPATH=/ | ||
+ | E: DEVTYPE=disk | ||
+ | E: ID_ATA=1 | ||
+ | E: ID_ATA_FEATURE_SET_SMART=1 | ||
+ | E: ID_ATA_FEATURE_SET_SMART_ENABLED=1 | ||
+ | E: ID_ATA_SATA=1 | ||
+ | E: ID_ATA_WRITE_CACHE=1 | ||
+ | E: ID_ATA_WRITE_CACHE_ENABLED=1 | ||
+ | E: ID_BUS=ata | ||
+ | E: ID_MODEL=QEMU_HARDDISK | ||
+ | E: ID_MODEL_ENC=QEMU\x20HARDDISK\x20\x20\x20 | ||
+ | E: ID_PART_TABLE_TYPE=dos | ||
+ | E: ID_PART_TABLE_UUID=b39ec5c8 | ||
+ | E: ID_PATH=pci-0000: | ||
+ | E: ID_PATH_TAG=pci-0000_00_07_0-ata-1 | ||
+ | E: ID_REVISION=2.5+ | ||
+ | E: ID_SCSI=1 | ||
+ | E: ID_SCSI_INQUIRY=1 | ||
+ | E: ID_SERIAL=QEMU_HARDDISK_QM00005 | ||
+ | E: ID_SERIAL_SHORT=QM00005 | ||
+ | E: ID_TYPE=disk | ||
+ | E: ID_VENDOR=ATA | ||
+ | E: ID_VENDOR_ENC=ATA\x20\x20\x20\x20\x20 | ||
+ | E: MAJOR=8 | ||
+ | E: MINOR=0 | ||
+ | E: SCSI_IDENT_LUN_ATA=QEMU_HARDDISK_QM00005 | ||
+ | E: SCSI_IDENT_LUN_T10=ATA_QEMU_HARDDISK_QM00005 | ||
+ | E: SCSI_IDENT_LUN_VENDOR=QM00005 | ||
+ | E: SCSI_IDENT_SERIAL=QM00005 | ||
+ | E: SCSI_MODEL=QEMU_HARDDISK | ||
+ | E: SCSI_MODEL_ENC=QEMU\x20HARDDISK\x20\x20\x20 | ||
+ | E: SCSI_REVISION=2.5+ | ||
+ | E: SCSI_TPGS=0 | ||
+ | E: SCSI_TYPE=disk | ||
+ | E: SCSI_VENDOR=ATA | ||
+ | E: SCSI_VENDOR_ENC=ATA\x20\x20\x20\x20\x20 | ||
+ | E: SUBSYSTEM=block | ||
+ | E: TAGS=: | ||
+ | E: USEC_INITIALIZED=8735808 | ||
+ | </ | ||
+ | |||
+ | ===Les options de la commande=== | ||
+ | |||
+ | Les options de la commande udevadm sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# udevadm --help | ||
+ | udevadm [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS] | ||
+ | |||
+ | Send control commands or test the device manager. | ||
+ | |||
+ | Commands: | ||
+ | info Query sysfs or the udev database | ||
+ | trigger | ||
+ | settle | ||
+ | control | ||
+ | monitor | ||
+ | test Test an event run | ||
+ | test-builtin | ||
+ | |||
+ | [root@centos8 ~]# udevadm info --help | ||
+ | udevadm info [OPTIONS] [DEVPATH|FILE] | ||
+ | |||
+ | Query sysfs or the udev database. | ||
+ | |||
+ | -h --help | ||
+ | -V --version | ||
+ | -q --query=TYPE | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | -p --path=SYSPATH | ||
+ | -n --name=NAME | ||
+ | -r --root | ||
+ | -a --attribute-walk | ||
+ | of parent devices | ||
+ | -d --device-id-of-file=FILE Print major:minor of device containing this file | ||
+ | -x --export | ||
+ | -P --export-prefix | ||
+ | -e --export-db | ||
+ | -c --cleanup-db | ||
+ | </ | ||
+ | |||
+ | =====Système de fichiers /sys===== | ||
+ | |||
+ | Le système de fichiers virtuel **/sys** a été introduit avec le noyau Linux **2.6**. Son rôle est de décrire le matériel pour udev. | ||
+ | |||
+ | Saisissez la commande suivante : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ls -l /sys | ||
+ | total 0 | ||
+ | drwxr-xr-x. | ||
+ | drwxr-xr-x. | ||
+ | drwxr-xr-x. | ||
+ | drwxr-xr-x. | ||
+ | drwxr-xr-x. | ||
+ | drwxr-xr-x. | ||
+ | drwxr-xr-x. | ||
+ | drwxr-xr-x. | ||
+ | drwxr-xr-x. | ||
+ | drwxr-xr-x. 153 root root 0 Jul 12 08:15 module | ||
+ | drwxr-xr-x. | ||
+ | </ | ||
+ | |||
+ | Chaque répertoire contient des informations : | ||
+ | |||
+ | * **block** | ||
+ | * contient des informations sur les périphériques bloc | ||
+ | * **bus** | ||
+ | * contient des informations sur les bus de données | ||
+ | * **class** | ||
+ | * contient des informations sur des classes de matériel | ||
+ | * **devices** | ||
+ | * contient des informations sur la position des périphériques sur les bus | ||
+ | * **firmware** | ||
+ | * contient, entre autre, des informations sur l'ACPI | ||
+ | * **module** | ||
+ | * contient des informations sur les modules du noyau | ||
+ | * **power** | ||
+ | * contient des informations sur la gestion de l' | ||
+ | * **fs** | ||
+ | * contient des informations sur les systèmes de fichiers | ||
+ | |||
+ | Pour illustrer ceci, saisissez la commande suivante : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | 2097152 | ||
+ | </ | ||
+ | |||
+ | Ce chiffre correspond aux nombre de secteurs. | ||
+ | |||
+ | =====LAB #4 - Limitation des ressources===== | ||
+ | |||
+ | ====4.1 - ulimit==== | ||
+ | |||
+ | Les ressources disponibles aux utilisateurs peuvent être limitées par l' | ||
+ | |||
+ | La commande **ulimit** gère deux types de limite, la limite //hard// en utilisant l' | ||
+ | |||
+ | La limite //soft// est la limite imposée à l' | ||
+ | |||
+ | L' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | # / | ||
+ | # | ||
+ | #This file sets the resource limits for the users logged in via PAM. | ||
+ | #It does not affect resource limits of the system services. | ||
+ | # | ||
+ | #Also note that configuration files in / | ||
+ | #which are read in alphabetical order, override the settings in this | ||
+ | #file in case the domain is the same or more specific. | ||
+ | #That means for example that setting a limit for wildcard domain here | ||
+ | #can be overriden with a wildcard setting in a config file in the | ||
+ | # | ||
+ | #with a user specific setting in the subdirectory. | ||
+ | # | ||
+ | #Each line describes a limit for a user in the form: | ||
+ | # | ||
+ | #< | ||
+ | # | ||
+ | #Where: | ||
+ | #< | ||
+ | # - a user name | ||
+ | # - a group name, with @group syntax | ||
+ | # - the wildcard *, for default entry | ||
+ | # - the wildcard %, can be also used with %group syntax, | ||
+ | # for maxlogin limit | ||
+ | # | ||
+ | #< | ||
+ | # - " | ||
+ | # - " | ||
+ | # | ||
+ | #< | ||
+ | # - core - limits the core file size (KB) | ||
+ | # - data - max data size (KB) | ||
+ | # - fsize - maximum filesize (KB) | ||
+ | # - memlock - max locked-in-memory address space (KB) | ||
+ | # - nofile - max number of open file descriptors | ||
+ | # - rss - max resident set size (KB) | ||
+ | # - stack - max stack size (KB) | ||
+ | # - cpu - max CPU time (MIN) | ||
+ | # - nproc - max number of processes | ||
+ | # - as - address space limit (KB) | ||
+ | # - maxlogins - max number of logins for this user | ||
+ | # - maxsyslogins - max number of logins on the system | ||
+ | # - priority - the priority to run user process with | ||
+ | # - locks - max number of file locks the user can hold | ||
+ | # - sigpending - max number of pending signals | ||
+ | # - msgqueue - max memory used by POSIX message queues (bytes) | ||
+ | # - nice - max nice priority allowed to raise to values: [-20, 19] | ||
+ | # - rtprio - max realtime priority | ||
+ | # | ||
+ | #< | ||
+ | # | ||
+ | |||
+ | #* | ||
+ | #* | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | #ftp | ||
+ | # | ||
+ | |||
+ | # End of file | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : La valeur de la limite peut être un **nombre** ou le mot **unlimited**. | ||
+ | </ | ||
+ | |||
+ | Par exemple, si root inscrit les deux ligne suivantes dans le fichier / | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | trainee | ||
+ | trainee | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | la limite du nombre de fichiers ouverts simultanément par trainee est de 1 024. Par contre, trainee a la possibilité d' | ||
+ | |||
+ | < | ||
+ | $ ulimit -n 4096 | ||
+ | </ | ||
+ | |||
+ | Pour consulter la liste des limites actuelles, il convient d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ulimit -a | ||
+ | core file size (blocks, -c) unlimited | ||
+ | data seg size | ||
+ | scheduling priority | ||
+ | file size | ||
+ | pending signals | ||
+ | max locked memory | ||
+ | max memory size | ||
+ | open files (-n) 1024 | ||
+ | pipe size (512 bytes, -p) 8 | ||
+ | POSIX message queues | ||
+ | real-time priority | ||
+ | stack size (kbytes, -s) 8192 | ||
+ | cpu time | ||
+ | max user processes | ||
+ | virtual memory | ||
+ | file locks (-x) unlimited | ||
+ | </ | ||
+ | |||
+ | ====Options de la commande==== | ||
+ | |||
+ | Les options de **ulimit** sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# help ulimit | ||
+ | ulimit: ulimit [-SHabcdefiklmnpqrstuvxPT] [limit] | ||
+ | Modify shell resource limits. | ||
+ | | ||
+ | Provides control over the resources available to the shell and processes | ||
+ | it creates, on systems that allow such control. | ||
+ | | ||
+ | Options: | ||
+ | -S use the `soft' resource limit | ||
+ | -H use the `hard' resource limit | ||
+ | -a all current limits are reported | ||
+ | -b the socket buffer size | ||
+ | -c the maximum size of core files created | ||
+ | -d the maximum size of a process' | ||
+ | -e the maximum scheduling priority (`nice' | ||
+ | -f the maximum size of files written by the shell and its children | ||
+ | -i the maximum number of pending signals | ||
+ | -k the maximum number of kqueues allocated for this process | ||
+ | -l the maximum size a process may lock into memory | ||
+ | -m the maximum resident set size | ||
+ | -n the maximum number of open file descriptors | ||
+ | -p the pipe buffer size | ||
+ | -q the maximum number of bytes in POSIX message queues | ||
+ | -r the maximum real-time scheduling priority | ||
+ | -s the maximum stack size | ||
+ | -t the maximum amount of cpu time in seconds | ||
+ | -u the maximum number of user processes | ||
+ | -v the size of virtual memory | ||
+ | -x the maximum number of file locks | ||
+ | -P the maximum number of pseudoterminals | ||
+ | -T the maximum number of threads | ||
+ | | ||
+ | Not all options are available on all platforms. | ||
+ | | ||
+ | If LIMIT is given, it is the new value of the specified resource; the | ||
+ | special LIMIT values `soft', | ||
+ | current soft limit, the current hard limit, and no limit, respectively. | ||
+ | Otherwise, the current value of the specified resource is printed. | ||
+ | no option is given, then -f is assumed. | ||
+ | | ||
+ | Values are in 1024-byte increments, except for -t, which is in seconds, | ||
+ | -p, which is in increments of 512 bytes, and -u, which is an unscaled | ||
+ | number of processes. | ||
+ | | ||
+ | Exit Status: | ||
+ | Returns success unless an invalid option is supplied or an error occurs. | ||
+ | </ | ||
+ | |||
+ | ====4.2 - Groupes de Contrôle==== | ||
+ | |||
+ | Les **Groupes de Contrôles** (//Control Groups//) aussi appelés **CGroups**, | ||
+ | |||
+ | Les groupes de contrôle sont organisés de manière hiérarchique, | ||
+ | |||
+ | Ces hiérarchies multiples et séparés sont necéssaires parce que chaque hiérarchie est attaché à un ou plusieurs **sous-système(s)** aussi appelés des **Contrôleurs de Ressources** ou simplement des **Contrôleurs**. Les contrôleurs disponibles sous RHEl/CentOS 7 sont : | ||
+ | |||
+ | * **blkio** - utilisé pour établir des limites sur l' | ||
+ | * **cpu** - utilisé pour fournir aux tâches des groupes de contrôle accès au CPU grâce au planificateur, | ||
+ | * **cpuacct** - utilisé pour produire des rapports automatiques sur les ressources CPU utilisées par les tâches dans un groupe de contrôle, | ||
+ | * **cpuset** - utilisé pour assigner des CPU individuels sur un système multicoeur et des noeuds de mémoire à des tâches dans un groupe de contrôle, | ||
+ | * **devices** - utilisé pour autoriser ou pour refuser l' | ||
+ | * **freezer** - utilisé pour suspendre ou pour réactiver les tâches dans un groupe de contrôle, | ||
+ | * **memory** - utilisé pour établir les limites d' | ||
+ | * **net_cls** - utilisé pour repèrer les paquets réseau avec un identifiant de classe (// | ||
+ | * **perf_event** | ||
+ | * **hugetlb** - utilisé pour limiter des ressources sur des pages de mémoire virtuelle de grande taille. | ||
+ | |||
+ | Pour visualiser les hiérarchies, | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lssubsys -am | ||
+ | bash: lssubsys: command not found... | ||
+ | Install package ' | ||
+ | |||
+ | |||
+ | * Waiting in queue... | ||
+ | The following packages have to be installed: | ||
+ | | ||
+ | | ||
+ | Proceed with changes? [N/y] y | ||
+ | |||
+ | |||
+ | * Waiting in queue... | ||
+ | * Waiting for authentication... | ||
+ | * Waiting in queue... | ||
+ | * Downloading packages... | ||
+ | * Requesting data... | ||
+ | * Testing changes... | ||
+ | * Installing packages... | ||
+ | cpuset / | ||
+ | cpu,cpuacct / | ||
+ | blkio / | ||
+ | memory / | ||
+ | devices / | ||
+ | freezer / | ||
+ | net_cls, | ||
+ | perf_event / | ||
+ | hugetlb / | ||
+ | pids / | ||
+ | rdma / | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lssubsys -am | ||
+ | cpuset / | ||
+ | cpu,cpuacct / | ||
+ | blkio / | ||
+ | memory / | ||
+ | devices / | ||
+ | freezer / | ||
+ | net_cls, | ||
+ | perf_event / | ||
+ | hugetlb / | ||
+ | pids / | ||
+ | rdma / | ||
+ | </ | ||
+ | |||
+ | Sous RHEL/CentOS 8, **Systemd** organise les processus dans chaque CGroup. Par exemple tous les processus démarrés par le serveur Apache se trouveront dans le même CGroup, y compris les scripts CGI. Ceci implique que la gestion des ressources en utilisant des hiérarchies est couplé avec l' | ||
+ | |||
+ | En haut de l' | ||
+ | |||
+ | * le **system.slice** - l' | ||
+ | * le **user.slice** - l' | ||
+ | * le **machine.slice** - l' | ||
+ | |||
+ | En dessous des tranches peuvent se trouver : | ||
+ | |||
+ | * des **scopes** - des processus crées par **fork**, | ||
+ | * des **services** - des processus créés par une **Unité**. | ||
+ | |||
+ | Les slices peuvent être visualisés avec la commande suivante : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# systemctl list-units --type=slice | ||
+ | UNIT LOAD | ||
+ | -.slice | ||
+ | machine.slice | ||
+ | system-getty.slice | ||
+ | system-lvm2\x2dpvscan.slice | ||
+ | system-sshd\x2dkeygen.slice | ||
+ | system-systemd\x2dfsck.slice | ||
+ | system-systemd\x2dhibernate\x2dresume.slice loaded active active system-systemd\x2dhibernate\x2dresume.slice | ||
+ | system-user\x2druntime\x2ddir.slice | ||
+ | system-vncserver.slice | ||
+ | system.slice | ||
+ | user-1000.slice | ||
+ | user-42.slice | ||
+ | user.slice | ||
+ | |||
+ | LOAD = Reflects whether the unit definition was properly loaded. | ||
+ | ACTIVE = The high-level unit activation state, i.e. generalization of SUB. | ||
+ | SUB = The low-level unit activation state, values depend on unit type. | ||
+ | |||
+ | 13 loaded units listed. Pass --all to see loaded but inactive units, too. | ||
+ | To show all installed unit files use ' | ||
+ | </ | ||
+ | |||
+ | L' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# systemd-cgls | ||
+ | Control group /: | ||
+ | -.slice | ||
+ | ├─user.slice | ||
+ | │ ├─user-42.slice | ||
+ | │ │ ├─session-c1.scope | ||
+ | │ │ │ ├─1317 gdm-session-worker [pam/ | ||
+ | │ │ │ ├─1459 / | ||
+ | │ │ │ ├─1856 / | ||
+ | │ │ │ ├─1882 / | ||
+ | │ │ │ ├─2059 / | ||
+ | │ │ │ ├─2132 ibus-daemon --xim --panel disable | ||
+ | │ │ │ ├─2135 / | ||
+ | │ │ │ ├─2138 / | ||
+ | │ │ │ ├─2251 / | ||
+ | │ │ │ ├─2261 / | ||
+ | │ │ │ ├─2268 / | ||
+ | │ │ │ ├─2271 / | ||
+ | │ │ │ ├─2272 / | ||
+ | │ │ │ ├─2273 / | ||
+ | │ │ │ ├─2274 / | ||
+ | │ │ │ ├─2275 / | ||
+ | │ │ │ ├─2280 / | ||
+ | │ │ │ ├─2281 / | ||
+ | │ │ │ ├─2283 / | ||
+ | │ │ │ ├─2284 / | ||
+ | │ │ │ ├─2285 / | ||
+ | │ │ │ ├─2290 / | ||
+ | │ │ │ ├─2321 / | ||
+ | │ │ │ ├─2328 / | ||
+ | │ │ │ ├─2333 / | ||
+ | │ │ │ └─2432 / | ||
+ | │ │ └─user@42.service | ||
+ | │ │ | ||
+ | │ │ │ └─2170 / | ||
+ | │ │ | ||
+ | │ │ │ └─1455 / | ||
+ | │ │ | ||
+ | │ │ │ ├─1357 / | ||
+ | │ │ │ └─1377 (sd-pam) | ||
+ | │ │ | ||
+ | │ │ │ ├─2090 / | ||
+ | │ │ │ ├─2095 / | ||
+ | │ │ │ └─2098 / | ||
+ | │ │ | ||
+ | │ │ | ||
+ | │ │ | ||
+ | │ └─user-1000.slice | ||
+ | │ | ||
+ | │ │ ├─gvfs-goa-volume-monitor.service | ||
+ | │ │ │ └─2369 / | ||
+ | │ │ ├─xdg-permission-store.service | ||
+ | │ │ │ └─2191 / | ||
+ | │ │ ├─tracker-store.service | ||
+ | │ │ │ └─2653 / | ||
+ | │ │ ├─evolution-calendar-factory.service | ||
+ | │ │ │ ├─2605 / | ||
+ | │ │ │ └─2706 / | ||
+ | │ │ ├─pulseaudio.service | ||
+ | │ │ │ └─1456 / | ||
+ | │ │ ├─gvfs-daemon.service | ||
+ | │ │ │ ├─1896 / | ||
+ | │ │ │ └─1901 / | ||
+ | │ │ ├─evolution-source-registry.service | ||
+ | │ │ │ └─2206 / | ||
+ | │ │ ├─gvfs-udisks2-volume-monitor.service | ||
+ | │ │ │ └─2243 / | ||
+ | │ │ ├─init.scope | ||
+ | │ │ │ ├─1239 / | ||
+ | │ │ │ └─1318 (sd-pam) | ||
+ | │ │ ├─gvfs-gphoto2-volume-monitor.service | ||
+ | │ │ │ └─2269 / | ||
+ | │ │ ├─at-spi-dbus-bus.service | ||
+ | │ │ │ ├─1964 / | ||
+ | │ │ │ ├─1969 / | ||
+ | │ │ │ └─1972 / | ||
+ | │ │ ├─dbus.service | ||
+ | │ │ │ ├─1786 / | ||
+ | │ │ │ ├─2183 / | ||
+ | │ │ │ ├─2201 / | ||
+ | │ │ │ ├─2225 / | ||
+ | │ │ │ ├─2397 / | ||
+ | │ │ │ └─2721 / | ||
+ | │ │ ├─evolution-addressbook-factory.service | ||
+ | │ │ │ ├─2727 / | ||
+ | │ │ │ └─2771 / | ||
+ | │ │ ├─gvfs-mtp-volume-monitor.service | ||
+ | lines 44-86 | ||
+ | </ | ||
+ | |||
+ | En utilisant Systemd, plusieurs ressources peuvent être limitées : | ||
+ | |||
+ | * **CPUShares** - par défault 1024, | ||
+ | * **MemoryLimit** - limite exprimée en Mo ou en Go. Pas de valeur par défaut, | ||
+ | * **BlockIOWeight** - valeur entre 10 et 1000. Pas de valeur par défaut, | ||
+ | * **StartupCPUShares** - comme CPUShares mais uniquement appliqué pendant le démarrage, | ||
+ | * **StartupBlockIOWeight** - comme BlockIOWeight mais uniquement appliqué pendant le démarrage, | ||
+ | * **CPUQuota** - utilisé pour limiter le temps CPU, même quand le système ne fait rien. | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Consultez le manuel systemd.resource-control(5) pour voir les paramètres CGroup qui peuvent être passés à systemctl. | ||
+ | </ | ||
+ | |||
+ | ===Limitation de la Mémoire=== | ||
+ | |||
+ | Commencez par créer le script **hello-world.sh** qui servira à générer un processus pour travailler avec les CGroups : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# vi hello-world.sh | ||
+ | [root@centos8 ~]# cat hello-world.sh | ||
+ | #!/bin/bash | ||
+ | while [ 1 ]; do | ||
+ | echo "hello world" | ||
+ | sleep 360 | ||
+ | done | ||
+ | </ | ||
+ | |||
+ | Rendez le script exécutable et testez-le : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# chmod u+x hello-world.sh | ||
+ | [root@centos8 ~]# ./ | ||
+ | hello world | ||
+ | ^C | ||
+ | </ | ||
+ | |||
+ | Créez maintenant un CGroup dans le sous-système **memory** appelé **helloworld** : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mkdir / | ||
+ | </ | ||
+ | |||
+ | Par défaut, ce CGroup héritera de l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# echo 40000000 > / | ||
+ | [root@centos8 ~]# cat / | ||
+ | 39997440 | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** - Notez que les 40 000 000 demandés sont devenus 39 997 440 ce qui correspond à un nombre entier de pages mémoire du noyau de 4Ko. ( 39 997 440 / 4096 = 9 765 ). | ||
+ | </ | ||
+ | |||
+ | Lancez maintenant le script **helloworld.sh** : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ./ | ||
+ | [1] 35148 | ||
+ | |||
+ | [root@centos8 ~]# hello world | ||
+ | [Entrée] | ||
+ | |||
+ | [root@centos8 ~]# ps aux | grep hello-world | ||
+ | root | ||
+ | root | ||
+ | </ | ||
+ | |||
+ | Notez qu'il n'y a pas de limite de la mémoire, ce qui implique l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ps -ww -o cgroup 35148 | ||
+ | CGROUP | ||
+ | 12: | ||
+ | </ | ||
+ | |||
+ | Insérer le PID de notre script dans le CGroup **helloworld** : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# echo 35148 > / | ||
+ | </ | ||
+ | |||
+ | Notez maintenant l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ps -ww -o cgroup 35148 | ||
+ | CGROUP | ||
+ | 12: | ||
+ | </ | ||
+ | |||
+ | Constatez ensuite l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | 274432 | ||
+ | </ | ||
+ | |||
+ | Tuez le script **hello-world.sh** : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# kill 35148 | ||
+ | [root@centos8 ~]# ps aux | grep hello-world | ||
+ | root | ||
+ | [1]+ Terminated | ||
+ | </ | ||
+ | |||
+ | Créez un second CGroup beaucoup plus restrictif : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mkdir / | ||
+ | [root@centos8 ~]# echo 6000 > / | ||
+ | [root@centos8 ~]# cat / | ||
+ | 4096 | ||
+ | </ | ||
+ | |||
+ | Relancez le script **hello-world.sh** et insérez-le dans le nouveau CGroup : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ./ | ||
+ | [1] 35389 | ||
+ | |||
+ | [root@centos8 ~]# hello world | ||
+ | [Entrée] | ||
+ | |||
+ | [root@centos8 ~]# echo 35389 > / | ||
+ | </ | ||
+ | |||
+ | Attendez la prochaine sortie de **hello world** sur le canal standard puis constatez que le script s' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# hello world | ||
+ | [Entrée] | ||
+ | [1]+ Killed | ||
+ | </ | ||
+ | |||
+ | ===La Commande cgcreate=== | ||
+ | |||
+ | Cette commande permet la création d'un CGroup : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cgcreate -g memory: | ||
+ | [root@centos8 ~]# ls -l / | ||
+ | total 0 | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:39 cgroup.clone_children | ||
+ | --w--w----. 1 root root 0 Jul 13 10:39 cgroup.event_control | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:39 cgroup.procs | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.failcnt | ||
+ | --w--w----. 1 root root 0 Jul 13 10:39 memory.force_empty | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.kmem.failcnt | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.kmem.limit_in_bytes | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.kmem.max_usage_in_bytes | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:39 memory.kmem.slabinfo | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.kmem.tcp.failcnt | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.kmem.tcp.limit_in_bytes | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.kmem.tcp.max_usage_in_bytes | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:39 memory.kmem.tcp.usage_in_bytes | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:39 memory.kmem.usage_in_bytes | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.limit_in_bytes | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.max_usage_in_bytes | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.memsw.failcnt | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.memsw.limit_in_bytes | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.memsw.max_usage_in_bytes | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:39 memory.memsw.usage_in_bytes | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.move_charge_at_immigrate | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:39 memory.numa_stat | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.oom_control | ||
+ | ----------. 1 root root 0 Jul 13 10:39 memory.pressure_level | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.soft_limit_in_bytes | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:39 memory.stat | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.swappiness | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:39 memory.usage_in_bytes | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.use_hierarchy | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:39 notify_on_release | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:39 tasks | ||
+ | </ | ||
+ | |||
+ | Il n' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# echo 40000000 > / | ||
+ | </ | ||
+ | |||
+ | ==La Commande cgexec== | ||
+ | |||
+ | Cette commande permet d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cgexec -g memory: | ||
+ | [1] 37670 | ||
+ | |||
+ | [root@centos8 ~]# hello world | ||
+ | [Entrée] | ||
+ | |||
+ | [root@centos8 ~]# | ||
+ | </ | ||
+ | |||
+ | ==La Commande cgdelete== | ||
+ | |||
+ | Une fois le script terminé, cette commande permet de supprimer le cgroup : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ps aux | grep *.sh | ||
+ | root | ||
+ | root | ||
+ | |||
+ | [root@centos8 ~]# kill 37670 | ||
+ | |||
+ | root@centos8 ~]# ps aux | grep *.sh | ||
+ | root | ||
+ | [1]+ Terminated | ||
+ | |||
+ | [root@centos8 ~]# cgdelete memory: | ||
+ | |||
+ | [root@centos8 ~]# ls -l / | ||
+ | ls: cannot access '/ | ||
+ | </ | ||
+ | |||
+ | ==Le Fichier / | ||
+ | |||
+ | Afin de les rendre persistants, | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# vi / | ||
+ | [root@centos8 ~]# cat / | ||
+ | # | ||
+ | # Copyright IBM Corporation. 2007 | ||
+ | # | ||
+ | # Authors: | ||
+ | # This program is free software; you can redistribute it and/or modify it | ||
+ | # under the terms of version 2.1 of the GNU Lesser General Public License | ||
+ | # as published by the Free Software Foundation. | ||
+ | # | ||
+ | # This program is distributed in the hope that it would be useful, but | ||
+ | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
+ | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
+ | # | ||
+ | # | ||
+ | # By default, we expect systemd mounts everything on boot, | ||
+ | # so there is not much to do. | ||
+ | # See man cgconfig.conf for further details, how to create groups | ||
+ | # on system boot using this file. | ||
+ | group helloworld2 { | ||
+ | cpu { | ||
+ | cpu.shares = 100; | ||
+ | } | ||
+ | memory { | ||
+ | memory.limit_in_bytes = 40000; | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** - Notez la création de **deux** limitations, | ||
+ | </ | ||
+ | |||
+ | Créez donc les deux CGroups concernés : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cgcreate -g memory: | ||
+ | [root@centos8 ~]# ls -l / | ||
+ | total 0 | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:46 cgroup.clone_children | ||
+ | --w--w----. 1 root root 0 Jul 13 10:46 cgroup.event_control | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:46 cgroup.procs | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.failcnt | ||
+ | --w--w----. 1 root root 0 Jul 13 10:46 memory.force_empty | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.kmem.failcnt | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.kmem.limit_in_bytes | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.kmem.max_usage_in_bytes | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:46 memory.kmem.slabinfo | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.kmem.tcp.failcnt | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.kmem.tcp.limit_in_bytes | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.kmem.tcp.max_usage_in_bytes | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:46 memory.kmem.tcp.usage_in_bytes | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:46 memory.kmem.usage_in_bytes | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.limit_in_bytes | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.max_usage_in_bytes | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.memsw.failcnt | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.memsw.limit_in_bytes | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.memsw.max_usage_in_bytes | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:46 memory.memsw.usage_in_bytes | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.move_charge_at_immigrate | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:46 memory.numa_stat | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.oom_control | ||
+ | ----------. 1 root root 0 Jul 13 10:46 memory.pressure_level | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.soft_limit_in_bytes | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:46 memory.stat | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.swappiness | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:46 memory.usage_in_bytes | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.use_hierarchy | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:46 notify_on_release | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:46 tasks | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cgcreate -g cpu: | ||
+ | [root@centos8 ~]# ls -l / | ||
+ | total 0 | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:47 cgroup.clone_children | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:47 cgroup.procs | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:47 cpuacct.stat | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:47 cpuacct.usage | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:47 cpuacct.usage_all | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:47 cpuacct.usage_percpu | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:47 cpuacct.usage_percpu_sys | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:47 cpuacct.usage_percpu_user | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:47 cpuacct.usage_sys | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:47 cpuacct.usage_user | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:47 cpu.cfs_period_us | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:47 cpu.cfs_quota_us | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:47 cpu.rt_period_us | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:47 cpu.rt_runtime_us | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:47 cpu.shares | ||
+ | -r--r--r--. 1 root root 0 Jul 13 10:47 cpu.stat | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:47 notify_on_release | ||
+ | -rw-rw-r--. 1 root root 0 Jul 13 10:47 tasks | ||
+ | </ | ||
+ | |||
+ | ==La Commande cgconfigparser== | ||
+ | |||
+ | Appliquez le contenu du fichier **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cgconfigparser -l / | ||
+ | [root@centos8 ~]# cat / | ||
+ | 36864 | ||
+ | [root@centos8 ~]# cat / | ||
+ | 100 | ||
+ | </ | ||
+ | |||
+ | ----- | ||
+ | Copyright © 2024 Hugh Norris. |