Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
elearning:workbooks:redhat:rh134:l102 [2024/09/26 13:29] – created adminelearning:workbooks:redhat:rh134:l102 [2024/10/24 12:56] (Version actuelle) admin
Ligne 5: Ligne 5:
 Dernière mise-à-jour : ~~LASTMOD~~ Dernière mise-à-jour : ~~LASTMOD~~
  
-======RH12411 - Gestion de la Journalisation======+======RH13403 - Gestion des Paramètres du matériel et les Ressources======
  
 =====Contenu du Module===== =====Contenu du Module=====
  
-  * **RH12411 - Gestion de la Journalisation** +  * **RH13403 - Gestion des Paramètres et les Ressources du Matériel** 
-    * Présentation +    * Contenu du Module 
-    * La Commande dmesg +    * Présentation des Fichiers Spéciaux  
-    * LAB #1 - Surveillance Sécuritaire +    * LAB #1 - Découvrir le Matériel 
-      * 1.1 - La Commande last +      * 1.1 - La Commande lspci 
-      * 1.2 - La Commande lastlog +      * 1.2 - La Commande lsusb 
-      * 1.3 - La Commande lastb +      * 1.3 - La Commande lsblk 
-      * 1.4 - Le Fichier /var/log/secure +      * 1.4 - La Commande lsscsi 
-      * 1.5 - Gestion des évènements audit +      * 1.5 - La Commande lscpu 
-        Le fichier /var/log/audit/audit.log +      1.6 - La Commande lshw 
-        auditd +      1.7 - La Commande dmidecode 
-        auditctl +      1.8 - La Commande smartctl 
-        audispd +      1.9 - Les Commandes accton et dump-acct 
-        * La consultation des événements audit +      1.10 - La Commande lastcomm 
-          * La Commande aureport +      1.11 - La Commande sa 
-          * La Commande ausearch +      1.12 - La Commande ac 
-    * Le fichier /var/log/messages +    * LAB #2 - Réglage de la performance du système 
-    * Applications +      * 2.1 - Présentation 
-    * LAB #2 - rsyslog +      * 2.2 - Le fichier /etc/tuned/tuned-main.conf 
-      * 2.1 - Priorités +      * 2.3 - Profils 
-      * 2.2 - Sous-systèmes applicatifs +    LAB #3 - La Commande sysctl 
-      * 2.3 - /etc/rsyslog.conf +      3.1 - Répertoire /proc 
-        Modules +        * Fichiers 
-        Directives Globales +          * Processeur 
-        * Règles +          * Interruptions système 
-          * Sous-système applicatif.Priorité +          * Canaux DMA 
-          * Sous-système applicatif!Priorité +          * Plages d'entrée/sortie 
-          * Sous-système applicatif=Priorité +          * Périphériques 
-          * L'utilisation du caractère spécial +          * Modules 
-          * n Sous-systèmes avec la même priorité +          * Statistiques de l'utilisation des disques 
-          * n Sélecteurs avec la même Action +          Partitions 
-    LAB #3 - La Commande logger +          * Espaces de pagination 
-    * LAB #4 - La Commande logrotate +          * Statistiques d'utilisation du processeur 
-    * LAB #5 - La Journalisation avec journald +          * Statistiques d'utilisation de la mémoire 
-      * 5.1 - Consultation des Journaux +          * Version du noyau 
-      * 5.2 - Consultation des Journaux d'une Application Spécifique +        * Répertoires 
-      * 5.3 - Consultation des Journaux depuis le Dernier Démarrage +          * ide/scsi 
-      * 5.4 - Consultation des Journaux d'une Priorité Spécifique +          * acpi 
-      * 5.5 - Consultation des Journaux d'une Plage de Dates ou d'Heures +          * bus 
-      * 5.Consultation des Journaux en Live +          * net 
-      * 5.Consultation des Journaux avec des Mots Clefs+          * sys 
 +      * 3.2 Utilisation de la Commande sysctl        
 +    * LAB #4 - Interprétation des informations dans /proc 
 +      * 4.1 - free 
 +      * 4.2 - uptime ou w  
 +      * 4.3 - iostat 
 +      * 4.4 - hdparm 
 +      * 4.5 - vmstat 
 +      * 4.6 - mpstat 
 +      * 4.7 - sar 
 +    * Modules usb 
 +    * udev 
 +      * La Commande udevadm 
 +    * Système de fichiers /sys 
 +    * LAB #5 - Limiter les Ressources 
 +      * 5.ulimit 
 +      * 5.Groupes de Contrôle
  
-=====Présentation=====+=====Présentation des Fichiers Spéciaux=====
  
-La majorité des journaux du système et des applications se trouve dans le répertoire **/var/log**.+Dans l'ordinateur les périphériques sont reliés à un **contrôleur** qui communique avec le processeur à l'aide d'un **bus**. Le contrôleur ainsi que les périphériques nécessitent des pilotes. Sous Linux, les pilotes sont généralement fournis sous la forme d'un **module**. Chaque périphérique est représenté par un **fichier spécial** dans le répertoire **/dev** et c'est dans ce fichier que le système trouve les informations nécessaires pour s'adresser au pilote.
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important** : Il est conseillé de déplacer le point de montage du répertoire **/var/log** sur une partition physique ou un volume logique à partDe cette façon, en cas de journalisation rapide trop bavarde la limite de la taille de ce répertoire est celle de la taille de la partition physique ou du volume logique. Si vous laissez ce répertoire dans la racine du système, il existe un risque à ce que les journaux grossissent si vite qu'ils occupent toute l'espace disque libre, créant ainsi un crash système.+**Important** : Les périphériques qui nécessitent à ce que l'ordinateur soit éteint afin des les brancher/débrancher sont appelés communément **Cold Plug Devices**. Les périphériques qui peuvent être brancher/débrancher à chaud sont appelés des **Hot Plug Devices**.
 </WRAP> </WRAP>
  
-=====La Commande /bin/dmesg===== +Consultez le contenu du répertoire /dev :
- +
-Cette commande retourne les messages du noyau (**//Kernel Ring Buffer//**) stockés dans le fichier **/var/log/dmesg** lors du dernier démarrage du système :+
  
 <code> <code>
-[root@centos8 ~]# dmesg | more +[root@redhat9 ~]# ls -l /dev | more 
-[    0.000000] Linux version 4.18.0-240.22.1.el8_3.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (G +total 0 
-CC)) #SMP Thu Apr 8 19:01:30 UTC 2021 +crw-r--r--1 root root     10, 235 Oct 22 11:01 autofs 
-[    0.000000] Command lineBOOT_IMAGE=(hd0,msdos1)/vmlinuz-4.18.0-240.22.1.el8_3.x86_64 root=UUID=4c0cc28c-0d59-45be-bd73-d292b80be33c ro cra +drwxr-xr-x2 root root         160 Oct 22 11:01 block 
-shkernel=auto resume=UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4 rhgb quiet +drwxr-xr-x2 root root          80 Oct 22 11:01 bsg 
-   0.000000] x86/fpuSupporting XSAVE feature 0x001: 'x87 floating point registers' +drwxr-xr-x. 3 root root          60 Oct 22 11:01 bus 
-[    0.000000] x86/fpu: Supporting XSAVE feature 0x002'SSE registers' +lrwxrwxrwx. 1 root root           Oct 22 11:01 cdrom -> sr0 
-   0.000000] x86/fpuSupporting XSAVE feature 0x004'AVX registers' +drwxr-xr-x2 root root        2980 Oct 22 11:02 char 
-   0.000000] x86/fpuxstate_offset[2] 576xstate_sizes[2] 256 +crw--w----. 1 root tty       5,   Oct 22 11:01 console 
-[    0.000000] x86/fpuEnabled xstate features 0x7, context size is 832 bytes, using 'standard' format+lrwxrwxrwx1 root root          11 Oct 22 11:01 core -> /proc/kcore 
-[    0.000000] BIOS-provided physical RAM map+drwxr-xr-x6 root root         120 Oct 22 11:01 cpu 
-[    0.000000] BIOS-e820[mem 0x0000000000000000-0x000000000009fbff] usable +crw-------. 1 root root     10, 124 Oct 22 11:01 cpu_dma_latency 
-[    0.000000] BIOS-e820[mem 0x000000000009fc00-0x000000000009ffff] reserved +drwxr-xr-xroot root         140 Oct 22 11:01 disk 
-[    0.000000] BIOS-e820[mem 0x00000000000f0000-0x00000000000fffff] reserved +brw-rw----. 1 root disk    253,   0 Oct 22 11:01 dm-0 
-[    0.000000] BIOS-e820[mem 0x0000000000100000-0x00000000dffeffff] usable +brw-rw----. 1 root disk    253,   1 Oct 22 11:01 dm-1 
-[    0.000000] BIOS-e820[mem 0x00000000dfff0000-0x00000000dfffffff] ACPI data +drwxr-xr-x2 root root          60 Oct 22 11:01 dma_heap 
-[    0.000000] BIOS-e820[mem 0x00000000fec00000-0x00000000fec00fff] reserved +drwxr-xr-x3 root root          80 Oct 22 11:01 dri 
-   0.000000] BIOS-e820[mem 0x00000000fee00000-0x00000000fee00fff] reserved +crw-rw----. 1 root video    29,   Oct 22 11:01 fb0 
-[    0.000000] BIOS-e820[mem 0x00000000fffc0000-0x00000000ffffffff] reserved +lrwxrwxrwx1 root root          13 Oct 22 11:01 fd -> /proc/self/fd 
-[    0.000000] BIOS-e820[mem 0x0000000100000000-0x000000011fffffff] usable +crw-rw-rw-. 1 root root      1,   7 Oct 22 11:01 full 
-   0.000000] NX (Execute Disable) protectionactive +crw-rw-rw-. 1 root root     10, 229 Oct 22 11:01 fuse 
-[    0.000000] SMBIOS 2.5 present. +crw-------. 1 root root    242,   Oct 22 11:01 hidraw0 
-[    0.000000] DMIinnotek GmbH VirtualBox/VirtualBoxBIOS VirtualBox 12/01/2006 +crw-------1 root root     10, 228 Oct 22 11:01 hpet 
-   0.000000] Hypervisor detectedKVM+drwxr-xr-x. root root           0 Oct 22 11:01 hugepages 
 +crw-------. 1 root root     10183 Oct 22 11:01 hwrng 
 +lrwxrwxrwx1 root root          12 Oct 22 11:01 initctl -> /run/initctl 
 +drwxr-xr-x4 root root         280 Oct 22 11:01 input 
 +crw-r--r--1 root root      1,  11 Oct 22 11:01 kmsg 
 +crw-rw-rw-. 1 root kvm      10, 232 Oct 22 11:01 kvm 
 +lrwxrwxrwx1 root root          28 Oct 22 11:01 log -> /run/systemd/journal/dev-log 
 +crw-rw----. 1 root disk     10, 237 Oct 22 11:01 loop-control 
 +crw-rw----. 1 root lp        6,   0 Oct 22 11:01 lp0 
 +crw-rw----. 1 root lp        6,   1 Oct 22 11:01 lp1 
 +crw-rw----1 root lp        6,   2 Oct 22 11:01 lp2 
 +crw-rw----. 1 root lp        6,   3 Oct 22 11:01 lp3 
 +drwxr-xr-x. 2 root root         100 Oct 22 11:01 mapper 
 +crw-------1 root root     10, 227 Oct 22 11:01 mcelog 
 +crw-r-----. 1 root kmem      1,   1 Oct 22 11:01 mem 
 +drwxrwxrwt. 2 root root          40 Oct 22 11:01 mqueue 
 +drwxr-xr-x. 2 root root          60 Oct 22 11:01 net 
 +crw-rw-rw-1 root root      1,   3 Oct 22 11:01 null 
 +crw-------. 1 root root     10, 144 Oct 22 11:01 nvram 
 +crw-r-----. 1 root kmem      1,   4 Oct 22 11:01 port 
 +crw-------. 1 root root    108,   Oct 22 11:01 ppp 
 +crw-rw-rw-. 1 root tty       5,   2 Oct 22 15:04 ptmx 
 +drwxr-xr-x. 2 root root           Oct 22 11:01 pts 
 +crw-rw-rw-1 root root      1,   8 Oct 22 11:01 random 
 +crw-rw-r--+ 1 root root     10, 242 Oct 22 11:02 rfkill 
 +drwxr-xr-x. 2 root root          80 Oct 22 11:01 rhel 
 +lrwxrwxrwx1 root root           4 Oct 22 11:01 rtc -> rtc0 
 +crw-------. 1 root root    250,   Oct 22 11:01 rtc0 
 +brw-rw----. 1 root disk      8,   Oct 22 11:01 sda 
 +brw-rw----1 root disk      8,   1 Oct 22 11:01 sda1 
 +brw-rw----1 root disk      8,   2 Oct 22 11:01 sda2 
 +crw-rw----. 1 root disk     21  0 Oct 22 11:01 sg0 
 +crw-rw----+ 1 root cdrom    21,   1 Oct 22 11:01 sg1
 --More-- --More--
 </code> </code>
  
-Les option de cette commande sont :+On peut noter dans la sortie de la commande que certains fichiers sont de type **bloc** (**b**), tandis que d'autre sont de type **caractère** (**c**). 
  
 <code> <code>
-[root@centos8 ~]# dmesg --help+[root@redhat9 ~]# ls -l /dev | grep sda1 
 +brw-rw----. 1 root disk      8,   1 Oct 22 11:01 sda1
  
-Usage: +[root@redhat9 ~]# ls -l /dev | grep tty0 
- dmesg [options]+crw--w----. 1 root tty       4,   0 Oct 22 11:02 tty0 
 +</code>
  
-Display or control the kernel ring buffer.+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'échange de données se fait octet par octet sans utiliser des tampons.
  
-Options: +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** :
- -C, --clear                 clear the kernel ring buffer +
- -c, --read-clear            read and clear all messages +
- -D, --console-off           disable printing messages to console +
- -E, --console-on            enable printing messages to console +
- -F, --file <file>           use the file instead of the kernel log buffer +
- -f, --facility <list>       restrict output to defined facilities +
- -H, --human                 human readable output +
- -k, --kernel                display kernel messages +
- -L, --color[=<when>       colorize messages (auto, always or never) +
-                               colors are enabled by default +
- -l, --level <list>          restrict output to defined levels +
- -n, --console-level <level> set level of messages printed to console +
- -P, --nopager               do not pipe output into a pager +
- -p, --force-prefix          force timestamp output on each line of multi-line messages +
- -r, --raw                   print the raw message buffer +
- -S, --syslog                force to use syslog(2) rather than /dev/kmsg +
- -s, --buffer-size <size>    buffer size to query the kernel ring buffer +
- -u, --userspace             display userspace messages +
- -w, --follow                wait for new messages +
- -x, --decode                decode facility and level to readable string +
- -d, --show-delta            show time delta between printed messages +
- -e, --reltime               show local time and time delta in readable format +
- -T, --ctime                 show human-readable timestamp (may be inaccurate!) +
- -t, --notime                don't show any timestamp with messages +
-     --time-format <format>  show timestamp using the given format: +
-                               [delta|reltime|ctime|notime|iso] +
-Suspending/resume will make ctime and iso timestamps inaccurate.+
  
- -h--help                  display this help +  * le **majeur** identifie le pilote du périphérique et donc son contrôleur
- -V, --version               display version+  * le **mineur** identifie le périphérique ou une particularité du périphérique telle une partition d'un disque.
  
-Supported log facilities: +=====LAB #1 Découvrir le Matériel=====
-    kern kernel messages +
-    user - random user-level messages +
-    mail - mail system +
-  daemon - system daemons +
-    auth - security/authorization messages +
-  syslog - messages generated internally by syslogd +
-     lpr - line printer subsystem +
-    news - network news subsystem+
  
-Supported log levels (priorities): +====1.1 La Commande lspci====
-   emerg system is unusable +
-   alert - action must be taken immediately +
-    crit - critical conditions +
-     err - error conditions +
-    warn - warning conditions +
-  notice - normal but significant condition +
-    info - informational +
-   debug - debug-level messages+
  
-For more details see dmesg(1).+Cette commande vous renseigne sur les adaptateurs reliés aux bus PCI, AGP et PCI express : 
 + 
 +<code> 
 +[root@redhat9 ~]# 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/Triton II] 
 +00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II] 
 +00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01) 
 +00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03) 
 +00:02.0 VGA compatible controller: Device 1234:1111 (rev 02) 
 +00:03.0 Unclassified device [00ff]: Red Hat, Inc. Virtio memory balloon 
 +00:05.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge 
 +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 
 +01:01.0 SCSI storage controller: Red Hat, IncVirtio SCSI
 </code> </code>
  
-=====LAB #1 Surveillance Sécuritaire=====+Pour obtenir de l'information sur un adaptateur spécifique, il convient d'utiliser la même commande avec l'option **-v** en spécifiant l'identifiant concerné :
  
-====1.La Commande last====+<code> 
 +[root@redhat9 ~]# lspci -v -s 00:03.
 +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 f000 [size=64] 
 +        Memory at fd600000 (64-bit, prefetchable) [size=16K] 
 +        Capabilities: [84] Vendor Specific Information: VirtIO: <unknown> 
 +        Capabilities: [70] Vendor Specific Information: VirtIO: Notify 
 +        Capabilities: [60] Vendor Specific Information: VirtIO: DeviceCfg 
 +        Capabilities: [50] Vendor Specific Information: VirtIO: ISR 
 +        Capabilities: [40] Vendor Specific Information: VirtIO: CommonCfg 
 +        Kernel driver in use: virtio-pci 
 +</code>
  
-Cette commande indique les dates et heures des connexions des utilisateurs à partir du contenu du fichier **/var/log/wtmp** :+ou :
  
 <code> <code>
-[root@centos8 ~]# last +[root@redhat9 ~]# lspci -vv -s 00:03.0 
-trainee  pts/0        10.0.2.2         Thu Jun  3 09:01   still logged in +00:03.0 Unclassified device [00ff]: Red Hat, IncVirtio memory balloon 
-reboot   system boot  4.18.0-240.22.1. Thu Jun  09:01   still running +        Subsystem: Red Hat, IncDevice 0005 
-trainee  pts/0        10.0.2.2         Wed Jun  2 12:07 crash  (20:54) +        Physical Slot: 
-trainee  pts/0        10.0.2.2         Wed Jun  2 11:16 12:06  (00:50) +        ControlI/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx
-reboot   system boot  4.18.0-240.22.1. Wed Jun  2 11:12   still running +        StatusCap+ 66MHz- UDF- FastB2BParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- 
-trainee  pts/0        10.0.2.2         Wed Jun  2 11:13 - 11:14  (00:01) +        Latency0 
-reboot   system boot  4.18.0-240.22.1. Wed Jun  2 11:10 11:14  (00:04+        Interruptpin A routed to IRQ 10 
-trainee  pts/0        10.0.2.2         Wed Jun  2 11:08 - 11:12  (00:04) +        Region 0: I/O ports at f000 [size=64] 
-reboot   system boot  4.18.0-240.22.1. Wed Jun  2 11:04 - 11:12  (00:07) +        Region 4: Memory at fd600000 (64-bit, prefetchable[size=16K] 
-trainee  pts/0        10.0.2.2         Wed Jun  2 06:40 - 11:06  (04:26) +        Capabilities[84] Vendor Specific InformationVirtIO<unknown> 
-trainee  pts/0        10.0.2.2         Wed Jun  2 06:39 - 06:39  (00:00) +                BAR=offset=00000000 size=00000000 
-reboot   system boot  4.18.0-240.22.1. Wed Jun  2 06:07 - 11:07  (04:59) +        Capabilities[70] Vendor Specific InformationVirtIONotify 
-trainee  pts/1        10.0.2.2         Wed May 26 16:51 crash (6+13:15) +                BAR=4 offset=00003000 size=00001000 multiplier=00000004 
-trainee  pts/0        10.0.2.2         Wed May 26 10:37 18:50  (08:13) +        Capabilities[60] Vendor Specific InformationVirtIODeviceCfg 
-trainee  pts/0        10.0.2.2         Wed May 26 08:48 10:36  (01:48) +                BAR=4 offset=00002000 size=00001000 
-trainee  tty1                          Wed May 26 08:47 - crash (6+21:19) +        Capabilities[50] Vendor Specific InformationVirtIOISR 
-reboot   system boot  4.18.0-240.22.1. Wed May 26 08:44 11:07 (7+02:22+                BAR=offset=00001000 size=00001000 
-trainee  pts/0        10.0.2.2         Wed Apr 21 07:23 19:14  (11:51) +        Capabilities[40] Vendor Specific InformationVirtIOCommonCfg 
-trainee  pts/0        10.0.2.2         Tue Apr 20 23:13 07:22  (08:08+                BAR=4 offset=00000000 size=00001000 
-trainee  pts/1                         Tue Apr 20 10:59 11:00  (00:00) +        Kernel driver in usevirtio-pci 
-trainee  pts/0        10.0.2.2         Tue Apr 20 09:59 23:13  (13:13) +</code> 
-trainee  pts/1        10.0.2.2         Tue Apr 20 04:10 04:29  (00:19+ 
-trainee  pts/0        10.0.2.2         Tue Apr 20 02:21 09:57  (07:36+===Options de la commande=== 
-trainee  tty1                          Tue Apr 20 02:17 crash (36+06:26+ 
-trainee  pts/0        10.0.2.2         Mon Apr 19 13:55 02:17  (12:22) +Les options de cette commande sont : 
-trainee  pts/0        10.0.2.2         Mon Apr 19 12:05 13:47  (01:42) + 
-reboot   system boot  4.18.0-240.22.1. Mon Apr 19 12:05 11:07 (43+23:01) +<code> 
-trainee  pts/0        10.0.2.2         Mon Apr 19 11:40 crash  (00:24+[root@redhat9 ~]# lspci --help 
-reboot   system boot  4.18.0-147.8.1.e Mon Apr 19 11:37 11:07 (43+23:29) +lspciinvalid option -- '-' 
-trainee  pts/0        10.0.2.2         Tue Sep  1 09:59 11:10  (01:10) +Usagelspci [<switches>
-reboot   system boot  4.18.0-147.8.1.e Tue Sep  1 09:58 - 11:10  (01:11) + 
-reboot   system boot  4.18.0-147.8.1.e Fri May  8 08:13 11:10 (116+02:56)+Basic display modes
 +-mm             Produce machine-readable output (single -m for an obsolete format
 +-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             Display bus path in addition to bus and device number 
 + 
 +Resolving of device ID's to names: 
 +-n              Show numeric ID's 
 +-nn             Show both textual and numeric ID'(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 [[[[<domain>]:]<bus>]:][<slot>][.[<func>]]   Show only devices in selected slots 
 +-d [<vendor>]:[<device>][:<class>             Show only devices with specified ID's 
 + 
 +Other options
 +-i <file>       Use specified ID database instead of /usr/share/hwdata/pci.ids 
 +-p <file>       Look up kernel modules in a given file instead of default modules.pcimap 
 +-M              Enable `bus mapping' mode (dangerous; root only)
  
-wtmp begins Fri May  8 08:13:49 2020+PCI access options: 
 +-A <method>     Use the specified PCI access method (see `-A help' for a list) 
 +-O <par>=<val>  Set PCI access parameter (see `-O help' for a list) 
 +-G              Enable PCI access debugging 
 +-H <mode>       Use direct hardware access (<mode> = 1 or 2) 
 +-F <file>       Read PCI configuration dump from a given file 
 </code> </code>
  
-Les option de cette commande sont :+====1.2 - La Commande lsusb==== 
 + 
 +Cette commande vous renseigne sur les adaptateurs reliés au bus usb : 
 + 
 +<code> 
 +[root@redhat9 ~]# lsusb 
 +Bus 001 Device 002: ID 0627:0001 Adomax Technology Co., Ltd QEMU USB Tablet 
 +Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub 
 + 
 +[root@redhat9 ~]# lsusb -vt 
 +/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M 
 +    ID 1d6b:0001 Linux Foundation 1.1 root hub 
 +    |__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M 
 +        ID 0627:0001 Adomax Technology Co., Ltd  
 +</code> 
 + 
 +===Options de la commande=== 
 + 
 +Les options de cette commande sont : 
 + 
 +<code> 
 +[root@redhat9 ~]# lsusb --help 
 +Usage: lsusb [options]... 
 +List USB devices 
 +  -v, --verbose 
 +      Increase verbosity (show descriptors) 
 +  -s [[bus]:][devnum] 
 +      Show only devices with specified device and/or 
 +      bus numbers (in decimal) 
 +  -d vendor:[product] 
 +      Show only devices with the specified vendor and 
 +      product ID numbers (in hexadecimal) 
 +  -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 
 +</code> 
 + 
 +====1.3 - La Commande lsblk==== 
 + 
 +Cette commande vous rensigne sur les partitions des disques : 
 + 
 +<code> 
 +[root@redhat9 ~]# lsblk 
 +NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS 
 +sda             8:   0   50G  0 disk  
 +├─sda1          8:1    0    1G  0 part /boot 
 +└─sda2          8:2    0   49G  0 part  
 +  ├─rhel-root 253:0    0   44G  0 lvm  / 
 +  └─rhel-swap 253:1    0    5G  0 lvm  [SWAP] 
 +sdb             8:16     32G  0 disk 
 +sdc             8:32      6G  0 disk   
 +sdd             8:48      6G  0 disk   
 +sde             8:64     32G  0 disk  
 +sr0            11:0    1 1024M  0 rom  
 +  
 +[root@redhat9 ~]# lsblk -l 
 +NAME      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS 
 +sda         8:   0   50G  0 disk  
 +sda1        8:1    0    1G  0 part /boot 
 +sda2        8:2    0   49G  0 part  
 +sr0        11:0    1 1024M  0 rom   
 +rhel-root 253:0    0   44G  0 lvm  / 
 +rhel-swap 253:1    0    5G  0 lvm  [SWAP] 
 +sdb         8:16     32G  0 disk 
 +sdc         8:32      6G  0 disk   
 +sdd         8:48      6G  0 disk   
 +sde         8:64     32G  0 disk  
 +</code> 
 + 
 +===Options de la commande=== 
 + 
 +Les options de cette commande sont :
  
 <code> <code>
-[root@centos8 ~]# last --help+[root@redhat9 ~]# lsblk --help
  
 Usage: Usage:
- last [options] [<username>...] [<tty>...]+ lsblk [options] [<device> ...]
  
-Show a listing of last logged in users.+List information about block devices.
  
 Options: Options:
- -<number           how many lines to show + -D, --discard        print discard capabilities 
- -a, --hostlast       display hostnames in the last column + -E, --dedup <column> de-duplicate output by <column> 
- -d, --dns            translate the IP number back into a hostname + -I, --include <list> show only devices with specified major numbers 
- -f, --file <file   use a specific file instead of /var/log/wtmp + -J, --json           use JSON output format 
- -F, --fulltimes      print full login and logout times and dates + -O, --output-all     output all columns 
- -i, --ip             display IP numbers in numbers-and-dots notation + -P, --pairs          use key="value" output format 
- -n, --limit <numberhow many lines to show + -S, --scsi           output info about SCSI devices 
- -R, --nohostname     don'display the hostname field + -T, --tree[=<column>use tree format output 
- -s, --since <time  display the lines since the specified time + -a, --all            print all devices 
- -t, --until <time>   display the lines until the specified time + -b, --bytes          print SIZE in bytes rather than in human readable format 
- -p, --present <timedisplay who were present at the specified time + -d, --nodeps         don't print slaves or holders 
- -w, --fullnames      display full user and domain names + -e, --exclude <listexclude devices by major number (default: RAM disks) 
- -x, --system         display system shutdown entries and run level changes + -f, --fs             output info about filesystems 
-     --time-format <format>  show timestamps in the specified <format>: + -i, --ascii          use ascii characters only 
-                               notime|short|full|iso+ -l, --list           use list format output 
 + -M, --merge          group parents of sub-trees (usable for RAIDs, Multi-path) 
 + -m, --perms          output info about permissions 
 + -n, --noheadings     don'print headings 
 + -o, --output <list output columns 
 + -p, --paths          print complete device path 
 + -r, --raw            use raw output format 
 + -s, --inverse        inverse dependencies 
 + -t, --topology       output info about topology 
 + -w, --width <num   specifies output width as number of characters 
 + -x, --sort <column>  sort output by <column> 
 + -z, --zoned          print zone model 
 +     --sysroot <dir>  use specified directory as system root
  
  -h, --help           display this help  -h, --help           display this help
  -V, --version        display version  -V, --version        display version
  
-For more details see last(1).+Available output columns: 
 +         NAME  device name 
 +        KNAME  internal kernel device name 
 +         PATH  path to the device node 
 +      MAJ:MIN  major:minor device number 
 +      FSAVAIL  filesystem size available 
 +       FSSIZE  filesystem size 
 +       FSTYPE  filesystem type 
 +       FSUSED  filesystem size used 
 +       FSUSE%  filesystem use percentage 
 +      FSROOTS  mounted filesystem roots 
 +        FSVER  filesystem version 
 +   MOUNTPOINT  where the device is mounted 
 +  MOUNTPOINTS  all locations where device is mounted 
 +        LABEL  filesystem LABEL 
 +         UUID  filesystem UUID 
 +       PTUUID  partition table identifier (usually UUID) 
 +       PTTYPE  partition table type 
 +     PARTTYPE  partition type code or UUID 
 + PARTTYPENAME  partition type name 
 +    PARTLABEL  partition LABEL 
 +     PARTUUID  partition UUID 
 +    PARTFLAGS  partition flags 
 +           RA  read-ahead of the device 
 +           RO  read-only device 
 +           RM  removable device 
 +      HOTPLUG  removable or hotplug device (usb, pcmcia, ...) 
 +        MODEL  device identifier 
 +       SERIAL  disk serial number 
 +         SIZE  size of the device 
 +        STATE  state of the device 
 +        OWNER  user name 
 +        GROUP  group name 
 +         MODE  device node permissions 
 +    ALIGNMENT  alignment offset 
 +       MIN-IO  minimum I/O size 
 +       OPT-IO  optimal I/O size 
 +      PHY-SEC  physical sector size 
 +      LOG-SEC  logical sector size 
 +         ROTA  rotational device 
 +        SCHED  I/O scheduler name 
 +      RQ-SIZE  request queue size 
 +         TYPE  device type 
 +     DISC-ALN  discard alignment offset 
 +    DISC-GRAN  discard granularity 
 +     DISC-MAX  discard max bytes 
 +    DISC-ZERO  discard zeroes data 
 +        WSAME  write same max bytes 
 +          WWN  unique storage identifier 
 +         RAND  adds randomness 
 +       PKNAME  internal parent kernel device name 
 +         HCTL  Host:Channel:Target:Lun for SCSI 
 +         TRAN  device transport type 
 +   SUBSYSTEMS  de-duplicated chain of subsystems 
 +          REV  device revision 
 +       VENDOR  device vendor 
 +        ZONED  zone model 
 +          DAX  dax-capable device 
 + 
 +For more details see lsblk(8).
 </code> </code>
  
-====1.- La Commande lastlog====+====1.- La Commande lsscsi====
  
-Cette commande indique les dates et heures de la connexion au système la plus récente des utilisateurs :+Cette commmande vous renseigne sur les périphériques SCSI et NVMe :
  
 <code> <code>
-[root@centos8 ~]# lastlog +[root@redhat9 ~]# lsscsi 
-Username         Port     From             Latest +[0:0:0:0]    disk    QEMU     QEMU HARDDISK    2.5+  /dev/sda  
-root             pts/0                     Thu Jun  3 09:01:46 -0400 2021 +[2:0:0:0   cd/dvd  QEMU     QEMU DVD-ROM     2.5+  /dev/sr0  
-bin                                        **Never logged in** +[3:0:0:0]    disk    ATA      QEMU HARDDISK    2.5+  /dev/sdb
-daemon                                     **Never logged in** +
-adm                                        **Never logged in** +
-lp                                         **Never logged in** +
-sync                                       **Never logged in** +
-shutdown                                   **Never logged in** +
-halt                                       **Never logged in** +
-mail                                       **Never logged in** +
-operator                                   **Never logged in** +
-games                                      **Never logged in** +
-ftp                                        **Never logged in** +
-nobody                                     **Never logged in** +
-dbus                                       **Never logged in** +
-systemd-coredump                           **Never logged in** +
-systemd-resolve                            **Never logged in** +
-tss                                        **Never logged in** +
-polkitd                                    **Never logged in** +
-unbound                                    **Never logged in** +
-libstoragemgmt                             **Never logged in** +
-cockpit-ws                                 **Never logged in** +
-sssd                                       **Never logged in** +
-setroubleshoot                             **Never logged in** +
-sshd                                       **Never logged in** +
-chrony                                     **Never logged in** +
-tcpdump                                    **Never logged in** +
-trainee          pts/0    10.0.2.2         Thu Jun  09:01:39 -0400 2021 +
-cockpit-wsinstance                           **Never logged in** +
-rngd                                       **Never logged in** +
-gluster                                    **Never logged in** +
-qemu                                       **Never logged in** +
-rpc                                        **Never logged in** +
-rpcuser                                    **Never logged in** +
-saslauth                                   **Never logged in** +
-radvd                                      **Never logged in** +
-dnsmasq                                    **Never logged in** +
-fenestros2       pts/                    Tue Apr 20 15:20:26 -0400 2021 +
-fenestros1                                 **Never logged in** +
-apache                                     **Never logged in**+
 </code> </code>
  
-Les option de cette commande sont :+===Options de la commande=== 
 + 
 +Les options de cette commande sont :
  
 <code> <code>
-[root@centos8 ~]# lastlog --help +[root@redhat9 ~]# lsscsi --help 
-Usage: lastlog [options]+Usage: lsscsi   [--brief[--classic] [--controllers] [--device] [--generic] 
 +                [--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]  [<h:c:t:l>
 +  where: 
 +    --brief|-b        tuple and device name only 
 +    --classic|-c      alternate output similar to 'cat /proc/scsi/scsi' 
 +    --controllers|-C   synonym for --hosts since NVMe controllers treated 
 +                       like SCSI hosts 
 +    --device|-d       show device node's major + minor numbers 
 +    --generic|-g      show scsi generic device name 
 +    --help|-h         this usage information 
 +    --hosts|-H        lists scsi hosts rather than scsi devices 
 +    --kname|-k        show kernel name instead of device node name 
 +    --list|-L         additional information output one 
 +                      attribute=value per line 
 +    --long|-l         additional information output 
 +    --long-unit|-U    print LU name in full, use twice to prefix with 
 +                      '.naa', 'eui.', 'uuid.' or 't10.' 
 +    --lunhex|-x       show LUN part of tuple as hex number in T10 format; 
 +                      use twice to get full 16 digit hexadecimal LUN 
 +    --no-nvme|-N      exclude NVMe devices from output 
 +    --pdt|-D          show the peripheral device type in hex 
 +    --protection|-p   show target and initiator protection information 
 +    --protmode|-P     show negotiated protection information mode 
 +    --scsi_id|-i      show udev derived /dev/disk/by-id/scsi* entry 
 +    --size|-s         show disk size, (once for decimal (e.g. 3 GB), 
 +                      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       show size as a number of logical blocks; if used twice 
 +                      adds comma followed by logical block size in bytes 
 +    --transport|-t    transport information for target or, if '--hosts' 
 +                      given, for initiator 
 +    --unit|-u         logical unit (LU) name (aka WWN for ATA/SATA) 
 +    --verbose|-v      output path names where data is found 
 +    --version|-V      output version string and exit 
 +    --wwn|-w          output WWN for disks (from /dev/disk/by-id/wwn*) 
 +    <h:c:t:l>         filter output list (def: '*:*:*:*' (all)). Meaning: 
 +                      <host_num:controller:target:lun> or for NVMe: 
 +                      <'N':ctl_num:cntlid:namespace_id>
  
-Options: +List SCSI devices or hostsfollowed by NVMe namespaces or controllers. 
-  -b--before DAYS             print only lastlog records older than DAYS +Many storage devices (e.g. SATA disks and USB attached storageuse SCSI 
-  -C, --clear                   clear lastlog record of an user (usable only with -u+command sets and hence are also listed by this utility. Hyphenated long 
-  -h, --help                    display this help message and exit +options can also take underscore (and vice versa).
-  -R, --root CHROOT_DIR         directory to chroot into +
-  -S, --set                     set lastlog record to current time (usable only with -u) +
-  -t, --time DAYS               print only lastlog records more recent than DAYS +
-  -u, --user LOGIN              print lastlog record of the specified LOGIN+
 </code> </code>
  
-====1.- La Commande lastb====+====1.- La Commande lscpu====
  
-Cette commande indique les dates et heures des connexions infructueuses des utilisateurs à partir du contenu du fichier **/var/log/btmp** :+Cett commande vous renseigne sur l'architecture des CPUs :
  
 <code> <code>
-[root@centos8 ~]# lastb +[root@redhat9 ~]# lscpu 
-trainee  tty1                          Thu Jun  3 09:51 09:51  (00:00+Architecture:            x86_64 
-trainee  tty1                          Thu Jun  3 09:51 09:51  (00:00+  CPU op-mode(s)       32-bit, 64-bit 
-trqinee  tty1                          Thu Jun  09:51 09:51  (00:00+  Address sizes        46 bits physical, 48 bits virtual 
- +  Byte Order:            Little Endian 
-btmp begins Thu Jun  09:51:07 2021+CPU(s)                 4 
 +  On-line CPU(slist:   0-3 
 +Vendor ID:               GenuineIntel 
 +  BIOS Vendor ID:        QEMU 
 +  Model name           Intel(R) Xeon(R) CPU D-1541 @ 2.10GHz 
 +    BIOS Model name:     pc-i440fx-7.2 
 +    CPU family:          6 
 +    Model:               86 
 +    Thread(s) per core:  
 +    Core(s) per socket 2 
 +    Socket(s):           2 
 +    Stepping:            3 
 +    BogoMIPS           4199.99 
 +    Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cp 
 +                         uid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_f 
 +                         ault pti ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt arat vnmi umip md_clear arch_ 
 +                         capabilities 
 +Virtualization features:  
 +  Virtualization:        VT-
 +  Hypervisor vendor    KVM 
 +  Virtualization type:   full 
 +Caches (sum of all)     
 +  L1d:                   128 KiB (4 instances
 +  L1i:                   128 KiB (4 instances) 
 +  L2:                    16 MiB (4 instances) 
 +  L3:                    32 MiB (2 instances) 
 +NUMA:                     
 +  NUMA node(s):          1 
 +  NUMA node0 CPU(s):     0-3 
 +Vulnerabilities         
 +  Gather data sampling:  Not affected 
 +  Itlb multihit:         Not affected 
 +  L1tf:                  Mitigation; PTE Inversion; VMX flush not necessary, SMT disabled 
 +  Mds:                   Mitigation; Clear CPU buffers; SMT Host state unknown 
 +  Meltdown:              Mitigation; PTI 
 +  Mmio stale data:       Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown 
 +  Retbleed:              Not affected 
 +  Spec rstack overflow:  Not affected 
 +  Spec store bypass:     Mitigation; Speculative Store Bypass disabled via prctl 
 +  Spectre v1:            Mitigation; usercopy/swapgs barriers and __user pointer sanitization 
 +  Spectre v2:            Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP disabled, RSB filling, PBRSB-eIBRS Not affected 
 +  Srbds:                 Not affected 
 +  Tsx async abort      Mitigation; Clear CPU buffers; SMT Host state unknown
 </code> </code>
 +
 +===Options de la commande===
  
 Les options de cette commande sont : Les options de cette commande sont :
  
 <code> <code>
-[root@centos8 ~]# lastb --help+[root@redhat9 ~]# lscpu --help
  
 Usage: Usage:
- lastb [options] [<username>...] [<tty>...]+ lscpu [options]
  
-Show a listing of last logged in users.+Display information about the CPU architecture.
  
 Options: Options:
- -<number>            how many lines to show + -a, --all               print both online and offline CPUs (default for -e) 
- -a, --hostlast       display hostnames in the last column + -b, --online            print online CPUs only (default for -p) 
- -d, --dns            translate the IP number back into a hostname + -B, --bytes             print sizes in bytes rather than in human readable format 
- -f, --file <file>    use a specific file instead of /var/log/btmp + -C, --caches[=<list>  info about caches in extended readable format 
- -F, --fulltimes      print full login and logout times and dates + -c, --offline           print offline CPUs only 
- -i, --ip             display IP numbers in numbers-and-dots notation + -J, --json              use JSON for default or extended format 
- -n, --limit <number> how many lines to show + -e, --extended[=<list>] print out an extended readable format 
- -R, --nohostname     don't display the hostname field + -p, --parse[=<list>]    print out a parsable format 
- -s, --since <time  display the lines since the specified time + -s, --sysroot <dir    use specified directory as system root 
- -t, --until <time  display the lines until the specified time + -x, --hex               print hexadecimal masks rather than lists of CPUs 
- -p, --present <timedisplay who were present at the specified time + -y, --physical          print physical instead of logical IDs 
- -w, --fullnames      display full user and domain names +     --output-all        print all available columns for -e, -p or -C
- -x, --system         display system shutdown entries and run level changes +
-     --time-format <format>  show timestamps in the specified <format>: +
-                               notime|short|full|iso+
  
- -h, --help           display this help + -h, --help              display this help 
- -V, --version        display version+ -V, --version           display version 
 + 
 +Available output columns for -e or -p: 
 +      BOGOMIPS  crude measurement of CPU speed 
 +           CPU  logical CPU number 
 +          CORE  logical core number 
 +        SOCKET  logical socket number 
 +       CLUSTER  logical cluster number 
 +          NODE  logical NUMA node number 
 +          BOOK  logical book number 
 +        DRAWER  logical drawer number 
 +         CACHE  shows how caches are shared between CPUs 
 +  POLARIZATION  CPU dispatching mode on virtual hardware 
 +       ADDRESS  physical address of a CPU 
 +    CONFIGURED  shows if the hypervisor has allocated the CPU 
 +        ONLINE  shows if Linux currently makes use of the CPU 
 +           MHZ  shows the currently MHz of the CPU 
 +      SCALMHZ%  shows scaling percentage of the CPU frequency 
 +        MAXMHZ  shows the maximum MHz of the CPU 
 +        MINMHZ  shows the minimum MHz of the CPU 
 + 
 +Available output columns for -C: 
 +      ALL-SIZE  size of all system caches 
 +         LEVEL  cache level 
 +          NAME  cache name 
 +      ONE-SIZE  size of one cache 
 +          TYPE  cache type 
 +          WAYS  ways of associativity 
 +  ALLOC-POLICY  allocation policy 
 +  WRITE-POLICY  write policy 
 +      PHY-LINE  number of physical cache line per cache t 
 +          SETS  number of sets in the cache; set lines has the same cache index 
 + COHERENCY-SIZE  minimum amount of data in bytes transferred from memory to cache
  
-For more details see last(1).+For more details see lscpu(1).
 </code> </code>
  
-====1.Le Fichier /var/log/secure====+====1.La Command lshw====
  
-Sous RHEL/CentOS ce fichier contient la journalisation des opérations de gestion des authentifications :+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 :
  
 <code> <code>
-[root@centos8 ~]# tail -n 15 /var/log/secure +[root@redhat9 ~]# lshw -businfo 
-Jun  3 09:01:20 centos8 sshd[905]: Server listening on :: port 22. +Bus info          Device      Class      Description 
-Jun  3 09:01:39 centos8 sshd[1585]: Accepted password for trainee from 10.0.2.2 port 52734 ssh2 +==================================================== 
-Jun  3 09:01:39 centos8 systemd[1590]: pam_unix(systemd-user:session): session opened for user trainee by (uid=0+                              system     Standard PC (i440FX + PIIX, 1996) 
-Jun  3 09:01:39 centos8 sshd[1585]: pam_unix(sshd:session): session opened for user trainee by (uid=0+                              bus        Motherboard 
-Jun  3 09:01:46 centos8 su[1627]: pam_systemd(su-l:session): Cannot create session: Already running in a session or user slice +                              memory     96KiB BIOS 
-Jun  3 09:01:46 centos8 su[1627]: pam_unix(su-l:session): session opened for user root by trainee(uid=1000) +cpu@0                         processor  Intel(RXeon(RCPU D-1541 @ 2.10GHz 
-Jun  3 09:51:05 centos8 login[1158]: pam_unix(login:auth): check pass; user unknown +cpu@1                         processor  Intel(RXeon(RCPU D-1541 @ 2.10GHz 
-Jun  3 09:51:05 centos8 login[1158]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=euid=tty=tty1 ruser= rhost= +                              memory     8GiB System Memory 
-Jun  3 09:51:07 centos8 login[1158]: FAILED LOGIN FROM tty1 FOR trqinee, Authentication failure +                              memory     8GiB DIMM RAM 
-Jun  3 09:51:18 centos8 unix_chkpwd[2400]: password check failed for user (trainee) +pci@0000:00:00.0              bridge     440FX - 82441FX PMC [Natoma
-Jun  3 09:51:18 centos8 login[1158]pam_unix(login:auth): authentication failure; logname=LOGIN uid=euid=tty=tty1 ruser= rhost=  user=trainee +pci@0000:00:01.0              bridge     82371SB PIIX3 ISA [Natoma/Triton II] 
-Jun  3 09:51:20 centos8 login[1158]FAILED LOGIN FROM tty1 FOR trainee, Authentication failure +                              input      PnP device PNP0303 
-Jun  3 09:51:45 centos8 login[1158]pam_unix(login:auth)check pass; user unknown +                              input      PnP device PNP0f13 
-Jun  3 09:51:45 centos8 login[1158]pam_unix(login:auth): authentication failure; logname=LOGIN uid=euid=0 tty=tty1 ruser= rhost= +                              storage    PnP device PNP0700 
-Jun  3 09:51:47 centos8 login[1158]: FAILED LOGIN SESSION FROM tty1 FOR trainee  , Authentication failure+                              system     PnP device PNP0b00 
 +pci@0000:00:01.1  scsi2       storage    82371SB PIIX3 IDE [Natoma/Triton II
 +scsi@2:0.0.     /dev/cdrom  disk       QEMU DVD-ROM 
 +pci@0000:00:01.2              bus        82371SB PIIX3 USB [Natoma/Triton II] 
 +usb@1             usb1        bus        UHCI Host Controller 
 +usb@1:1           input5      input      QEMU QEMU USB Tablet 
 +pci@0000:00:01.3              bridge     82371AB/EB/MB PIIX4 ACPI 
 +pci@0000:00:02.0  /dev/fb0    display    bochs-drmdrmfb 
 +pci@0000:00:03.             generic    Virtio memory balloon 
 +virtio@                     generic    Virtual I/O device 
 +pci@0000:00:05.0              bridge     QEMU PCI-PCI bridge 
 +pci@0000:01:01.0              storage    Virtio SCSI 
 +virtio@         scsi0       generic    Virtual I/O device 
 +scsi@0:0.0.0      /dev/sda    disk       53GB QEMU HARDDISK 
 +scsi@0:0.0.0,   /dev/sda1   volume     1GiB Linux filesystem partition 
 +scsi@0:0.0.0,   /dev/sda2   volume     48GiB Linux LVM Physical Volume partition 
 +pci@0000:00:12.0              network    Virtio network device 
 +virtio@1          ens18       network    Ethernet interface 
 +pci@0000:00:1e.0              bridge     QEMU PCI-PCI bridge 
 +pci@0000:00:1f.             bridge     QEMU PCI-PCI bridge 
 +                  input0      input      Power Button 
 +                  input1      input      AT Translated Set 2 keyboard 
 +                  input3      input      VirtualPS/2 VMware VMMouse 
 +                  input4      input      VirtualPS/2 VMware VMMouse 
 +                  input6      input      PC Speaker
 </code> </code>
  
-====1.5 - Gestion des Evénements audit====+Consultez maintenant le matériel de la classe **system** :
  
-===Le fichier /var/log/audit/audit.log===+<code> 
 +[root@redhat9 ~]# lshw -c system 
 +redhat9.ittraining.loc       
 +    description: Computer 
 +    product: Standard PC (i440FX + PIIX, 1996) 
 +    vendor: QEMU 
 +    version: pc-i440fx-7.2 
 +    width: 64 bits 
 +    capabilities: smbios-2.8 dmi-2.8 smp vsyscall32 
 +    configuration: boot=normal uuid=6c89e267-fb34-42a1-9b13-15fa7185048f 
 +  *-pnp00:03 
 +       product: PnP device PNP0b00 
 +       physical id: 3 
 +       capabilities: pnp 
 +       configuration: driver=rtc_cmos 
 +</code>
  
-Ce fichier contient les messages du système d'audit, appelés des **événements**. Le système audit est installé par défaut dans RHEL/CentOS par le paquet **audit**. Le système audit collectionne des informations telles :+Consultez maintenant le matériel des autres classes principales :
  
-  * des appels système, +<code> 
-  * des accès aux fichiers, +[root@redhat9 ~]# lshw -c memory 
-  * des informations en provenance de %%SELinux%%.+  *-firmware                 
 +       description: BIOS 
 +       vendor: SeaBIOS 
 +       physical id: 0 
 +       version: rel-1.16.1-0-g3208b098f51a-prebuilt.qemu.org 
 +       date: 04/01/2014 
 +       size: 96KiB 
 +  *-memory 
 +       description: System Memory 
 +       physical id: 1000 
 +       size: 8GiB 
 +       capabilities: ecc 
 +       configuration: errordetection=multi-bit-ecc 
 +     *-bank 
 +          description: DIMM RAM 
 +          vendor: QEMU 
 +          physical id: 0 
 +          slot: DIMM 0 
 +          size: 8GiB
  
-Consultez maintenant le fichier **/var/log/audit.log** :+[root@redhat9 ~]# lshw -c video 
 +  *-display                  
 +       description: VGA compatible controller 
 +       product: bochs-drmdrmfb 
 +       physical id: 2 
 +       bus info: pci@0000:00:02.0 
 +       logical name: /dev/fb0 
 +       version: 02 
 +       width: 32 bits 
 +       clock: 33MHz 
 +       capabilities: vga_controller rom fb 
 +       configuration: depth=32 driver=bochs-drm latency=0 resolution=1280,800 
 +       resources: irq:0 memory:fc000000-fcffffff memory:fea50000-fea50fff memory:c0000-dffff 
 + 
 + 
 +[root@redhat9 ~]# lshw -c storage 
 +  *-pnp00:02                 
 +       product: PnP device PNP0700 
 +       physical id: 2 
 +       capabilities: pnp 
 +  *-ide 
 +       description: IDE interface 
 +       product: 82371SB PIIX3 IDE [Natoma/Triton II] 
 +       vendor: Intel Corporation 
 +       physical id: 1.1 
 +       bus info: pci@0000:00:01.1 
 +       logical name: scsi2 
 +       version: 00 
 +       width: 32 bits 
 +       clock: 33MHz 
 +       capabilities: ide isa_compat_mode bus_master emulated 
 +       configuration: driver=ata_piix latency=0 
 +       resources: irq:0 ioport:1f0(size=8) ioport:3f6 ioport:170(size=8) ioport:376 ioport:f080(size=16) 
 +  *-scsi 
 +       description: SCSI storage controller 
 +       product: Virtio SCSI 
 +       vendor: Red Hat, Inc. 
 +       physical id: 1 
 +       bus info: pci@0000:01:01.0 
 +       version: 00 
 +       width: 64 bits 
 +       clock: 33MHz 
 +       capabilities: scsi msix bus_master cap_list 
 +       configuration: driver=virtio-pci latency=0 
 +       resources: irq:10 ioport:e000(size=64) memory:fe800000-fe800fff memory:fd400000-fd403fff 
 + 
 +[root@redhat9 ~]# lshw -c disk 
 +  *-cdrom                    
 +       description: DVD reader 
 +       product: QEMU DVD-ROM 
 +       vendor: QEMU 
 +       physical id: 0.0.0 
 +       bus info: scsi@2:0.0.0 
 +       logical name: /dev/cdrom 
 +       logical name: /dev/sr0 
 +       version: 2.5+ 
 +       capabilities: removable audio dvd 
 +       configuration: ansiversion=5 status=nodisc 
 +  *-disk 
 +       description: SCSI Disk 
 +       product: QEMU HARDDISK 
 +       vendor: QEMU 
 +       physical id: 0.0.0 
 +       bus info: scsi@0:0.0.0 
 +       logical name: /dev/sda 
 +       version: 2.5+ 
 +       size: 50GiB (53GB) 
 +       capabilities: 5400rpm partitioned partitioned:dos 
 +       configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512 signature=d00dfc8a 
 + 
 +[root@redhat9 ~]# lshw -c volume 
 +  *-volume:                
 +       description: Linux filesystem partition 
 +       physical id: 1 
 +       bus info: scsi@0:0.0.0,
 +       logical name: /dev/sda1 
 +       logical name: /boot 
 +       capacity: 1GiB 
 +       capabilities: primary bootable 
 +       configuration: mount.fstype=xfs mount.options=rw,seclabel,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota state=mounted 
 +  *-volume:
 +       description: Linux LVM Physical Volume partition 
 +       physical id: 2 
 +       bus info: scsi@0:0.0.0,
 +       logical name: /dev/sda2 
 +       serial: tpPvpD-OIie-EmBd-M7Xh-gNRF-Z5u3-OP84ck 
 +       size: 48GiB 
 +       capacity: 48GiB 
 +       capabilities: primary multi lvm2 
 + 
 +[root@redhat9 ~]# lshw -c network 
 +  *-network                  
 +       description: Ethernet controller 
 +       product: Virtio network device 
 +       vendor: Red Hat, Inc. 
 +       physical id: 12 
 +       bus info: pci@0000:00:12.0 
 +       version: 00 
 +       width: 64 bits 
 +       clock: 33MHz 
 +       capabilities: msix bus_master cap_list rom 
 +       configuration: driver=virtio-pci latency=0 
 +       resources: irq:10 ioport:f060(size=32) memory:fea52000-fea52fff memory:fd604000-fd607fff memory:fea00000-fea3ffff 
 +     *-virtio1 
 +          description: Ethernet interface 
 +          physical id: 0 
 +          bus info: virtio@1 
 +          logical name: ens18 
 +          serial: 92:86:d7:66:e7:5a 
 +          capabilities: ethernet physical 
 +          configuration: autonegotiation=off broadcast=yes driver=virtio_net driverversion=1.0.0 ip=10.0.2.101 link=yes multicast=yes 
 +</code> 
 + 
 +===Options de la commande=== 
 + 
 +Les options de cette commande sont :
  
 <code> <code>
-[root@centos8 ~]# tail -n 15 /var/log/audit/audit.log +[root@redhat9 ~]# lshw -h 
-type=PROCTITLE msg=audit(1622728321.894:455): proctitle=2F7573722F7362696E2F63726F6E64002D6E +Hardware Lister (lshw) - B.02.19.2 
-type=USER_START msg=audit(1622728321.901:456): pid=2420 uid=0 auid=1000 ses=53 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee" +usagelshw [-format] [-options ...] 
-type=CRED_REFR msg=audit(1622728321.902:457): pid=2420 uid=0 auid=1000 ses=53 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_localuser,pam_unix acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee" +       lshw -version 
-type=CRED_DISP msg=audit(1622728321.908:458): pid=2420 uid=0 auid=1000 ses=53 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_localuser,pam_unix acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee" + 
-type=USER_END msg=audit(1622728321.910:459): pid=2420 uid=0 auid=1000 ses=53 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee" +        -version        print program version (B.02.19.2) 
-type=SERVICE_STOP msg=audit(1622728330.965:460): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=fprintd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'UID="root" AUID="unset" + 
-type=USER_ACCT msg=audit(1622728381.954:461): pid=2439 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=pam_access,pam_unix,pam_localuser acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="unset" +format can be 
-type=CRED_ACQ msg=audit(1622728381.954:462): pid=2439 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_localuser,pam_unix acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="unset" +        -html           output hardware tree as HTML 
-type=LOGIN msg=audit(1622728381.954:463): pid=2439 uid=0 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 old-auid=4294967295 auid=1000 tty=(none) old-ses=4294967295 ses=54 res=1UID="root" OLD-AUID="unset" AUID="trainee" +        -xml            output hardware tree as XML 
-type=SYSCALL msg=audit(1622728381.954:463): arch=c000003e syscall=1 success=yes exit=4 a0=7 a1=7ffdcd7a6d50 a2=4 a3=0 items=0 ppid=1126 pid=2439 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=54 comm="crond" exe="/usr/sbin/crond" subj=system_u:system_r:crond_t:s0-s0:c0.c1023 key=(null)ARCH=x86_64 SYSCALL=write AUID="trainee" UID="root" GID="root" EUID="root" SUID="root" FSUID="root" EGID="root" SGID="root" FSGID="root" +        -json           output hardware tree as a JSON object 
-type=PROCTITLE msg=audit(1622728381.954:463): proctitle=2F7573722F7362696E2F63726F6E64002D6E +        -short          output hardware paths 
-type=USER_START msg=audit(1622728381.960:464): pid=2439 uid=0 auid=1000 ses=54 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee" +        -businfo        output bus information 
-type=CRED_REFR msg=audit(1622728381.962:465): pid=2439 uid=0 auid=1000 ses=54 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_localuser,pam_unix acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee" + 
-type=CRED_DISP msg=audit(1622728381.966:466): pid=2439 uid=0 auid=1000 ses=54 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_localuser,pam_unix acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee" +options can be 
-type=USER_END msg=audit(1622728381.968:467): pid=2439 uid=0 auid=1000 ses=54 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="trainee" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'UID="root" AUID="trainee"+        -dump filename  display output and dump collected information into a file (SQLite database
 +        -class CLASS    only show a certain class of hardware 
 +        -C CLASS        same as '-class CLASS
 +        -c CLASS        same as '-class CLASS
 +        -disable TEST   disable a test (like pci, isapnp, cpuid, etc.) 
 +        -enable TEST    enable a test (like pciisapnpcpuid, etc.) 
 +        -quiet          don't display status 
 +        -sanitize       sanitize output (remove sensitive information like serial numbers, etc.) 
 +        -numeric        output numeric IDs (for PCIUSBetc.) 
 +        -notime         exclude volatile attributes (timestamps) from output
 </code> </code>
  
-La gestion des événements audit se repose sur trois exécutables :+====1.7 - La Commande dmidecode====
  
-===auditd===+La commande **dmidecode** lit la table **DMI** (//Desktop Management Interface//) aussi appelée **SMBIOS** (//System Management BIOS//) et fourni les informations sur :
  
-Cet exécutable est le daemon du système audit. Il est responsable de l’écriture des enregistrements audit sur disque. Son fichier de configuration est le **/etc/audit/auditd.conf** :+  * l'état du matériel actuel, 
 +  les extensions possibles.
  
 <code> <code>
-[root@centos8 ~]# cat /etc/audit/auditd.conf +[root@redhat9 ~]# dmidecode 
-+dmidecode 3.5 
-# This file controls the configuration of the audit daemon +Getting SMBIOS data from sysfs. 
-#+SMBIOS 2.8 present. 
 +11 structures occupying 511 bytes. 
 +Table at 0x000F59C0.
  
-local_events = yes +Handle 0x0000, DMI type 0, 24 bytes 
-write_logs = yes +BIOS Information 
-log_file = /var/log/audit/audit.log +        Vendor: SeaBIOS 
-log_group = root +        Version: rel-1.16.1-0-g3208b098f51a-prebuilt.qemu.org 
-log_format = ENRICHED +        Release Date: 04/01/2014 
-flush = INCREMENTAL_ASYNC +        Address: 0xE8000 
-freq = 50 +        Runtime Size: 96 kB 
-max_log_file = 8 +        ROM Size: 64 kB 
-num_logs = 5 +        Characteristics: 
-priority_boost = +                BIOS characteristics not supported 
-name_format = NONE +                Targeted content distribution is supported 
-##name = mydomain +        BIOS Revision: 0.0 
-max_log_file_action = ROTATE + 
-space_left = 75 +Handle 0x0100, DMI type 1, 27 bytes 
-space_left_action = SYSLOG +System Information 
-verify_email = yes +        Manufacturer: QEMU 
-action_mail_acct = root +        Product Name: Standard PC (i440FX + PIIX, 1996) 
-admin_space_left = 50 +        Version: pc-i440fx-7.2 
-admin_space_left_action = SUSPEND +        Serial Number: Not Specified 
-disk_full_action = SUSPEND +        UUID: 6c89e267-fb34-42a1-9b13-15fa7185048f 
-disk_error_action = SUSPEND +        Wake-up Type: Power Switch 
-use_libwrap = yes +        SKU Number: Not Specified 
-##tcp_listen_port = 60 +        Family: Not Specified 
-tcp_listen_queue = 5 + 
-tcp_max_per_addr = +Handle 0x0300, DMI type 3, 22 bytes 
-##tcp_client_ports = 1024-65535 +Chassis Information 
-tcp_client_max_idle = +        Manufacturer: QEMU 
-transport = TCP +        Type: Other 
-krb5_principal = auditd +        Lock: Not Present 
-##krb5_key_file = /etc/audit/audit.key +        Version: pc-i440fx-7.2 
-distribute_network = no +        Serial Number: Not Specified 
-q_depth = 400 +        Asset Tag: Not Specified 
-overflow_action = SYSLOG +        Boot-up State: Safe 
-max_restarts = 10 +        Power Supply State: Safe 
-plugin_dir = /etc/audit/plugins.d+        Thermal State: Safe 
 +        Security Status: Unknown 
 +        OEM Information: 0x00000000 
 +        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: CPU 0 
 +        Type: Central Processor 
 +        Family: Other 
 +        Manufacturer: QEMU 
 +        ID: 63 06 05 00 FF FB 8B 0F 
 +        Version: pc-i440fx-7.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: 2 
 +        Core Enabled: 2 
 +        Thread Count: 2 
 +        Characteristics: None 
 + 
 +Handle 0x0401, DMI type 4, 42 bytes 
 +Processor Information 
 +        Socket Designation: CPU 
 +        Type: Central Processor 
 +        Family: Other 
 +        Manufacturer: QEMU 
 +        ID: 63 06 05 00 FF FB 8B 0F 
 +        Version: pc-i440fx-7.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: 2 
 +        Core Enabled: 2 
 +        Thread Count: 2 
 +        Characteristics: None 
 + 
 +Handle 0x1000, DMI type 16, 23 bytes 
 +Physical Memory Array 
 +        Location: Other 
 +        Use: System Memory 
 +        Error Correction Type: Multi-bit ECC 
 +        Maximum Capacity: 8 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: 8 GB 
 +        Form Factor: DIMM 
 +        Set: None 
 +        Locator: DIMM 
 +        Bank Locator: Not Specified 
 +        Type: RAM 
 +        Type Detail: Other 
 +        Speed: Unknown 
 +        Manufacturer: QEMU 
 +        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: 0x0023FFFFFFF 
 +        Range Size: 5 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
 </code> </code>
  
-Les option de cette commande sont :+===Options de la commande=== 
 + 
 +Les options de cette commande sont :
  
 <code> <code>
-[root@centos8 ~]# auditd --help +[root@redhat9 ~]# dmidecode --help 
-auditdunrecognized option '--help' +Usagedmidecode [OPTIONS] 
-Usage: auditd [-f] [-l] [-n] [-s disable|enable|nochange] [-c <config_file>]+Options are: 
 + -d, --dev-mem FILE     Read memory from device FILE (default: /dev/mem) 
 + -h, --help             Display this help text and exit 
 + -q, --quiet            Less verbose output 
 +     --no-quirks        Decode everything without quirks 
 + -s--string KEYWORD   Only display the value of the given DMI string 
 + -t, --type TYPE        Only display the entries of given type 
 + -H, --handle HANDLE    Only display the entry of given handle 
 + -u, --dump             Do not decode the entries 
 +     --dump-bin FILE    Dump the DMI data to a binary file 
 +     --from-dump FILE   Read the DMI data from a binary file 
 +     --no-sysfs         Do not attempt to read DMI data from sysfs files 
 +     --oem-string N     Only display the value of the given OEM string 
 + -V, --version          Display the version and exit
 </code> </code>
  
-===auditctl===+====1.8 - La Commande smartctl==== 
 + 
 +**smartctl** contrôle le système SMART (Self-Monitoring, Analysis and Reporting Technology) intégré à la plupart des disques durs et disques SSD ATA/SATA et SCSI/SAS.
  
-Cet exécutable est utilisé pour configurer les règles du système audit. Au démarrage, auditctl lit et applique les règles contunues dans le fichier **/etc/audit/audit.rules** :+Activez smartctl :
  
 <code> <code>
-[root@centos8 ~]# cat /etc/audit/audit.rules +[root@redhat9 ~]# smartctl --smart=on --saveauto=on --offlineauto=on /dev/sdb 
-## This file is automatically generated from /etc/audit/rules.+smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.14.0-427.37.1.el9_4.x86_64] (local build) 
--+Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
--b 8192 +
--+
---backlog_wait_time 60000+
  
 +=== START OF ENABLE/DISABLE COMMANDS SECTION ===
 +SMART Enabled.
 +SMART Attribute Autosave Enabled.
 +SMART Automatic Timers not supported
 +
 +SMART Enable Automatic Offline failed: scsi error badly formed scsi parameters
 +
 +[root@redhat9 ~]# smartctl -a /dev/sdb
 +smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.14.0-427.37.1.el9_4.x86_64] (local build)
 +Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
 +
 +=== START OF INFORMATION SECTION ===
 +Device Model:     QEMU HARDDISK
 +Serial Number:    QM00005
 +Firmware Version: 2.5+
 +User Capacity:    34,359,738,368 bytes [34.3 GB]
 +Sector Size:      512 bytes logical/physical
 +TRIM Command:     Available, deterministic
 +Device is:        Not in smartctl database [for details use: -P showall]
 +ATA Version is:   ATA/ATAPI-7, ATA/ATAPI-5 published, ANSI NCITS 340-2000
 +Local Time is:    Tue Oct 22 15:38:47 2024 CEST
 +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:  (0x02) Offline data collection activity
 +                                        was completed without error.
 +                                        Auto Offline Data Collection: Disabled.
 +Self-test execution status:      (   0) The previous self-test routine completed
 +                                        without error or no self-test has ever 
 +                                        been run.
 +Total time to complete Offline 
 +data collection:                (  288) seconds.
 +Offline data collection
 +capabilities:                    (0x19) SMART execute Offline immediate.
 +                                        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:            (0x0003) Saves SMART data before entering
 +                                        power-saving mode.
 +                                        Supports SMART auto save timer.
 +Error logging capability:        (0x01) Error logging supported.
 +                                        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          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
 +  1 Raw_Read_Error_Rate     0x0003   100   100   006    Pre-fail  Always             0
 +  3 Spin_Up_Time            0x0003   100   100   000    Pre-fail  Always             16
 +  4 Start_Stop_Count        0x0002   100   100   020    Old_age   Always             100
 +  5 Reallocated_Sector_Ct   0x0003   100   100   036    Pre-fail  Always             0
 +  9 Power_On_Hours          0x0003   100   100   000    Pre-fail  Always             1
 + 12 Power_Cycle_Count       0x0003   100   100   000    Pre-fail  Always             0
 +190 Airflow_Temperature_Cel 0x0003   069   069   050    Pre-fail  Always             31 (Min/Max 31/31)
 +
 +SMART Error Log Version: 1
 +No Errors Logged
 +
 +SMART Self-test log structure revision number 1
 +No self-tests have been logged.  [To run self-tests, use: smartctl -t]
 +
 +Selective Self-tests/Logging not supported
 </code> </code>
 +
 +===Options de la commande===
  
 Les options de cette commande sont : Les options de cette commande sont :
  
 <code> <code>
-[root@centos8 ~]# auditctl --help +[root@redhat9 ~]# smartctl --help 
-usageauditctl [options] +smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.14.0-427.37.1.el9_4.x86_64] (local build) 
-    -a <l,a>            Append rule to end of <l>ist with <a>ction +Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org 
-    -A <l,a>            Add rule at beginning of <l>ist with <a>ction + 
-    -b <backlog>        Set max number of outstanding audit buffers +Usagesmartctl [options] device 
-                        allowed Default=64 + 
-    -c                  Continue through errors in rules +============================================ SHOW INFORMATION OPTIONS ===== 
-    -C f=f              Compare collected fields if available: + 
-                        Field nameoperator(=,!=), field name +  -h--help, --usage 
-    -d <l,a>            Delete rule from <l>ist with <a>ction +         Display this help and exit 
-                        l=task,exit,user,exclude + 
-                        a=never,always +  -V, --version, --copyright, --license 
-    -D                  Delete all rules and watches +         Print license, copyright, and version information and exit 
-    -e [0..2          Set enabled flag + 
-    -[0..2          Set failure flag +  -i, --info 
-                        0=silent 1=printk 2=panic +         Show identity information for device 
-    -f=v              Build rulefield nameoperator(=,!=,<,>,<=, + 
-                        >=,&,&=) value +  --identify[=[w][nvb]] 
-    -h                  Help +         Show words and bits from IDENTIFY DEVICE data                (ATA) 
-    -i                  Ignore errors when reading rules from file + 
-    -k <key>            Set filter key on audit rule +  -g NAME, --get=NAME 
-    -l                  List rules +        Get device setting: all, aam, apm, dsn, lookahead, security, 
-    -m text             Send a user-space message +        wcache, rcache, wcreorder, wcache-sct 
-    -[r|w|x|a]        Set permissions filter on watch + 
-                        r=read, w=write, x=execute, a=attribute +  -a, --all 
-    -q <mount,subtree>  make subtree part of mount point's dir watches +         Show all SMART information for device 
-    -r <rate>           Set limit in messages/sec (0=none+ 
-    -R <file>           read rules from file +  -x, --xall 
-    -s                  Report status +         Show all information for device 
-    -S syscall          Build rule: syscall name or number + 
-    -t                  Trim directory watches +  --scan 
-    -v                  Version +         Scan for devices 
-    -w <path>           Insert watch at <path> + 
-    -W <path>           Remove watch at <path> +  --scan-open 
-    --loginuid-immutable  Make loginuids unchangeable once set +         Scan for devices and try to open each device 
-    --backlog_wait_time  Set the kernel backlog_wait_time + 
-    --reset-lost         Reset the lost record counter+================================== SMARTCTL RUN-TIME BEHAVIOR OPTIONS ===== 
 + 
 +  -j, --json[=cgiosuvy] 
 +         Print output in JSON or YAML format 
 + 
 +  -q TYPE, --quietmode=TYPE                                           (ATA) 
 +         Set smartctl quiet mode to one of: errorsonly, silent, noserial 
 + 
 +  -d TYPE--device=TYPE 
 +         Specify device type to one of: 
 +         ata, scsi[+TYPE], nvme[,NSID], sat[,auto][,N][+TYPE], usbcypress[,X], usbjmicron[,p][,x][,N], usbprolific, usbsunplus, sntjmicron[,NSID], sntrealtek, intelliprop,N[+TYPE], jmb39x[-q],N[,sLBA][,force][+TYPE], jms56x,N[,sLBA][,force][+TYPE], marvell, areca,N/E, 3ware,N, hpt,L/M/N, megaraid,N, aacraid,H,L,ID, cciss,N, auto, test 
 + 
 +  -T TYPE, --tolerance=TYPE                                           (ATA) 
 +         Tolerance: normal, conservative, permissive, verypermissive 
 + 
 +  -b TYPE, --badsum=TYPE                                              (ATA) 
 +         Set action on bad checksum to one of: warn, exit, ignore 
 + 
 +  -r TYPE, --report=TYPE 
 +         Report transactions (see man page) 
 + 
 +  -n MODE[,STATUS], --nocheck=MODE[,STATUS]                     (ATA, SCSI) 
 +         No check if: neversleep, standby, idle (see man page) 
 + 
 +============================== DEVICE FEATURE ENABLE/DISABLE COMMANDS ===== 
 + 
 +  -s VALUE--smart=VALUE 
 +        Enable/disable SMART on device (on/off
 + 
 +  -o VALUE--offlineauto=VALUE                                       (ATA) 
 +        Enable/disable automatic offline testing on device (on/off) 
 + 
 +  -S VALUE, --saveauto=VALUE                                          (ATA) 
 +        Enable/disable Attribute autosave on device (on/off) 
 + 
 +  -s NAME[,VALUE]--set=NAME[,VALUE] 
 +        Enable/disable/change device setting: aam,[N|off], apm,[N|off]
 +        dsn,[on|off], lookahead,[on|off], security-freeze, 
 +        standby,[N|off|now], wcache,[on|off], rcache,[on|off], 
 +        wcreorder,[on|off[,p]], wcache-sct,[ata|on|off[,p]
 + 
 +======================================= READ AND DISPLAY DATA OPTIONS ===== 
 + 
 +  -H, --health 
 +        Show device SMART health status 
 + 
 +  -c, --capabilities                                            (ATA, NVMe) 
 +        Show device SMART capabilities 
 + 
 +  -A, --attributes 
 +        Show device SMART vendor-specific Attributes and values 
 + 
 +  -f FORMAT, --format=FORMAT                                          (ATA) 
 +        Set output format for attributesoldbriefhex[,id|val] 
 + 
 +  -l TYPE, --log=TYPE 
 +        Show device log. TYPE: errorselftestselectivedirectory[,g|s], 
 +        xerror[,N][,error], xselftest[,N][,selftest], background, 
 +        sasphy[,reset], sataphy[,reset], scttemp[sts,hist], 
 +        scttempint,N[,p], scterc[,N,M], devstat[,N], defects[,N], ssd, 
 +        gplog,N[,RANGE], smartlog,N[,RANGE], nvmelog,N,SIZE 
 + 
 +  -v N,OPTION , --vendorattribute=N,OPTION                            (ATA) 
 +        Set display OPTION for vendor Attribute N (see man page) 
 + 
 +  -F TYPE, --firmwarebug=TYPE                                         (ATA) 
 +        Use firmware bug workaround: 
 +        nonenologdirsamsung, samsung2, samsung3, xerrorlba, swapid 
 + 
 +  -P TYPE, --presets=TYPE                                             (ATA
 +        Drive-specific presets: use, ignore, show, showall 
 + 
 +  -B [+]FILE, --drivedb=[+]FILE                                       (ATA) 
 +        Read and replace [add] drive database from FILE 
 +        [default is +/etc/smartmontools/smart_drivedb.h 
 +         and then    /usr/share/smartmontools/drivedb.h] 
 + 
 +============================================ DEVICE SELF-TEST OPTIONS ===== 
 + 
 +  -t TEST, --test=TEST 
 +        Run test. TEST: offline, short, long, conveyance, force, vendor,N, 
 +                        select,M-N, pending,N, afterselect,[on|off] 
 + 
 +  -C, --captive 
 +        Do test in captive mode (along with -t) 
 + 
 +  -X, --abort 
 +        Abort any non-captive test on device 
 + 
 +=================================================== SMARTCTL EXAMPLES ===== 
 + 
 +  smartctl --all /dev/sda                    (Prints all SMART information
 + 
 +  smartctl --smart=on --offlineauto=on --saveauto=on /dev/sda 
 +                                              (Enables SMART on first disk) 
 + 
 +  smartctl --test=long /dev/sda          (Executes extended disk self-test) 
 + 
 +  smartctl --attributes --log=selftest --quietmode=errorsonly /dev/sda 
 +                                      (Prints Self-Test & Attribute errors) 
 +  smartctl --all --device=3ware,2 /dev/sda 
 +  smartctl --all --device=3ware,2 /dev/twe0 
 +  smartctl --all --device=3ware,2 /dev/twa0 
 +  smartctl --all --device=3ware,2 /dev/twl0 
 +          (Prints all SMART info for 3rd ATA disk on 3ware RAID controller) 
 +  smartctl --all --device=hpt,1/1/3 /dev/sda 
 +          (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,3/1 /dev/sg2 
 +          (Prints all SMART info for 3rd ATA disk of the 1st enclosure 
 +           on Areca RAID controller)
 </code> </code>
  
-===La consultation des événements audit===+====1.9 - Les Commandes accton et dump-acct====
  
-La consultation des événements audit se fait en utilisant les commandes **ausearch** et **aureport** :+Cette commande permet d'activer ou désactiver la comptabilisation des processus :
  
-==La Commande aureport==+<code> 
 +[root@redhat9 ~]# accton on 
 +Turning on process accounting, file set to the default '/var/account/pacct'
 + 
 +[root@redhat9 ~]# systemctl status psacct 
 +○ psacct.service - Kernel process accounting 
 +     Loaded: loaded (/usr/lib/systemd/system/psacct.service; disabled; preset: disabled) 
 +     Active: inactive (dead) 
 + 
 +[root@redhat9 ~]# systemctl enable --now psacct 
 +Created symlink /etc/systemd/system/multi-user.target.wants/psacct.service → /usr/lib/systemd/system/psacct.service. 
 + 
 +[root@redhat9 ~]# systemctl status psacct 
 +● psacct.service - Kernel process accounting 
 +     Loaded: loaded (/usr/lib/systemd/system/psacct.service; enabled; preset: disabled) 
 +     Active: active (exited) since Tue 2024-10-22 15:41:45 CEST; 3s ago 
 +    Process: 2249 ExecStartPre=/usr/libexec/psacct/accton-create (code=exited, status=0/SUCCESS) 
 +    Process: 2250 ExecStart=/usr/sbin/accton /var/account/pacct (code=exited, status=0/SUCCESS) 
 +   Main PID: 2250 (code=exited, status=0/SUCCESS) 
 +        CPU: 4ms 
 + 
 +Oct 22 15:41:45 redhat9.ittraining.loc systemd[1]: Starting Kernel process accounting... 
 +Oct 22 15:41:45 redhat9.ittraining.loc accton[2250]: Turning on process accounting, file set to '/var/account/pacct'
 +Oct 22 15:41:45 redhat9.ittraining.loc systemd[1]: Finished Kernel process accounting. 
 +</code>
  
-Cette commande est utilisée pour générer des rapports :+Par contre le fichier **/var/account/pacct** ne peut pas être lu avec les utilitaires de consultation de fichiers texte :
  
 <code> <code>
-[root@centos8 ~]# aureport+[root@redhat9 ~]# cat /var/account/pacct 
 +vg?H 
 +_selinuxenablg(systemd-debugg?2kpodman-systemgM{grg?Mselinux-autorg?(systemd-hiberg?(systemd-veritg?(systemd-run-gg?(systemd-integg@(systemd-gettyg?(systemd-sysv-g?(systemd-systeg@-ostree-systemg@(systemd-cryptgMsg@Mnkdump-dep-geng@(systemd-rc-log@Mgrg@Mkdump-dep-geng@(systemd-blessg@(systemd-gpt-aug@JY(sd-executorg@Maccton-creatgacctogH 
 +acctg@@(systemd-tty-asgANsystemcg?Mlesg@tN5systemcgD{unix_chkpwd 
 +                                                               g?E(gmag|MjpgMsg@crond 
 +                                                                                    gE(gmain 
 +                                                                                           gE(gmain 
 +                                                                                                  gE'gmain 
 +                                                                                                         gE'gmain 
 +                                                                                                                gE'gmain 
 +                                                                                                                       gE'gmain 
 +                                                                                                                              gE*gmain 
 +                                                                                                                                     gE(gmainrgGkworker/dyingrgGkworker/dyingsgtGkworker/dying)rgGkworker/dying(rgGkworker/dyingtg.Gkworker/dyingtg.Gkworker/dying 
 +PpackagekitdrgBGkworker/dying.ugGkworker/dyingFsg0Gkworker/dying[root@redhat9 ~]# gGkworker/dying%rgDGkworker/dyinggF] 
 +</code>
  
-Summary Report +La commande **dump-acct** permet de voir son contenu mais pas de l'exploiter : 
-====================== + 
-Range of time in logs: 05/08/2020 08:13:52.320 - 06/03/2021 10:20:02.028 +<code> 
-Selected time for report05/08/2020 08:13:52 - 06/03/2021 10:20:02.028 +[root@redhat9 ~]# dump-acct /var/account/pacct 
-Number of changes in configuration46 +accton          |v3|     0.00|     0.00|     1.00|     0|     0|  2632.00|     0.00|    2216|    2090|S    |       0|pts/  |Tue Oct 22 15:41:10 2024 
-Number of changes to accounts, groups, or roles56 +less            |v3|     0.00|     0.00|     9.00|     0|     0|221312.00|     0.00|    2218|    2217|S    |       0|pts/0   |Tue Oct 22 15:41:23 2024 
-Number of logins21 +systemctl       |v3|     0.00|     0.00|    10.00|     0|     0|236800.00|     0.00|    2217|    2090|S    |       3|pts/  |Tue Oct 22 15:41:23 2024 
-Number of failed logins5 +systemd-fstab-g |v3|     0.00|     0.00|     0.00|     0|     0| 18240.00|     0.00|    2228|    2220|S    |       0|__      |Tue Oct 22 15:41:45 2024 
-Number of authentications50 +selinuxenabled  |v3|     0.00|     0.00|     0.00|     0|     0|  3436.00|     0.00|    2239|    2224|           0|__      |Tue Oct 22 15:41:45 2024 
-Number of failed authentications8 +systemd-debug-g |v3|     0.00|     0.00|     0.00|     0|     0| 18200.00|     0.00|    2227|    2220|S    |       0|__      |Tue Oct 22 15:41:45 2024 
-Number of users3 +podman-system-g |v3|     0.00|     0.00|     1.00|     0|     0|1467392.00|     0.00|    2223|    2220|S   X|       0|__      |Tue Oct 22 15:41:45 2024 
-Number of terminals10 +grep            |v3|     0.00|     0.00|     0.00|     0|     0|221824.00|     0.00|    2246|    2224|           1|__      |Tue Oct 22 15:41:45 2024 
-Number of host names4 +selinux-autorel |v3|     0.00|     0.00|     1.00|     0|     0|222528.00|     0.00|    2224|    2220|S    |       0|__      |Tue Oct 22 15:41:45 2024 
-Number of executables: 22 +systemd-hiberna |v3|     0.00|     0.00|     1.00|     0|     0| 18192.00|     0.00|    2231|    2220|S    |       0|__      |Tue Oct 22 15:41:45 2024 
-Number of commands11 +systemd-veritys |v3|     0.00|     0.00|     1.00|     0|     0| 18224.00|     0.00|    2243|    2220|S    |       0|__      |Tue Oct 22 15:41:45 2024 
-Number of files: 0 +systemd-run-gen |v3|     0.00|     0.00|     1.00|     0|     0| 18200.00|     0.00|    2240|    2220|S    |       0|__      |Tue Oct 22 15:41:45 2024 
-Number of AVC's: 0 +systemd-integri |v3|     0.00|     0.00|     1.00|     0|     0| 18208.00|     0.00|    2232|    2220|S    |       0|__      |Tue Oct 22 15:41:45 2024 
-Number of MAC events35 +systemd-getty-g |v3|     0.00|     0.00|     2.00|     0|     0| 18200.00|     0.00|    2229|    2220|S    |       0|__      |Tue Oct 22 15:41:45 2024 
-Number of failed syscalls: 0 +systemd-sysv-ge |v3|     0.00|     0.00|     1.00|     0|     0| 18224.00|     0.00|    2242|    2220|S    |       0|__      |Tue Oct 22 15:41:45 2024 
-Number of anomaly events: 7 +systemd-system- |v3|     0.00|     0.00|     1.00|     0|     0| 18192.00|     0.00|    2241|    2220|S    |       0|__      |Tue Oct 22 15:41:45 2024 
-Number of responses to anomaly events: 0 +ostree-system-g |v3|     0.00|     0.00|     2.00|     0|     0| 27728.00|     0.00|    2222|    2220|S    |       0|__      |Tue Oct 22 15:41:45 2024 
-Number of crypto events287 +systemd-cryptse |v3|     0.00|     0.00|     2.00|     0|     0| 18224.00|     0.00|    2226|    2220|S    |       0|__      |Tue Oct 22 15:41:45 2024 
-Number of integrity events: 0 +sed             |v3|     0.00|     0.00|     0.00|     0|     0|221952.00|     0.00|    2247|    2237|           0|__      |Tue Oct 22 15:41:45 2024 
-Number of virt events: 0 +kdump-dep-gener |v3|     0.00|     0.00|     2.00|     0|     0|223168.00|     0.00|    2237|    2221| F         0|__      |Tue Oct 22 15:41:45 2024 
-Number of keys: 0 +systemd-rc-loca |v3|     0.00|     0.00|     2.00|     0|     0| 18200.00|     0.00|    2236|    2220|S    |       0|__      |Tue Oct 22 15:41:45 2024 
-Number of process IDs616 +grep            |v3|     0.00|     0.00|     2.00|     0|     0|221696.00|     0.00|    2238|    2221|           1|__      |Tue Oct 22 15:41:45 2024 
-Number of events6030+kdump-dep-gener |v3|     0.00|     0.00|     2.00|     0|     0|223168.00|     0.00|    2221|    2220|S    |       0|__      |Tue Oct 22 15:41:45 2024 
 +systemd-bless-b |v3|     0.00|     0.00|     2.00|     0|     0| 18200.00|     0.00|    2225|    2220|S    |       0|__      |Tue Oct 22 15:41:45 2024 
 +systemd-gpt-aut |v3|     0.00|     0.00|     6.00|     0|     0| 18208.00|     0.00|    2230|    2220|S    |       0|__      |Tue Oct 22 15:41:45 2024 
 +(sd-executor)   |v3|     0.00|     0.00|     7.00|     0|     0|174080.00|     0.00|    2220|       1|SF         0|__      |Tue Oct 22 15:41:45 2024 
 +accton-create   |v3|     0.00|     0.00|     2.00|     0|     0|222528.00|     0.00|    2249|       1|S    |       0|__      |Tue Oct 22 15:41:45 2024 
 +accton          |v3|     0.00|     0.00|     0.00|     0|     0|     0.00|     0.00|    2250|       1|           0|__      |Tue Oct 22 15:41:45 2024 
 +accton          |v3|     0.00|     0.00|     0.00|     0|     0|  2632.00|     0.00|    2250|       1|S    |       0|__      |Tue Oct 22 15:41:45 2024 
 +systemd-tty-ask |v3|     0.00|     0.00|     3.00|     0|     0| 18224.00|     0.00|    2248|    2219|S    |       0|pts/0   |Tue Oct 22 15:41:45 2024 
 +systemctl       |v3|     0.00|     0.00|    29.00|     0|     0|237696.00|     0.00|    2219|    2090|S    |       0|pts/0   |Tue Oct 22 15:41:45 2024 
 +less            |v3|     0.00|     0.00|     1.00|     0|     0|221312.00|     0.00|    2252|    2251|S    |       0|pts/0   |Tue Oct 22 15:41:49 2024 
 +systemctl       |v3|     0.00|     0.00|     2.00|     0|     0|236800.00|     0.00|    2251|    2090|S    |       0|pts/0   |Tue Oct 22 15:41:49 2024 
 +unix_chkpwd     |v3|     0.00|     0.00|     0.00|     0|     0|  3908.00|     0.00|    2254|    2253|S    |       0|__      |Tue Oct 22 15:42:01 2024 
 +gmain           |v3|     0.00|     0.00|     1.00|   998|   996| 93248.00|     0.00|    2255|     779|    X|       0|__      |Tue Oct 22 15:42:01 2024 
 +pwd             |v3|     0.00|     0.00|     0.00|  1000|  1000|220928.00|     0.00|    2258|    2257|           0|__      |Tue Oct 22 15:42:01 2024 
 +sh              |v3|     0.00|     0.00|     0.00|  1000|  1000|222528.00|     0.00|    2257|    2253|S    |       0|__      |Tue Oct 22 15:42:01 2024 
 +crond           |v3|     0.00|     1.00|     4.00|     0|  1000|231104.00|     0.00|    2253|     983|SF         0|__      |Tue Oct 22 15:42:01 2024 
 +gmain           |v3|     0.00|     0.00|     0.00|   998|   996| 93248.00|     0.00|    2259|     779|    X|       0|__      |Tue Oct 22 15:42:01 2024 
 +gmain           |v3|     0.00|     0.00|     0.00|   998|   996| 93248.00|     0.00|    2261|     779|    X|       0|__      |Tue Oct 22 15:42:01 2024 
 +gmain           |v3|     0.00|     0.00|     0.00|   998|   996| 93248.00|     0.00|    2263|     779|    X|       0|__      |Tue Oct 22 15:42:01 2024 
 +gmain           |v3|     0.00|     0.00|     0.00|   998|   996| 93248.00|     0.00|    2265|     779|    X|       0|__      |Tue Oct 22 15:42:01 2024 
 +gmain           |v3|     0.00|     0.00|     0.00|   998|   996| 93248.00|     0.00|    2267|     779|    X|       0|__      |Tue Oct 22 15:42:01 2024 
 +gmain           |v3|     0.00|     0.00|     0.00|   998|   996| 93248.00|     0.00|    2269|     779|    X|       0|__      |Tue Oct 22 15:42:01 2024 
 +gmain           |v3|     0.00|     0.00|     0.00|   998|   996| 93248.00|     0.00|    2271|     779|    X|       0|__      |Tue Oct 22 15:42:01 2024 
 +gmain           |v3|     0.00|     0.00|     0.00|   998|   996| 93248.00|     0.00|    2273|     779|    X|       0|__      |Tue Oct 22 15:42:01 2024 
 +kworker/dying   |v3|     0.00|     0.00| 33274.00|     0|     0|     0.00|     0.00|      26|       2| F         0|__      |Tue Oct 22 15:36:50 2024 
 +kworker/dying   |v3|     0.00|     0.00| 33274.00|     0|     0|     0.00|     0.00|      31|       2| F         0|__      |Tue Oct 22 15:36:50 2024 
 +kworker/dying   |v3|     0.00|     0.00| 33140.00|     0|     0|     0.00|     0.00|     253|       2| F         0|__      |Tue Oct 22 15:36:51 2024 
 +kworker/dying   |v3|     0.00|     0.00| 33274.00|     0|     0|     0.00|     0.00|      41|       2| F         0|__      |Tue Oct 22 15:36:50 2024 
 +kworker/dying   |v3|     0.00|     0.00| 33274.00|     0|     0|     0.00|     0.00|      40|       2| F         0|__      |Tue Oct 22 15:36:50 2024 
 +kworker/dying   |v3|     0.00|     0.00| 33070.00|     0|     0|     0.00|     0.00|     451|       2| F         0|__      |Tue Oct 22 15:36:52 2024 
 +kworker/dying   |v3|     0.00|     0.00| 33070.00|     0|     0|     0.00|     0.00|     452|       2| F         0|__      |Tue Oct 22 15:36:52 2024 
 +kworker/dying   |v3|     0.00|     1.00| 33275.00|     0|     0|     0.00|     0.00|      11|       2| F         0|__      |Tue Oct 22 15:36:50 2024 
 +kworker/dying   |v3|     0.00|     0.00| 33274.00|     0|     0|     0.00|     0.00|      25|       2| F         0|__      |Tue Oct 22 15:36:50 2024 
 +kworker/dying   |v3|     0.00|     0.00| 33256.00|     0|     0|     0.00|     0.00|      72|       2| F         0|__      |Tue Oct 22 15:36:50 2024 
 +kworker/dying   |v3|     0.00|     0.00| 33348.00|     0|     0|     0.00|     0.00|      37|       2| F         0|__      |Tue Oct 22 15:36:50 2024 
 +packagekitd     |v3|     7.00|     5.00| 30176.00|     0|     0|487808.00|     0.00|    1717|       1|S   X|       0|__      |Tue Oct 22 15:37:23 2024 
 +kworker/dying   |v3|     0.00|     0.00| 33602.00|     0|     0|     0.00|     0.00|       7|       2| F         0|__      |Tue Oct 22 15:36:50 2024 
 +kworker/dying   |v3|     0.00|     0.00| 33302.00|     0|     0|     0.00|     0.00|     558|       2| F         0|__      |Tue Oct 22 15:36:53 2024 
 +kworker/dying   |v3|     0.00|     0.00| 33584.00|     0|     0|     0.00|     0.00|      70|       2| F         0|__      |Tue Oct 22 15:36:51 2024 
 +cat             |v3|     0.00|     0.00|     0.00|     0|     0|220928.00|     0.00|    2278|    2090|           0|pts/  |Tue Oct 22 15:42:46 2024 
 +systemd-tmpfile |v3|     0.00|     0.00|     1.00|    42|    42| 18640.00|     0.00|    2279|    1240|           0|__      |Tue Oct 22 15:42:54 2024 
 +systemd-tmpfile |v3|     0.00|     0.00|     1.00|  1000|  1000| 18640.00|     0.00|    2280|    1907|           0|__      |Tue Oct 22 15:42:54 2024 
 +unix_chkpwd     |v3|     0.00|     0.00|     0.00|     0|     0|  3908.00|     0.00|    2283|    2282|S    |       0|__      |Tue Oct 22 15:43:01 2024 
 +gmain           |v3|     0.00|     0.00|     0.00|   998|   996| 93248.00|     0.00|    2284|     779|    X|       0|__      |Tue Oct 22 15:43:01 2024 
 +pwd             |v3|     0.00|     0.00|     0.00|  1000|  1000|220928.00|     0.00|    2287|    2286|           0|__      |Tue Oct 22 15:43:01 2024 
 +sh              |v3|     0.00|     0.00|     0.00|  1000|  1000|222528.00|     0.00|    2286|    2282|S    |       0|__      |Tue Oct 22 15:43:01 2024 
 +crond           |v3|     0.00|     0.00|     4.00|     0|  1000|231104.00|     0.00|    2282|     983|SF         0|__      |Tue Oct 22 15:43:01 2024 
 +gmain           |v3|     0.00|     0.00|     0.00|   998|   996| 93248.00|     0.00|    2288|     779|    X|       0|__      |Tue Oct 22 15:43:01 2024 
 +gmain           |v3|     0.00|     0.00|     0.00|   998|   996| 93248.00|     0.00|    2290|     779|    X|       0|__      |Tue Oct 22 15:43:01 2024 
 +gmain           |v3|     0.00|     0.00|     0.00|   998|   996| 93248.00|     0.00|    2292|     779|    X|       0|__      |Tue Oct 22 15:43:01 2024 
 +gmain           |v3|     0.00|     0.00|     0.00|   998|   996| 93248.00|     0.00|    2294|     779|    X|       0|__      |Tue Oct 22 15:43:01 2024 
 +gmain           |v3|     0.00|     0.00|     0.00|   998|   996| 93248.00|     0.00|    2296|     779|    X|       0|__      |Tue Oct 22 15:43:01 2024 
 +gmain           |v3|     0.00|     0.00|     0.00|   998|   996| 93248.00|     0.00|    2298|     779|    X|       0|__      |Tue Oct 22 15:43:01 2024 
 +gmain           |v3|     0.00|     0.00|     0.00|   998|   996| 93248.00|     0.00|    2300|     779|    X|       0|__      |Tue Oct 22 15:43:01 2024 
 +gmain           |v3|     0.00|     0.00|     0.00|   998|   996| 93248.00|     0.00|    2302|     779|    X|       0|__      |Tue Oct 22 15:43:01 2024
 </code> </code>
  
-Les options de cette commande sont :+====1.10 - La Commande lastcomm==== 
 + 
 +Cette commande vous renseigne sur l'historique et les statistiques des commandes par utilisateur :
  
 <code> <code>
-[root@centos8 ~]# aureport --help +[root@redhat9 ~]# lastcomm 
-usageaureport [options] +man                    root     pts/     0.00 secs Tue Oct 22 15:44 
- -a,--avc Avc report +dump-acct              root     pts/     0.00 secs Tue Oct 22 15:44 
- -au,--auth Authentication report +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:44 
- --comm Commands run report +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:44 
- -c,--config Config change report +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:44 
- -cr,--crypto Crypto report +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:44 
- -e,--event Event report +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:44 
- -f,--file File name report +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:44 
- --failed only failed events in report +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:44 
- -h,--host Remote Host name report +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:44 
- --help help +crond            SF    root     __         0.00 secs Tue Oct 22 15:44 
- -i,--interpret Interpretive mode +sh                   trainee  __         0.00 secs Tue Oct 22 15:44 
- -if,--input <Input File name> use this file as input +pwd                    trainee  __         0.00 secs Tue Oct 22 15:44 
- --input-logs Use the logs even if stdin is a pipe +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:44 
- --integrity Integrity event report +unix_chkpwd      S     root     __         0.00 secs Tue Oct 22 15:44 
- -l,--login Login report +dump-acct              root     pts/     0.00 secs Tue Oct 22 15:43 
- -k,--key Key report +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:43 
- -m,--mods Modification to accounts report +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:43 
- -ma,--mac Mandatory Access Control (MACreport +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:43 
- -n,--anomaly aNomaly report +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:43 
- -nc,--no-config Don't include config events +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:43 
- --node <node name> Only events from a specific node +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:43 
- -p,--pid Pid report +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:43 
- -r,--response Response to anomaly report +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:43 
- -s,--syscall Syscall report +crond            SF    root     __         0.00 secs Tue Oct 22 15:43 
- --success only success events in report +sh                   trainee  __         0.00 secs Tue Oct 22 15:43 
- --summary sorted totals for main object in report +pwd                    trainee  __         0.00 secs Tue Oct 22 15:43 
- -t,--log Log time range report +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:43 
- -te,--end [end date] [end time] ending date & time for reports +unix_chkpwd      S     root     __         0.00 secs Tue Oct 22 15:43 
- -tm,--terminal TerMinal name report +systemd-tmpfile        trainee  __         0.00 secs Tue Oct 22 15:42 
- -ts,--start [start date] [start time] starting data & time for reports +systemd-tmpfile        gdm      __         0.00 secs Tue Oct 22 15:42 
- --tty Report about tty keystrokes +cat                    root     pts/     0.00 secs Tue Oct 22 15:42 
- -u,--user User name report +kworker/dying        root     __         0.00 secs Tue Oct 22 15:36 
- -v,--version Version +kworker/dying        root     __         0.00 secs Tue Oct 22 15:36 
- --virt Virtualization report +kworker/dying        root     __         0.00 secs Tue Oct 22 15:36 
- -x,--executable eXecutable name report +packagekitd      S   X root     __         0.12 secs Tue Oct 22 15:37 
- If no report is given, the summary report will be displayed+kworker/dying        root     __         0.00 secs Tue Oct 22 15:36 
 +kworker/dying        root     __         0.00 secs Tue Oct 22 15:36 
 +kworker/dying        root     __         0.00 secs Tue Oct 22 15:36 
 +kworker/dying        root     __         0.01 secs Tue Oct 22 15:36 
 +kworker/dying        root     __         0.00 secs Tue Oct 22 15:36 
 +kworker/dying        root     __         0.00 secs Tue Oct 22 15:36 
 +kworker/dying        root     __         0.00 secs Tue Oct 22 15:36 
 +kworker/dying        root     __         0.00 secs Tue Oct 22 15:36 
 +kworker/dying        root     __         0.00 secs Tue Oct 22 15:36 
 +kworker/dying        root     __         0.00 secs Tue Oct 22 15:36 
 +kworker/dying        root     __         0.00 secs Tue Oct 22 15:36 
 +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:42 
 +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:42 
 +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:42 
 +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:42 
 +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:42 
 +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:42 
 +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:42 
 +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:42 
 +crond            SF    root     __         0.01 secs Tue Oct 22 15:42 
 +sh                   trainee  __         0.00 secs Tue Oct 22 15:42 
 +pwd                    trainee  __         0.00 secs Tue Oct 22 15:42 
 +gmain                X polkitd  __         0.00 secs Tue Oct 22 15:42 
 +unix_chkpwd      S     root     __         0.00 secs Tue Oct 22 15:42 
 +systemctl        S     root     pts/     0.00 secs Tue Oct 22 15:41 
 +less                 root     pts/     0.00 secs Tue Oct 22 15:41 
 +systemctl        S     root     pts/     0.00 secs Tue Oct 22 15:41 
 +systemd-tty-ask  S     root     pts/     0.00 secs Tue Oct 22 15:41 
 +accton               root     __         0.00 secs Tue Oct 22 15:41 
 +accton                 root     __         0.00 secs Tue Oct 22 15:41 
 +accton-create    S     root     __         0.00 secs Tue Oct 22 15:41 
 +(sd-executor   SF    root     __         0.00 secs Tue Oct 22 15:41 
 +systemd-gpt-aut  S     root     __         0.00 secs Tue Oct 22 15:41 
 +systemd-bless-b  S     root     __         0.00 secs Tue Oct 22 15:41 
 +kdump-dep-gener  S     root     __         0.00 secs Tue Oct 22 15:41 
 +grep                   root     __         0.00 secs Tue Oct 22 15:41 
 +systemd-rc-loca  S     root     __         0.00 secs Tue Oct 22 15:41 
 +kdump-dep-gener      root     __         0.00 secs Tue Oct 22 15:41 
 +sed                    root     __         0.00 secs Tue Oct 22 15:41 
 +systemd-cryptse  S     root     __         0.00 secs Tue Oct 22 15:41 
 +ostree-system-g  S     root     __         0.00 secs Tue Oct 22 15:41 
 +systemd-system     root     __         0.00 secs Tue Oct 22 15:41 
 +systemd-sysv-ge  S     root     __         0.00 secs Tue Oct 22 15:41 
 +systemd-getty-g  S     root     __         0.00 secs Tue Oct 22 15:41 
 +systemd-integri  S     root     __         0.00 secs Tue Oct 22 15:41 
 +systemd-run-gen  S     root     __         0.00 secs Tue Oct 22 15:41 
 +systemd-veritys  S     root     __         0.00 secs Tue Oct 22 15:41 
 +systemd-hiberna  S     root     __         0.00 secs Tue Oct 22 15:41 
 +selinux-autorel  S     root     __         0.00 secs Tue Oct 22 15:41 
 +grep                   root     __         0.00 secs Tue Oct 22 15:41 
 +podman-system-g  S   X root     __         0.00 secs Tue Oct 22 15:41 
 +systemd-debug-g  S     root     __         0.00 secs Tue Oct 22 15:41 
 +selinuxenabled         root     __         0.00 secs Tue Oct 22 15:41 
 +systemd-fstab-g  S     root     __         0.00 secs Tue Oct 22 15:41 
 +systemctl        S     root     pts/     0.00 secs Tue Oct 22 15:41 
 +less                 root     pts/     0.00 secs Tue Oct 22 15:41 
 +accton               root     pts/     0.00 secs Tue Oct 22 15:41 
 + 
 +[root@redhat9 ~]# lastcomm grep 
 +grep                   root     __         0.00 secs Tue Oct 22 15:41 
 +grep                   root     __         0.00 secs Tue Oct 22 15:41
 </code> </code>
  
-==La Commande ausearch==+====1.11 - La Commande sa====
  
-Cette commande est utilisée pour rechercher des événements. Par exemple, pour rechercher les événements liés à un utilisateur représenté par son UID :+Cette commande vous renseigne sur les statistiques sur les processus lancés et leurs ressources systèmes:
  
 <code> <code>
-[root@centos8 ~]# ausearch -ui 1000 more +[root@redhat9 ~]# sa -egrep "root" 
----- +root       0.00 cpu      658k mem      0 io accton           
-time->Tue Sep  1 11:05:28 2020 +root       0.00 cpu    55328k mem      0 io less             
-type=USER_AUTH msg=audit(1598972728.209:77): pid=1633 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:authentication grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=localhost.locald +root       0.00 cpu    59200k mem      0 io systemctl        
-omain addr=? terminal=pts/res=success' +root       0.00 cpu     4560k mem      0 io systemd-fstab- 
----+root       0.00 cpu      859k mem      0 io selinuxenabled   
-time->Tue Sep  1 11:05:28 2020 +root       0.00 cpu     4550k mem      0 io systemd-debug-g  
-type=USER_ACCT msg=audit(1598972728.214:78): pid=1633 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=pam_unix,pam_localuser acct="root" exe="/usr/bin/su" hostname=localh +root       0.00 cpu   366848k mem      0 io podman-system-g  
-ost.localdomain addr=? terminal=pts/res=success' +root       0.00 cpu    55456k mem      0 io grep             
----- +root       0.00 cpu    55632k mem      0 io selinux-autorel  
-time->Tue Sep  1 11:05:28 2020 +root       0.00 cpu     4548k mem      0 io systemd-hiberna  
-type=CRED_ACQ msg=audit(1598972728.218:79): pid=1633 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=localhost.localdomain ad +root       0.00 cpu     4556k mem      0 io systemd-veritys  
-dr=? terminal=pts/res=success' +root       0.00 cpu     4550k mem      0 io systemd-run-gen  
----- +root       0.00 cpu     4552k mem      0 io systemd-integri  
-time->Tue Sep  1 11:05:28 2020 +root       0.00 cpu     4550k mem      0 io systemd-getty-g  
-type=USER_START msg=audit(1598972728.223:80): pid=1633 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_keyinit,pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask +root       0.00 cpu     4556k mem      0 io systemd-sysv-ge  
-,pam_xauth acct="root" exe="/usr/bin/su" hostname=localhost.localdomain addr=? terminal=pts/res=success' +root       0.00 cpu     4548k mem      0 io systemd-system-  
----- +root       0.00 cpu     6932k mem      0 io ostree-system-g  
-time->Tue Sep  1 11:10:13 2020 +root       0.00 cpu     4556k mem      0 io systemd-cryptse  
-type=USER_END msg=audit(1598973013.687:87): pid=1633 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_keyinit,pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask, +root       0.00 cpu    55488k mem      0 io sed              
-pam_xauth acct="root" exe="/usr/bin/su" hostname=localhost.localdomain addr=? terminal=pts/res=success' +root       0.00 cpu    55792k mem      0 io kdump-dep-gener * 
----- +root       0.00 cpu     4550k mem      0 io systemd-rc-loca  
-time->Tue Sep  1 11:10:13 2020 +root       0.00 cpu    55424k mem      0 io grep             
-type=CRED_DISP msg=audit(1598973013.687:88): pid=1633 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=localhost.localdomain a +root       0.00 cpu    55792k mem      0 io kdump-dep-gener  
-ddr=? terminal=pts/res=success' +root       0.00 cpu     4550k mem      0 io systemd-bless-b  
----- +root       0.00 cpu     4552k mem      0 io systemd-gpt-aut  
-time->Mon Apr 19 11:48:01 2021 +root       0.00 cpu    43520k mem      0 io (sd-executor)   * 
-type=USER_AUTH msg=audit(1618847281.847:77): pid=1768 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:authentication grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=centos8.ittraini +root       0.00 cpu    55632k mem      0 io accton-create    
-ng.loc addr=? terminal=pts/res=success' +root       0.00 cpu        0k mem      0 io accton           
----- +root       0.00 cpu      658k mem      0 io accton           
-time->Mon Apr 19 11:48:01 2021 +root       0.00 cpu     4556k mem      0 io systemd-tty-ask  
-type=USER_ACCT msg=audit(1618847281.847:78): pid=1768 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=pam_unix,pam_localuser acct="root" exe="/usr/bin/su" hostname=centos +root       0.00 cpu    59424k mem      0 io systemctl        
-8.ittraining.loc addr=? terminal=pts/0 res=success' +root       0.00 cpu    55328k mem      0 io less             
----- +root       0.00 cpu    59200k mem      0 io systemctl        
-time->Mon Apr 19 11:48:01 2021 +root       0.00 cpu      977k mem      0 io unix_chkpwd      
-type=CRED_ACQ msg=audit(1618847281.847:79): pid=1768 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=centos8.ittraining.loc a +root       0.01 cpu    57776k mem      0 io crond           * 
-ddr=? terminal=pts/res=success' +root       0.00 cpu        0k mem      0 io kworker/dying   * 
----- +root       0.00 cpu        0k mem      0 io kworker/dying   * 
-time->Mon Apr 19 11:48:01 2021 +root       0.00 cpu        0k mem      0 io kworker/dying   * 
-type=USER_START msg=audit(1618847281.883:80): pid=1768 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_keyinit,pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask +root       0.00 cpu        0k mem      0 io kworker/dying   * 
-,pam_xauth acct="root" exe="/usr/bin/su" hostname=centos8.ittraining.loc addr=? terminal=pts/res=success' +root       0.00 cpu        0k mem      0 io kworker/dying   * 
----- +root       0.00 cpu        0k mem      0 io kworker/dying   * 
-time->Mon Apr 19 12:04:39 2021 +root       0.00 cpu        0k mem      0 io kworker/dying   * 
-type=USER_END msg=audit(1618848279.544:541): pid=1768 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_keyinit,pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask +root       0.01 cpu        0k mem      0 io kworker/dying   * 
-,pam_xauth acct="root" exe="/usr/bin/su" hostname=centos8.ittraining.loc addr=? terminal=pts/res=success' +root       0.00 cpu        0k mem      0 io kworker/dying   * 
----- +root       0.00 cpu        0k mem      0 io kworker/dying   * 
-time->Mon Apr 19 12:04:39 2021 +root       0.00 cpu        0k mem      0 io kworker/dying   * 
-type=CRED_DISP msg=audit(1618848279.544:542): pid=1768 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=centos8.ittraining.loc +root       0.12 cpu   121952k mem      0 io packagekitd      
- addr=? terminal=pts/0 res=success' +root       0.00 cpu        0k mem      0 io kworker/dying   * 
----- +root       0.00 cpu        0k mem      0 io kworker/dying   * 
-time->Mon Apr 19 12:05:57 2021 +root       0.00 cpu        0k mem      0 io kworker/dying   * 
-type=USER_AUTH msg=audit(1618848357.204:69): pid=4892 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:authentication grantors=? acct="root" exe="/usr/bin/su" hostname=centos8.ittraining.loc  +root       0.00 cpu    55232k mem      0 io cat              
-addr=? terminal=pts/0 res=failed' +root       0.00 cpu      977k mem      0 io unix_chkpwd      
----- +root       0.00 cpu    57776k mem      0 io crond           * 
-time->Mon Apr 19 12:06:03 2021 +root       0.00 cpu      759k mem      0 io dump-acct        
-type=USER_AUTH msg=audit(1618848363.134:70): pid=4901 uid=1000 auid=1000 ses=subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:authentication grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=centos8.ittraini +root       0.00 cpu      977k mem      0 io unix_chkpwd      
-ng.loc addr=? terminal=pts/0 res=success' +root       0.00 cpu    57776k mem      0 io crond           * 
----- +root       0.00 cpu      660k mem      0 io dump-acct        
---More-- +root       0.00 cpu    55552k mem      0 io man              
-</code> +root       0.00 cpu      760k mem      0 io lastcomm         
 +root       0.00 cpu      977k mem      0 io unix_chkpwd      
 +root       0.00 cpu    57776k mem      0 io crond           * 
 +root       0.00 cpu      760k mem      0 io lastcomm         
 +root       0.00 cpu      977k mem      0 io unix_chkpwd      
 +root       0.01 cpu    57776k mem      0 io crond           * 
 +root       0.00 cpu      661k mem      0 io lastcomm         
 +</code> 
 + 
 +====1.12 La Commande ac==== 
 + 
 +Cette commande vous renseigne sur les statistiques des temps de connexion des utilisateurs : 
 + 
 +<code
 +[root@redhat9 ~]# ac -
 +        trainee                             20.30 
 +        total       20.30 
 + 
 +[root@redhat9 ~]# ac -d 
 +Oct 19  total       11.06 
 +Sep 25  total        1.49 
 +Sep 30  total        0.04 
 +Oct 21  total        6.08 
 +Today   total        1.63 
 +</code> 
 + 
 +===Options de la commande===
  
 Les options de cette commande sont : Les options de cette commande sont :
  
 <code> <code>
-[root@centos8 ~]# ausearch --help +[root@redhat9 ~]# ac --help 
-usageausearch [options+ 
- -a,--event <Audit event id> search based on audit event id +Usageac [OPTION... 
- --arch <CPU> search based on the CPU architecture + 
- -c,--comm  <Comm name> search based on command line name +OPTIONS: 
- --checkpoint <checkpoint file> search from last complete event +  -d, --daily-totals        Print totals for each day 
- --debug Write malformed events that are skipped to stderr +  -p, --individual-totals   Print time totals for each user 
- -e,--exit  <Exit code or errno> search based on syscall exit code +  -f, --file <file        Read from <file> 
- -f,--file  <File name> search based on file name +  --complain                Print errors for whatever problem 
- --format [raw|default|interpret|csv|text] results format options +  --reboots                 Count the time between login and reboot 
- -ga,--gid-all <all Group id> search based on All group ids +  --supplants               Count the time between logins on the terminal 
- -ge,--gid-effective <effective Group id>  search based on Effective +  --timewarps               Count the time between login and time warp 
- group id +  --compatibility           Shortcut for --reboots --supplants --timewarps 
- -gi,--gid <Group Id> search based on group id +  -a, --all-days            Do not skip days without login activity 
- -h,--help help +  --tw-leniency <value    Set the time warp leniency <valuein seconds 
- -hn,--host <Host Name> search based on remote host name +  --tw-suspicious <value  Set the time warp suspicious <valuein seconds 
- -i,--interpret Interpret results to be human readable +  --print-year              Print year when displaying dates 
- -if,--input <Input File name> use this file instead of current logs +  --print-zeros             Don't suppress zeros in category totals 
- --input-logs Use the logs even if stdin is a pipe +  --debug                   Print verbose internal information 
- --just-one Emit just one event +  -V, --version             Show version and exit 
- -k,--key  <key string> search based on key field +  -h, --help                Show help and exit 
- -l, --line-buffered Flush output on every line + 
- -m,--message  <Message type> search based on message type +The system's default login accounting file is /var/log/wtmp.
- -n,--node  <Node name> search based on machine's name +
- -o,--object  <SE Linux Object context> search based on context of object +
- -p,--pid  <Process id> search based on process id +
- -pp,--ppid <Parent Process id> search based on parent process id +
- -r,--raw output is completely unformatted +
- -sc,--syscall <SysCall name> search based on syscall name or number +
- -se,--context <SE Linux context> search based on either subject or +
- object +
- --session <login session id> search based on login session id +
- -su,--subject <SE Linux contextsearch based on context of the Subject +
- -sv,--success <Success Value> search based on syscall or event +
- success value +
- -te,--end [end date] [end time] ending date & time for search +
- -ts,--start [start date] [start time] starting data & time for search +
- -tm,--terminal <TerMinal> search based on terminal +
- -ua,--uid-all <all User id> search based on All user id's +
- -ue,--uid-effective <effective User id>  search based on Effective +
- user id +
- -ui,--uid <User Id> search based on user id +
- -ul,--loginuid <login id> search based on the User's Login id +
- -uu,--uuid <guest UUID> search for events related to the virtual +
- machine with the given UUID. +
- -v,--version version +
- -vm,--vm-name <guest name> search for events related to the virtual +
- machine with the name. +
- -w,--word string matches are whole word +
- -x,--executable <executable name>  search based on executable name+
 </code> </code>
  
-<WRAP center round important 60%> +=====LAB #2 - Réglage de la performance du système=====
-**Important** : Pour plus d'information concernant le système audit, consultez les manuels de **auditd**, **auditctl**, **audispd**, **aureport** et **ausearch**. +
-</WRAP>+
  
-=====Le fichier /var/log/messages=====+====2.1 - Présentation====
  
-Ce fichier contient la plupart des messages du système :+Le daemon **tuned** permet de régler la performance du système en fonction de profils contenant des paramètres de configuration du noyau pré-définis. Lors de l'installation de RedHat 9, le daemon n'est ni activé, ni démarré :
  
 <code> <code>
-[root@centos8 ~]# tail -n 15 /var/log/messages +[root@redhat9 ~]# systemctl status tuned 
-Jun  3 10:15:01 centos8 systemd[1]: session-76.scope: Succeeded. +○ tuned.service Dynamic System Tuning Daemon 
-Jun  3 10:16:01 centos8 systemd[1]: Started Session 77 of user trainee. +     Loadedloaded (/usr/lib/systemd/system/tuned.service; enabled; presetenabled) 
-Jun  3 10:16:01 centos8 systemd[1]: session-77.scope: Succeeded. +     Activeinactive (dead) 
-Jun  3 10:17:01 centos8 systemd[1]: Started Session 78 of user trainee. +       Docsman:tuned(8) 
-Jun  3 10:17:01 centos8 systemd[1]: session-78.scope: Succeeded. +             man:tuned.conf(5) 
-Jun  3 10:18:01 centos8 systemd[1]: Started Session 79 of user trainee. +             man:tuned-adm(8)
-Jun  3 10:18:01 centos8 systemd[1]: session-79.scope: Succeeded. +
-Jun  3 10:19:01 centos8 systemd[1]Started Session 80 of user trainee+
-Jun  3 10:19:01 centos8 systemd[1]: session-80.scope: Succeeded. +
-Jun  3 10:20:02 centos8 systemd[1]: Started Session 81 of user trainee. +
-Jun  3 10:20:02 centos8 systemd[1]: session-81.scope: Succeeded. +
-Jun  3 10:21:01 centos8 systemd[1]: Started Session 82 of user trainee. +
-Jun  3 10:21:01 centos8 systemd[1]: session-82.scope: Succeeded. +
-Jun  3 10:22:01 centos8 systemd[1]: Started Session 83 of user trainee. +
-Jun  3 10:22:01 centos8 systemd[1]: session-83.scope: Succeeded.+
 </code> </code>
  
-=====Applications=====+Le daemon peut être configuré pour modifier d'une manière dynamique les paramètres du noyau en fonction de la charge du système, en commencant avec les valeurs incluent dans le profil actif. Pour faire ceci, le daemon utilise des modules plug-ins **monitor** et des modules plug-ins **tuning**. Les plug-ins **monitor** analysent le système et fournissent les informations recoltées aux plug-ins **tuning** qui les utilisent pour appliquer des modifications dynamiques.
  
-Certaines applications consignent leurs journaux dans des répertoires spécifiques. Par exemple :+Les plugs-in **monitor** sont :
  
-   cups+  * **disk*- surveille le nombre d'opération en E/S de chaque disque
-   httpd+  **net** - surveille le nombre de paquets transmis par chaque interface réseau
-   samba+  **load** - surveille la charge de chaque CPU. 
-   * ...+ 
 +Les plug-ins **tuning** corréspondants sont : 
 + 
 +  * **disk** - définit différents paramètres de disque, par exemple le planificateur de disque ou la gestion avancée de l'énergie
 +  **net** - configure la vitesse de l'interface et la fonctionnalité Wake-on-LAN (WoL), 
 +  * **cpu** - définit différents paramètres des CPU par exemple le CPU governor ou la latence. 
 + 
 +====2.2 - Le fichier /etc/tuned/tuned-main.conf==== 
 + 
 +Pour activer le mode dynamique, modifiez la valeur de la directive **dynamic_tuning** dans le fichier **/etc/tuned/tuned-main.conf** :
  
 <code> <code>
-[root@centos8 ~]# ls -l /var/log +[root@redhat9 ~]# vi /etc/tuned/tuned-main.conf 
-total 2448 + 
-drwxr-xr-x2 root   root      280 May  8  2020 anaconda +[root@redhat9 ~]# cat /etc/tuned/tuned-main.conf 
-drwx------. 2 root   root       23 Apr 23  2020 audit +# Global tuned configuration file
--rw-------. 1 root   root        0 Jun  3 10:16 boot.log + 
--rw-------1 root   root    19710 Apr 19 13:44 boot.log-20210419 +# Whether to use daemonWithout daemon it just applies tuningIt is 
--rw-------1 root   root     9548 May 26 09:35 boot.log-20210526 +# not recommended, because many functions don't work without daemon, 
--rw-------1 root   root     9491 Jun  2 07:40 boot.log-20210602 +# e.gthere will be no D-Bus, no rollback of settings, no hotplug, 
--rw-------1 root   root    38555 Jun  3 10:16 boot.log-20210603 +# no dynamic tuning, ... 
--rw-rw----1 root   utmp     1152 Jun  3 09:51 btmp +daemon = 
--rw-rw----. root   utmp      384 May 26 10:37 btmp-20210602 + 
-drwxr-xr-x. 2 chrony chrony      6 Nov 19  2019 chrony +# Dynamicaly tune devices, if disabled only static tuning will be used
--rw-------1 root   root    35397 Jun  3 10:22 cron +dynamic_tuning = 
--rw-------. root   root     5652 Apr 19 13:01 cron-20210419 + 
--rw-------. 1 root   root    16279 May 26 09:01 cron-20210526 +# How long to sleep before checking for events (in seconds) 
--rw-------. 1 root   root     5117 Jun  2 07:01 cron-20210602 +# higher number means lower overhead but longer response time
--rw-------1 root   root    13577 Jun  3 10:12 dnf.librepo.log +sleep_interval = 
--rw-r--r--. root   root    43871 Apr 19 13:15 dnf.librepo.log-20210419 + 
--rw-------1 root   root    89109 May 26 08:54 dnf.librepo.log-20210526 +# Update interval for dynamic tunings (in seconds)
--rw-------1 root   root    17737 Jun  2 07:18 dnf.librepo.log-20210602 +# It must be multiply of the sleep_interval
--rw-r--r--. 1 root   root   749350 Jun  3 10:12 dnf.log +update_interval = 10 
--rw-r--r--. 1 root   root   138497 Jun  3 10:12 dnf.rpm.log + 
--rw-r-----. root   root     3808 Jun  3 09:01 firewalld +# Recommend functionality, if disabled "recommend" command will be not 
-drwxr-xr-x. 2 root   root        6 Nov  3  2020 glusterfs +# available in CLI, daemon will not parse recommend.conf but will return 
--rw-------1 root   root      510 Jun  3 09:58 hawkey.log +# one hardcoded profile (by default "balanced")
--rw-r--r--1 root   root      561 Apr 19 12:13 hawkey.log-20210419 +recommend_command = 
--rw-------1 root   root     3927 May 26 08:54 hawkey.log-20210526 + 
--rw-------1 root   root      306 Jun  2 06:17 hawkey.log-20210602 +# Whether to reapply sysctl from /run/sysctl.d/, /etc/sysctl.d/ and 
--rw-rw-r--. root   utmp   293168 Jun  3 09:01 lastlog +# /etc/sysctl.conf If enabled, these sysctls will be re-appliead 
-drwx------. 3 root   root       18 Apr 19 12:07 libvirt +# after TuneD sysctls are applied, i.eTuneD sysctls will not 
--rw-------. 1 root   root        Jun  07:40 maillog +# override user-provided system sysctls
--rw-------. 1 root   root        0 May  8  2020 maillog-20210419 +reapply_sysctl = 
--rw-------. 1 root   root        0 Apr 19 13:44 maillog-20210526 + 
--rw-------. 1 root   root        0 May 26 09:35 maillog-20210602 +# Default priority assigned to instances 
--rw-------. 1 root   root   452404 Jun  3 10:22 messages +default_instance_priority = 0 
--rw-------1 root   root   397916 Apr 19 13:15 messages-20210419 + 
--rw-------1 root   root   173289 May 26 09:19 messages-20210526 +# Udev buffer size 
--rw-------1 root   root   123100 Jun  2 07:38 messages-20210602 +udev_buffer_size = 1MB 
-drwx------2 root   root        6 May  8  2020 private + 
-drwx------3 root   root       17 Aug 17  2020 samba +# Log file count 
--rw-------1 root   root     6554 Jun  3 09:51 secure +log_file_count = 
--rw-------. root   root    10835 Apr 19 12:07 secure-20210419 + 
--rw-------1 root   root    11884 May 26 08:49 secure-20210526 +# Log file max size 
--rw-------. root   root     3633 Jun  2 06:40 secure-20210602 +log_file_max_size = 1MB 
--rw-------. root   root        0 Jun  2 07:40 spooler + 
--rw-------. root   root        0 May  8  2020 spooler-20210419 +# Preset system uname string for architecture specific tuning
--rw-------1 root   root        0 Apr 19 13:44 spooler-20210526 +# It can be used to force tuning for specific architecture
--rw-------. 1 root   root        0 May 26 09:35 spooler-20210602 +# If commented, "uname" will be called to fill its content
-drwxr-x---. 2 sssd   sssd      270 Jun  3 10:16 sssd +# uname_string = x86_64 
-drwxr-xr-x. 3 root   root       21 Apr 19 12:07 swtpm + 
-drwxr-xr-x. 2 root   root       23 Jan  4 11:24 tuned +# Preset system cpuinfo string for architecture specific tuning
--rw-rw-r--. 1 root   utmp    34176 Jun  3 09:51 wtmp+# It can be used to force tuning for specific architecture
 +# If commented, "/proc/cpuinfo" will be read to fill its content
 +# cpuinfo_string = Intel 
 + 
 +# Enable TuneD listening on dbus 
 +# enable_dbus = 
 + 
 +# Enable TuneD listening on unix domain socket 
 +# As this functionality is not used commonly, we disable it by default 
 +# and it is needed to allow it manually 
 +# enable_unix_socket = 0 
 + 
 +# Path to socket for TuneD to listen 
 +# Existing files on given path will be removed 
 +# unix_socket_path = /run/tuned/tuned.sock 
 + 
 +# Paths to sockets for TuneD to send signals to separated by , or ; 
 +# unix_socket_signal_paths = 
 + 
 +# Default unix socket ownership 
 +# Can be set as id or name, -1 or non-existing name leaves unchanged 
 +# unix_socket_ownership = -1 -1 
 + 
 +# Permissions for listening sockets 
 +# unix_socket_permissions = 0o600 
 + 
 +# Size of connections backlog for listen function on socket 
 +# Higher value allows to process requests from more clients 
 +# connections_backlog = 1024 
 + 
 +# TuneD daemon rollback strategySupported valuesauto|not_on_exit 
 +autorollbacks are always performed on a profile switch or  
 +  graceful TuneD process exit 
 +not_on_exitrollbacks are always performed on a profile 
 +  switch, but not on any kind of TuneD process exit 
 +# rollback = auto
 </code> </code>
  
-=====LAB #2 - rsyslog=====+Activez et démarrez le daemon **tuned** :
  
-**rsyslog**, le successeur de syslog, centralise les journaux du système grâce au daemon **rsyslog**. +<code> 
 +[root@redhat9 ~]# systemctl enable --now tuned
  
-rsyslog apporte des améliorations par rapport à syslogd +[root@redhat9 ~]# systemctl status tuned 
 +● tuned.service - Dynamic System Tuning Daemon 
 +     Loadedloaded (/usr/lib/systemd/system/tuned.service; enabled; preset: enabled) 
 +     Active: active (running) since Tue 2024-10-22 16:13:46 CEST; 4s ago 
 +       Docs: man:tuned(8) 
 +             man:tuned.conf(5) 
 +             man:tuned-adm(8) 
 +   Main PID: 3060 (tuned) 
 +      Tasks: 4 (limit: 48800) 
 +     Memory: 16.4M 
 +        CPU: 411ms 
 +     CGroup: /system.slice/tuned.service 
 +             └─3060 /usr/bin/python3 -Es /usr/sbin/tuned -l -P
  
-  * l'addition du protocole **TCP** pour la communication, +Oct 22 16:13:45 redhat9.ittraining.loc systemd[1]: Starting Dynamic System Tuning Daemon... 
-  * la haute disponibilité, +Oct 22 16:13:46 redhat9.ittraining.loc systemd[1]: Started Dynamic System Tuning Daemon. 
-  * l'utilisation des bases de données au format MySQL et PostgreSQL pour stocker des journaux+</code>
  
-Les messages de journalisation envoyés à rsyslog sont marqués avec un **Sous-système applicatif** et une **Priorité**Le binôme Sous-système applicatif/Priorité s'appelle un **Sélecteur**.+====2.Profils====
  
-rsyslog décide ensuite de l'**action** à entreprendre concernant les informations transmises :+Les profils sont stocké dans le répertoire **ls /usr/lib/tuned** :
  
-  * ignorer les informations, +<code> 
-  * envoyer les informations à un rsyslog sur une autre machine (par exemple, **@machine2**), +[root@redhat9 ~]# ls /usr/lib/tuned 
-  * inscrire les informations dans un fichier sur disque (par exemple, **/var/log/messages**), +accelerator-performance  balanced  functions    intel-sst            network-latency     optimize-serial-console  recommend.d             virtual-guest 
-  * transmettre les informations à un utilisateur (par exemple **root**), +aws                      desktop   hpc-compute  latency-performance  network-throughput  powersave                throughput-performance  virtual-host 
-  * transmettre les informations à tous les utilisateurs (par exemple *****), +</code>
-  * transmettre les informations à une application liée à rsyslog via un tube (par exemple, **|logrotate**).+
  
-Sous RHEL/CentOS, le daemon rsyslog est configuré par l'édition du fichier **/etc/sysconfig/rsyslog** :+Consultez le fichier **/usr/lib/tuned/throughput-performance/tuned.conf** :
  
 <code> <code>
-[root@centos8 ~]# cat /etc/sysconfig/rsyslog +[root@redhat9 ~]# cat /usr/lib/tuned/throughput-performance/tuned.conf 
-Options for rsyslogd +
-Syslogd options are deprecated since rsyslog v3+# tuned configuration 
-# If you want to use themswitch to compatibility mode 2 by "-c 2" +
-See rsyslogd(8) for more details + 
-SYSLOGD_OPTIONS=""+[main] 
 +summary=Broadly applicable tuning that provides excellent performance across a variety of common server workloads 
 + 
 +[variables] 
 +thunderx_cpuinfo_regex=CPU part\s+:\s+(0x0?516)|(0x0?af)|(0x0?a[0-3])|(0x0?b8)\b 
 +amd_cpuinfo_regex=model name\s+:.*\bAMD\b 
 + 
 +[cpu] 
 +governor=performance 
 +energy_perf_bias=performance 
 +min_perf_pct=100 
 +energy_performance_preference=performance 
 + 
 +[acpi] 
 +platform_profile=performance 
 + 
 +# Marvell ThunderX 
 +[vm.thunderx] 
 +type=vm 
 +uname_regex=aarch64 
 +cpuinfo_regex=${thunderx_cpuinfo_regex} 
 +transparent_hugepages=never 
 + 
 +[disk] 
 +The default unit for readahead is KiB.  This can be adjusted to sectors 
 +by specifying the relevant suffix, eg. (readahead => 8192 s)There must 
 +# be at least one space between the number and suffix (if suffix is specified). 
 +readahead=>4096 
 + 
 +[sysctl] 
 +# If a workload mostly uses anonymous memory and it hits this limit, the entire 
 +# working set is buffered for I/O, and any more write buffering would require 
 +# swapping, so it's time to throttle writes until I/O can catch up.  Workloads 
 +# that mostly use file mappings may be able to use even higher values. 
 +
 +# The generator of dirty data starts writeback at this percentage (system default 
 +# is 20%) 
 +vm.dirty_ratio = 40 
 + 
 +# Start background writeback (via writeback threads) at this percentage (system 
 +# default is 10%) 
 +vm.dirty_background_ratio = 10 
 + 
 +# PID allocation wrap value.  When the kernel's next PID value 
 +# reaches this valueit wraps back to a minimum PID value. 
 +PIDs of value pid_max or larger are not allocated. 
 +
 +# A suggested value for pid_max is 1024 * <# of cpu cores/threads in system> 
 +# e.g., a box with 32 cpus, the default of 32768 is reasonable, for 64 cpus, 
 +# 65536, for 4096 cpus, 4194304 (which is the upper limit possible)
 +#kernel.pid_max = 65536 
 + 
 +# The swappiness parameter controls the tendency of the kernel to move 
 +# processes out of physical memory and onto the swap disk. 
 +# 0 tells the kernel to avoid swapping processes out of physical memory 
 +for as long as possible 
 +# 100 tells the kernel to aggressively swap processes out of physical memory 
 +# and move them to swap cache 
 +vm.swappiness=10 
 + 
 +# The default kernel value 128 was over twenty years old default, 
 +# kernel-5.4 increased it to 4096, thus do not have it lower than 2048 
 +# on older kernels 
 +net.core.somaxconn=>2048 
 + 
 +# Marvell ThunderX 
 +[sysctl.thunderx] 
 +type=sysctl 
 +uname_regex=aarch64 
 +cpuinfo_regex=${thunderx_cpuinfo_regex} 
 +kernel.numa_balancing=0
 </code> </code>
  
-L'option **-c** de la directive **SYSLOGD_OPTIONS** spécifie le niveau de compatibilité avec les anciennes versions de rsyslog ainsi qu'avec son prédécesseur syslogd :+Pour consulter le profil actif, utilisez la commande suivante :
  
-^ Directive ^ Version ^ +<code> 
-| SYSLOGD_OPTIONS="-c 4" | Mode natif - aucune compatibilité | +[root@redhat9 ~]# tuned-adm active 
-| SYSLOGD_OPTIONS="-c 2" | rsyslog V2 - mode compatibilité | +Current active profile: virtual-guest 
-| SYSLOGD_OPTIONS="-c 0" | syslogd |+</code>
  
-====2.1 Priorités====+Ce profil est choisit par le système en fonction de la sortie de la sous-commande **recommend** de la commande **tuned-adm** :
  
-La **Priorité** permet d'indiquer à rsyslog l'importance des informations :+<code> 
 +[root@redhat9 ~]# tuned-adm recommend 
 +virtual-guest 
 +</code>
  
-^ Niveau ^ Priorité ^ Description ^ +La sous-commande **list** de la commande **tuned-adm** permet de consulter les profils disponibles :
-| 0 | emerg/panic | Système inutilisable | +
-| 1 | alert | Action immédiate requise | +
-| 2 | crit | Condition critique atteinte | +
-| 3 | err/error | Erreurs rencontrées | +
-| 4 | warning/warn | Avertissements présentés | +
-| 5 | notice | Condition normale message important | +
-| 6 | info | Condition normale - message simple | +
-| 7 | debug | Condition normale message de débogage | +
  
-====2.Sous-systèmes applicatifs====+<code> 
 +[root@redhat9 ~]# tuned-adm list 
 +Available profiles: 
 +- accelerator-performance     - Throughput performance based tuning with disabled higher latency STOP states 
 +- aws                         - Optimize for aws ec2 instances 
 +- balanced                    - General non-specialized tuned profile 
 +- desktop                     - Optimize for the desktop use-case 
 +- hpc-compute                 - Optimize for HPC compute workloads 
 +- intel-sst                   - Configure for Intel Speed Select Base Frequency 
 +- latency-performance         - Optimize for deterministic performance at the cost of increased power consumption 
 +- network-latency             - Optimize for deterministic performance at the cost of increased power consumption, focused on low latency network performance 
 +- network-throughput          - Optimize for streaming network throughput, generally only necessary on older CPUs or 40G+ networks 
 +- optimize-serial-console     - Optimize for serial console use. 
 +- powersave                   - Optimize for low power consumption 
 +- throughput-performance      - Broadly applicable tuning that provides excellent performance across a variety of common server workloads 
 +- virtual-guest               - Optimize for running inside a virtual guest 
 +- virtual-host                Optimize for running KVM guests 
 +Current active profile: virtual-guest 
 +</code>
  
-Le **Sous-système applicatif**, aussi appelé **facility**, permet d'indiquer à rsyslog le type de programme qui envoie les informations :+Les profiles fournit avec RedHat 9 sont les suivants :
  
-Fonction ^ Description ^ +Profile ^ Description ^ 
-auth/auth-priv Message de sécurité / autorisation +accelerator-performance Il s'agit d'un réglage identique au throughput-performance, qui réduit également la latence à moins de 100 μs. 
-cron Message de cron ou at +aws Optimiser pour les instances aws ec2 
-daemon Message d'un daemon +balanced Idéal pour les systèmes qui nécessitent un compromis entre économie d'énergie et performance. 
-kern Message du noyau +desktop Dérivé du profil balanced. Permet une réponse plus rapide des applications interactives. 
-lpr Message du système d'impression +hpc-compute Dérivé du profil latency-performance. Idéal pour l'informatique de haute performance. | 
-mail Message du système de mail +| intel-sst | Optimisé pour les systèmes dotés de configurations Intel Speed Select Technology. A utiliser en superposition à d'autres profils. 
-news Message du système de news +latency-performance | Idéal pour les systèmes de serveurs qui nécessitent une faible latence au détriment de la consommation d'énergie. | 
-syslog Message interne de rsyslogd +| network-latency Dérivé du profil latency-performance. Permet d'activer des paramètres supplémentaires de réglage du réseau afin d'obtenir une faible latence du réseau. 
-user Message utilisateur +network-throughput Dérivé du profil throughput-performance. Des paramètres supplémentaires de réglage du réseau sont appliqués pour obtenir un débit maximal. 
-uucp Message du système UUCP +optimize-serial-console Augmente la réactivité de la console série. A utiliser en superposition à d'autres profils. 
-local0 local7 Réservés pour des utilisations locales |+powersave Permet de régler le système pour une économie d'énergie maximale. 
 +throughput-performance Permet de régler le système pour obtenir un débit maximal. | 
 +| virtual-guest | Permet d'optimiser les performances du système s'il fonctionne sur une machine virtuelle. 
 +virtual-host Permet de régler le système pour qu'il soit le plus performant possible s'il sert d'hôte à des machines virtuelles. |
  
 +Modifiez le profil actif à **throughput-performance** :
  
-====2.3 /etc/rsyslog.conf====+<code> 
 +[root@redhat9 ~]# tuned-adm profile throughput-performance
  
-rsyslog est configuré par le fichier **/etc/rsyslog.conf** :+[root@redhat9 ~]# tuned-adm active 
 +Current active profile: throughput-performance 
 +</code> 
 + 
 +Verifiez la valeur de **vm.spappiness** :
  
 <code> <code>
-[root@centos8 ~]# cat /etc/rsyslog.conf +[root@redhat9 ~]# sysctl vm.swappiness 
-# rsyslog configuration file+vm.swappiness = 10 
 +</code>
  
-# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html +Pour désactiver l'optimisation de la performance, utilisez la sous-commande **off** de la commande **tuned-adm** :
-# or latest version online at http://www.rsyslog.com/doc/rsyslog_conf.html  +
-# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html+
  
-#### MODULES ####+<code> 
 +[root@redhat9 ~]tuned-adm off
  
-module(load="imuxsock"   provides support for local system logging (e.g. via logger command) +[root@redhat9 ~]tuned-adm active 
-       SysSock.Use="off") # Turn off message reception via local log socket;  +No current active profile
-   # local messages are retrieved through imjournal now. +</code>
-module(load="imjournal"     # provides access to the systemd journal +
-       StateFile="imjournal.state") # File to store the position in the journal +
-#module(load="imklog") # reads kernel messages (the same are read from journald) +
-#module(load="immark") # provides --MARK-- message capability+
  
-# Provides UDP syslog reception +Cette commande n'arrête pas le daemon **tuned** :
-# for parameters see http://www.rsyslog.com/doc/imudp.html +
-#module(load="imudp") # needs to be done just once +
-#input(type="imudp" port="514")+
  
-# Provides TCP syslog reception +<code> 
-for parameters see http://www.rsyslog.com/doc/imtcp.html +[root@redhat9 ~]systemctl status tuned 
-#module(load="imtcp"# needs to be done just once +● tuned.service - Dynamic System Tuning Daemon 
-#input(type="imtcp" port="514")+     Loadedloaded (/usr/lib/systemd/system/tuned.service; enabled; preset: enabled) 
 +     Active: active (runningsince Tue 2024-10-22 16:13:46 CEST; 1h 7min ago 
 +       Docs: man:tuned(8) 
 +             man:tuned.conf(5) 
 +             man:tuned-adm(8) 
 +   Main PID: 3060 (tuned) 
 +      Tasks: 2 (limit: 48800) 
 +     Memory: 17.0M 
 +        CPU: 2.028s 
 +     CGroup: /system.slice/tuned.service 
 +             └─3060 /usr/bin/python3 -Es /usr/sbin/tuned -l -P
  
-#### GLOBAL DIRECTIVES ####+Oct 22 16:13:45 redhat9.ittraining.loc systemd[1]: Starting Dynamic System Tuning Daemon... 
 +Oct 22 16:13:46 redhat9.ittraining.loc systemd[1]: Started Dynamic System Tuning Daemon. 
 +</code>
  
-# Where to place auxiliary files +Notez que la valeur de **vm.spappiness** a été modifiée :
-global(workDirectory="/var/lib/rsyslog")+
  
-Use default timestamp format +<code> 
-module(load="builtin:omfile" Template="RSYSLOG_TraditionalFileFormat")+[root@redhat9 ~]sysctl vm.swappiness 
 +vm.swappiness 60 
 +</code>
  
-# Include all config files in /etc/rsyslog.d/ +Pour activer l'optimisation de la performance de nouveau, utilisez la sous commande **profile** de la commande **tuned-adm** avec le profil voulu :
-include(file="/etc/rsyslog.d/*.conf" mode="optional")+
  
-#### RULES ####+<code> 
 +[root@redhat9 ~]tuned-adm profile throughput-performance
  
-Log all kernel messages to the console. +[root@redhat9 ~]tuned-adm active 
-# Logging much else clutters up the screen. +Current active profile: throughput-performance 
-#kern.*                                                 /dev/console+<code>
  
-# Log anything (except mail) of level info or higher. +Dernièrement, arrêtez le daemon **tuned** :
-# Don't log private authentication messages! +
-*.info;mail.none;authpriv.none;cron.none                /var/log/messages+
  
-The authpriv file has restricted access. +<code> 
-authpriv.*                                              /var/log/secure+[root@redhat9 ~]systemctl disable --now tuned 
 +Removed "/etc/systemd/system/multi-user.target.wants/tuned.service".
  
-Log all the mail messages in one place+[root@redhat9 ~]systemctl status tuned 
-mail.*                                                  -/var/log/maillog+○ tuned.service - Dynamic System Tuning Daemon 
 +     Loaded: loaded (/usr/lib/systemd/system/tuned.service; disabled; preset: enabled) 
 +     Active: inactive (dead) since Tue 2024-10-22 17:29:32 CEST; 10s ago 
 +   Duration: 1h 15min 46.019s 
 +       Docs: man:tuned(8) 
 +             man:tuned.conf(5) 
 +             man:tuned-adm(8) 
 +    Process: 3060 ExecStart=/usr/sbin/tuned -l -P (code=exited, status=0/SUCCESS) 
 +   Main PID: 3060 (code=exited, status=0/SUCCESS) 
 +        CPU: 2.233s
  
 +Oct 22 16:13:45 redhat9.ittraining.loc systemd[1]: Starting Dynamic System Tuning Daemon...
 +Oct 22 16:13:46 redhat9.ittraining.loc systemd[1]: Started Dynamic System Tuning Daemon.
 +Oct 22 17:29:32 redhat9.ittraining.loc systemd[1]: Stopping Dynamic System Tuning Daemon...
 +Oct 22 17:29:32 redhat9.ittraining.loc systemd[1]: tuned.service: Deactivated successfully.
 +Oct 22 17:29:32 redhat9.ittraining.loc systemd[1]: Stopped Dynamic System Tuning Daemon.
 +Oct 22 17:29:32 redhat9.ittraining.loc systemd[1]: tuned.service: Consumed 2.233s CPU time.
 +</code>
  
-Log cron stuff +=====LAB #3 - La commande sysctl=====
-cron.*                                                  /var/log/cron+
  
-# Everybody gets emergency messages +====3.1 - Répertoire /proc====
-*.emerg                                                 :omusrmsg:*+
  
-# Save news errors of level crit and higher in a special file. +Le répertoire /proc contient des fichiers et des répertoires virtuelsLe contenu de ces fichiers est créé dynamiquement lors de la consultationSeul root peut consulter la totalité des informations dans le répertoire /proc.
-uucp,news.crit                                          /var/log/spooler+
  
-Save boot messages also to boot.log +<code> 
-local7.*                                                /var/log/boot.log+[root@redhat9 ~]ls /proc 
 +1     14    1665  1749  1766  2060  2841  412  437  45   53   565  640    743    77112  77902  78649  788    906         buddyinfo  dynamic_debug  keys         modules       stat           vmstat 
 +10    15    1671  1752  1767  2081  29    413  438  454  530  566  655    74421  772    78     78658  78858  93          bus        execdomains    key-users    mounts        swaps          zoneinfo 
 +1036  16    1678  1753  18    21    3     415  439  46   537  567  69     749    773    78005  78666  789    94          cgroups    fb             kmsg         mtrr          sys 
 +12    1626  1694  1754  1887  22    30    42   44   47   54   568  71040  75     774    781    78668  79     965         cmdline    filesystems    kpagecgroup  net           sysrq-trigger 
 +1240  1628  1695  1755  2     23    32    43   440  48   55   569  736    751    77563  78139  78671  8      977         consoles   fs             kpagecount   pagetypeinfo  sysvipc 
 +1266  1629  1696  1756  20    239   33    430  441  49   56   57   737    76     77578  78281  78694  816    980         cpuinfo    interrupts     kpageflags   partitions    thread-self 
 +1279  1631  17    1757  2015  24    34    431  442  491  560  58   738    76099  776    78387  787    818    983         crypto     iomem          loadavg      schedstat     timer_list 
 +1280  1632  1725  1758  2038  241   35    432  443  5    561  59   739    76245  777    784    78703  88     987         devices    ioports        locks        scsi          tty 
 +1281  1633  1741  1759  2042  243   36    433  444  50   562  6    740    76815  77759  785    78731  883    acpi        diskstats  irq            mdstat       self          uptime 
 +1282  1641  1743  1764  2053  27    38    435  445  51   563  61   741    77     778    78517  78735  903    asound      dma        kallsyms       meminfo      slabinfo      version 
 +13    1660  1747  1765  2055  28    4     436  446  52   564  63   742    77012  779    786    78760  905    bootconfig  driver     kcore          misc         softirqs      vmallocinfo 
 +</code> 
 + 
 +===Fichiers=== 
 + 
 +==Processeur== 
 + 
 +<code> 
 +[root@redhat9 ~]# cat /proc/cpuinfo 
 +processor       : 0 
 +vendor_id       : GenuineIntel 
 +cpu family      : 6 
 +model           : 86 
 +model name      : Intel(R) Xeon(R) CPU D-1541 @ 2.10GHz 
 +stepping        : 3 
 +microcode       : 0x700001c 
 +cpu MHz         : 2099.998 
 +cache size      : 16384 KB 
 +physical id     : 0 
 +siblings        : 2 
 +core id         : 0 
 +cpu cores       : 2 
 +apicid          : 0 
 +initial apicid  : 0 
 +fpu             : yes 
 +fpu_exception   : yes 
 +cpuid level     : 20 
 +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 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault pti ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt arat vnmi umip md_clear arch_capabilities 
 +vmx flags       : vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid shadow_vmcs pml 
 +bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa mmio_stale_data 
 +bogomips        : 4199.99 
 +clflush size    : 64 
 +cache_alignment : 64 
 +address sizes   : 46 bits physical, 48 bits virtual 
 +power management: 
 + 
 +processor       : 1 
 +vendor_id       : GenuineIntel 
 +cpu family      : 6 
 +model           : 86 
 +model name      : Intel(R) Xeon(R) CPU D-1541 @ 2.10GHz 
 +stepping        : 3 
 +microcode       : 0x700001c 
 +cpu MHz         : 2099.998 
 +cache size      : 16384 KB 
 +physical id     : 0 
 +siblings        : 2 
 +core id         : 1 
 +cpu cores       : 2 
 +apicid          : 1 
 +initial apicid  : 1 
 +fpu             : yes 
 +fpu_exception   : yes 
 +cpuid level     : 20 
 +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 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault pti ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt arat vnmi umip md_clear arch_capabilities 
 +vmx flags       : vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid shadow_vmcs pml 
 +bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa mmio_stale_data 
 +bogomips        : 4199.99 
 +clflush size    : 64 
 +cache_alignment : 64 
 +address sizes   : 46 bits physical, 48 bits virtual 
 +power management:
  
 +processor       : 2
 +vendor_id       : GenuineIntel
 +cpu family      : 6
 +model           : 86
 +model name      : Intel(R) Xeon(R) CPU D-1541 @ 2.10GHz
 +stepping        : 3
 +microcode       : 0x700001c
 +cpu MHz         : 2099.998
 +cache size      : 16384 KB
 +physical id     : 1
 +siblings        : 2
 +core id         : 0
 +cpu cores       : 2
 +apicid          : 2
 +initial apicid  : 2
 +fpu             : yes
 +fpu_exception   : yes
 +cpuid level     : 20
 +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 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault pti ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt arat vnmi umip md_clear arch_capabilities
 +vmx flags       : vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid shadow_vmcs pml
 +bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa mmio_stale_data
 +bogomips        : 4199.99
 +clflush size    : 64
 +cache_alignment : 64
 +address sizes   : 46 bits physical, 48 bits virtual
 +power management:
  
-# ### sample forwarding rule ### +processor       : 3 
-#action(type="omfwd"   +vendor_id       : GenuineIntel 
-# An on-disk queue is created for this actionIf the remote host is +cpu family      : 6 
-# down, messages are spooled to disk and sent when it is up again. +model           : 86 
-#queue.filename="fwdRule1"       # unique name prefix for spool files +model name      : Intel(R) Xeon(R) CPU D-1541 @ 2.10GHz 
-#queue.maxdiskspace="1g"         # 1gb space limit (use as much as possible) +stepping        : 3 
-#queue.saveonshutdown="on"       # save messages to disk on shutdown +microcode       : 0x700001c 
-#queue.type="LinkedList"         # run asynchronously +cpu MHz         : 2099.998 
-#action.resumeRetryCount="-1"    # infinite retries if host is down +cache size      : 16384 KB 
-# Remote Logging (we use TCP for reliable delivery) +physical id     : 1 
-# remote_host isname/ipe.g. 192.168.0.1, port optional e.g. 10514 +siblings        : 2 
-#Target="remote_host" Port="XXX" Protocol="tcp")+core id         : 1 
 +cpu cores       : 2 
 +apicid          : 3 
 +initial apicid  : 3 
 +fpu             : yes 
 +fpu_exception   : yes 
 +cpuid level     : 20 
 +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 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault pti ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt arat vnmi umip md_clear arch_capabilities 
 +vmx flags       : vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid shadow_vmcs pml 
 +bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa mmio_stale_data 
 +bogomips        : 4199.99 
 +clflush size    : 64 
 +cache_alignment : 64 
 +address sizes   46 bits physical48 bits virtual 
 +power management:
 </code> </code>
  
-Ce fichier est divisé en 3 parties :+==Interruptions système==
  
-  * **Modules**, +<code> 
-    * Section traitant le chargement des modules offrant des fonctionnalités étendues à rsyslog, +[root@redhat9 ~]# cat /proc/interrupts 
-  * **Directives Globales** (//Global Directives//), +           CPU0       CPU1       CPU2       CPU3        
-    * Section traitant les options de comportement global du service rsyslog, +  0:         17          0          0          0   IO-APIC   2-edge      timer 
-  * **Règles** (//Rules//), +  1:          9          0          0          0   IO-APIC   1-edge      i8042 
-    * Section traitant les règles de configuration des journauxLes règles au format syslogd gardent le même formatLes nouvelles règles, compatibles seulement avec rsyslog commencent par **module**.+  8:          0          1          0          0   IO-APIC   8-edge      rtc0 
 +  9:          0          0          0          0   IO-APIC   9-fasteoi   acpi 
 + 10:          0          0          0      38837   IO-APIC  10-fasteoi   virtio0 
 + 11:          0          4         34          0   IO-APIC  11-fasteoi   uhci_hcd:usb1 
 + 12:          0          0          0         15   IO-APIC  12-edge      i8042 
 + 14:          0          0          0          0   IO-APIC  14-edge      ata_piix 
 + 15:      62589       4004       7903         10   IO-APIC  15-edge      ata_piix 
 + 24:          0          0          0          0  PCI-MSIX-0000:01:01.0   0-edge      virtio2-config 
 + 25:          0          0          0          0  PCI-MSIX-0000:01:01.0   1-edge      virtio2-control 
 + 26:          0          0          0          0  PCI-MSIX-0000:01:01.0   2-edge      virtio2-event 
 + 27:      15543          0          0          0  PCI-MSIX-0000:01:01.0   3-edge      virtio2-request 
 + 28:          0      10483          0          0  PCI-MSIX-0000:01:01.0   4-edge      virtio2-request 
 + 29:          0          0      10676          0  PCI-MSIX-0000:01:01.0   5-edge      virtio2-request 
 + 30:          0          0          0       9038  PCI-MSIX-0000:01:01.0   6-edge      virtio2-request 
 + 31:          0          0          0          0  PCI-MSIX-0000:00:12.0   0-edge      virtio1-config 
 + 32:       1321       1262       2063        487  PCI-MSIX-0000:00:12.0   1-edge      virtio1-input.0 
 + 33:        343        545        647        440  PCI-MSIX-0000:00:12.0   2-edge      virtio1-output.0 
 + 34:         14         44        217          0  PCI-MSI-0000:00:07.0   0-edge      ahci[0000:00:07.0] 
 +NMI:          0          0          0          0   Non-maskable interrupts 
 +LOC:    1738095    1765200    1948991    1946686   Local timer interrupts 
 +SPU:          0          0          0          0   Spurious interrupts 
 +PMI:          0          0          0          0   Performance monitoring interrupts 
 +IWI:          2          2          0          0   IRQ work interrupts 
 +RTR:          0          0          0          0   APIC ICR read retries 
 +RES:      67302      65493      50955      48179   Rescheduling interrupts 
 +CAL:     614080     575676     556532     583017   Function call interrupts 
 +TLB:      27935      27127      25742      26719   TLB shootdowns 
 +TRM:          0          0          0          0   Thermal event interrupts 
 +THR:          0          0          0          0   Threshold APIC interrupts 
 +DFR:          0          0          0          0   Deferred Error APIC interrupts 
 +MCE:          0          0          0          0   Machine check exceptions 
 +MCP:        233        233        233        233   Machine check polls 
 +HYP:          1          1          1          1   Hypervisor callback interrupts 
 +ERR:          0 
 +MIS:          0 
 +PIN:          0          0          0          0   Posted-interrupt notification event 
 +NPI:          0          0          0          0   Nested posted-interrupt event 
 +PIW:          0          0          0          0   Posted-interrupt wakeup event 
 +</code>
  
-===Modules===+<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'attribution d'un IRQ à un périphérique doit être exclusive. Dans le cas où deux périphériques demandent un service en même temps, c'est le périphérique ayant l'IRQ le plus bas qui est prioritaire. 
 +</WRAP> 
  
-Depuis la version 3 de rsyslog, la réception des données par ce dernier appelée les **inputs** est gérée par l'utilisation de modules. Parmi les modules les plus fréquemment utilisés, on trouve :+==Canaux DMA==
  
-^ Module ^ Fonction ^ +<code> 
-| module(load="imuxsock" SysSock.Use="off") | Active la trace des messages locaux, per exemple de la commande **logger** | +[root@redhat9 ~]# cat /proc/dma 
-| module(load="imjournal" StateFile="imjournal.state") | Fournit un accès au journal **systemd** | + 4: cascade 
-| module(load="imklog") | Active la trace de messages du **noyau** | +</code>
-| module(load="immark") | Active la trace des messages de type **mark** | +
-| module(load="imudp") | Active la réception de messages en utilisant le protocole **UDP** | +
-| module(load="imtcp") | Active la réception de messages en utilisant le protocole **TCP** |+
  
-Dans le fichier **/etc/rsyslog.conf** nous pouvons constater que les inputs **module(load="imuxsock" SysSock.Use="off")** et **module(load="imjournal" StateFile="imjournal.state")** sont activés :+==Plages d'entrée/sortie==
  
-<file+<code
-... +[root@redhat9 ~]# cat /proc/ioports 
-#### MODULES ####+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:00:01.
 +    0170-0177 : ata_piix 
 +  01f0-01f7 : 0000:00:01.
 +    01f0-01f7 : ata_piix 
 +  0376-0376 : 0000:00:01.1 
 +    0376-0376 : ata_piix 
 +  03c0-03df : vga+ 
 +  03f6-03f6 : 0000:00:01.1 
 +    03f6-03f6 : ata_piix 
 +  0510-051b : QEMU0002:00 
 +    0510-051b : fw_cfg_io 
 +  0600-063f : 0000:00:01.3 
 +    0600-0603 : ACPI PM1a_EVT_BLK 
 +    0604-0605 : ACPI PM1a_CNT_BLK 
 +    0608-060b : ACPI PM_TMR 
 +  0700-070f : 0000:00:01.3 
 +    0700-0708 : piix4_smbus 
 +0cf8-0cff : PCI conf1 
 +0d00-ffff : PCI Bus 0000:00 
 +  afe0-afe3 : ACPI GPE0_BLK 
 +  c000-cfff : PCI Bus 0000:03 
 +  d000-dfff : PCI Bus 0000:02 
 +  e000-efff : PCI Bus 0000:01 
 +    e000-e03f : 0000:01:01.0 
 +  f000-f03f : 0000:00:03.0 
 +  f040-f05f : 0000:00:01.2 
 +    f040-f05f : uhci_hcd 
 +  f060-f07f : 0000:00:07.0 
 +    f060-f07f : ahci 
 +  f080-f09f : 0000:00:12.0 
 +  f0a0-f0af : 0000:00:01.1 
 +    f0a0-f0af : ata_piix 
 +</code>
  
-module(load="imuxsock"   # provides support for local system logging (e.g. via logger command) +<WRAP center round alert 60%> 
-       SysSock.Use="off") # Turn off message reception via local log socket;  +**Important** - Si deux périphériques ont le même port, les **deux** périphériques seront inutilisables
-   # local messages are retrieved through imjournal now. +</WRAP>
-module(load="imjournal"     # provides access to the systemd journal +
-       StateFile="imjournal.state") # File to store the position in the journal +
-#module(load="imklog") # reads kernel messages (the same are read from journald) +
-#module(load="immark") # provides --MARK-- message capability+
  
-# Provides UDP syslog reception +==Périphériques==
-# for parameters see http://www.rsyslog.com/doc/imudp.html +
-#module(load="imudp") # needs to be done just once +
-#input(type="imudp" port="514")+
  
-# Provides TCP syslog reception +<code> 
-for parameters see http://www.rsyslog.com/doc/imtcp.html +[root@redhat9 ~]cat /proc/devices 
-#module(load="imtcp") # needs to be done just once +Character devices: 
-#input(type="imtcp" port="514") +  1 mem 
-... +  4 /dev/vc/
-</file>+  4 tty 
 +  4 ttyS 
 +  5 /dev/tty 
 +  5 /dev/console 
 +  5 /dev/ptmx 
 +  7 vcs 
 + 10 misc 
 + 13 input 
 + 14 sound 
 + 21 sg 
 + 29 fb 
 +116 alsa 
 +128 ptm 
 +136 pts 
 +180 usb 
 +188 ttyUSB 
 +189 usb_device 
 +202 cpu/msr 
 +203 cpu/cpuid 
 +226 drm 
 +242 hidraw 
 +243 ttyDBC 
 +244 usbmon 
 +245 wwan_port 
 +246 bsg 
 +247 watchdog 
 +248 ptp 
 +249 pps 
 +250 rtc 
 +251 dma_heap 
 +252 dax 
 +253 tpm 
 +254 gpiochip
  
-Pour activer la réception de messages à partir de serveurs rsyslog distants en utilisant le protocole **UDP**, il convient de décommenter les directives de chargement de modules dans le fichier **/etc/rsyslog.conf** et de re-démarrer le service :+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 
 +</code>
  
-<file> +==Modules==
-... +
-# Provides UDP syslog reception +
-# for parameters see http://www.rsyslog.com/doc/imudp.html +
-module(load="imudp") # needs to be done just once +
-input(type="imudp" port="514")+
  
-Provides TCP syslog reception +<code> 
-for parameters see http://www.rsyslog.com/doc/imtcp.html +[root@redhat9 ~]cat /proc/modules | more 
-module(load="imtcp") # needs to be done just once +tls 159744 0 - Live 0xffffffffc0d1a000 
-input(type="imtcp" port="514") +snd_seq_dummy 16384 0 - Live 0xffffffffc0d15000 
-... +snd_hrtimer 16384 1 - Live 0xffffffffc0d10000 
-</file>+snd_seq 131072 7 snd_seq_dummy, Live 0xffffffffc0cef000 
 +snd_timer 53248 2 snd_hrtimer,snd_seq, Live 0xffffffffc0ce1000 
 +snd_seq_device 16384 1 snd_seq, Live 0xffffffffc0b6d000 
 +snd 147456 5 snd_seq,snd_timer,snd_seq_device, Live 0xffffffffc0cbc000 
 +soundcore 16384 1 snd, Live 0xffffffffc0b68000 
 +nft_fib_inet 16384 1 - Live 0xffffffffc0b63000 
 +nft_fib_ipv4 16384 1 nft_fib_inet, Live 0xffffffffc0b5e000 
 +nft_fib_ipv6 16384 1 nft_fib_inet, Live 0xffffffffc0b59000 
 +nft_fib 16384 3 nft_fib_inet,nft_fib_ipv4,nft_fib_ipv6, Live 0xffffffffc0b54000 
 +nft_reject_inet 16384 6 - Live 0xffffffffc0b4f000 
 +nf_reject_ipv4 16384 1 nft_reject_inet, Live 0xffffffffc0b4a000 
 +nf_reject_ipv6 24576 1 nft_reject_inet, Live 0xffffffffc0b43000 
 +nft_reject 16384 1 nft_reject_inet, Live 0xffffffffc0b3e000 
 +nft_ct 24576 7 - Live 0xffffffffc0b32000 
 +nft_chain_nat 16384 3 - Live 0xffffffffc0b39000 
 +nf_nat 61440 1 nft_chain_nat, Live 0xffffffffc0b22000 
 +nf_conntrack 217088 2 nft_ct,nf_nat, Live 0xffffffffc0aec000 
 +nf_defrag_ipv6 24576 1 nf_conntrack, Live 0xffffffffc0ae5000 
 +nf_defrag_ipv4 16384 1 nf_conntrack, Live 0xffffffffc0ae0000 
 +ip_set 69632 0 - Live 0xffffffffc0ace000 
 +rfkill 40960 3 - Live 0xffffffffc0ac3000 
 +nf_tables 356352 194 nft_fib_inet,nft_fib_ipv4,nft_fib_ipv6,nft_fib,nft_reject_inet,nft_reject,nft_ct,nft_chain_nat, Live 0xffffffffc0a6b000 
 +nfnetlink 20480 3 ip_set,nf_tables, Live 0xffffffffc0a65000 
 +qrtr 57344 4 - Live 0xffffffffc0a56000 
 +intel_rapl_msr 20480 0 - Live 0xffffffffc0a50000 
 +intel_rapl_common 45056 1 intel_rapl_msr, Live 0xffffffffc0a44000 
 +intel_uncore_frequency_common 16384 0 - Live 0xffffffffc0a3f000 
 +kvm_intel 442368 0 - Live 0xffffffffc09d2000 
 +kvm 1335296 1 kvm_intel, Live 0xffffffffc0b75000 
 +irqbypass 16384 1 kvm, Live 0xffffffffc09cd000 
 +rapl 28672 0 - Live 0xffffffffc09c5000 
 +i2c_piix4 32768 0 - Live 0xffffffffc09bc000 
 +pcspkr 16384 0 - Live 0xffffffffc09b7000 
 +virtio_balloon 28672 0 - Live 0xffffffffc0738000 
 +joydev 28672 0 - Live 0xffffffffc0730000 
 +xfs 2510848 2 - Live 0xffffffffc0751000 
 +libcrc32c 16384 4 nf_nat,nf_conntrack,nf_tables,xfs, Live 0xffffffffc062e000 
 +sr_mod 28672 0 - Live 0xffffffffc06c9000 
 +cdrom 90112 1 sr_mod, Live 0xffffffffc0719000 
 +ata_generic 16384 0 - Live 0xffffffffc0714000 
 +bochs 20480 1 - Live 0xffffffffc070e000 
 +drm_vram_helper 28672 1 bochs, Live 0xffffffffc065a000 
 +drm_kms_helper 245760 4 bochs,drm_vram_helper, Live 0xffffffffc06d1000 
 +syscopyarea 16384 1 drm_kms_helper, Live 0xffffffffc06a0000 
 +sysfillrect 16384 1 drm_kms_helper, Live 0xffffffffc063b000 
 +sysimgblt 16384 1 drm_kms_helper, Live 0xffffffffc06c4000 
 +ata_piix 45056 0 - Live 0xffffffffc06b8000 
 +crct10dif_pclmul 16384 1 - Live 0xffffffffc068c000 
 +fb_sys_fops 16384 1 drm_kms_helper, Live 0xffffffffc0687000 
 +drm_ttm_helper 16384 2 bochs,drm_vram_helper, Live 0xffffffffc0662000 
 +sd_mod 90112 3 - Live 0xffffffffc0643000 
 +crc32_pclmul 16384 0 - Live 0xffffffffc0636000 
 +--More-- 
 +</code> 
 + 
 +==Statistiques de l'utilisation  des disques== 
 + 
 +<code> 
 +[root@redhat9 ~]cat /proc/diskstats 
 +         0 sda 12891 22 1479190 82788 33822 7112 515452 2413166 0 755754 2603390 0 0 0 0 8759 107434 
 +         1 sda1 430 0 105265 1446 19 5 4262 717 0 1628 2164 0 0 0 0 0 0 
 +         2 sda2 12354 22 1370381 81094 33799 7107 511190 2412402 0 754752 2493497 0 0 0 0 0 0 
 +        16 sdb 105 0 4200 91 0 0 0 0 0 98 91 0 0 0 0 0 0 
 +  11       0 sr0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
 + 253       0 dm-0 12081 0 1360949 77456 40903 0 511190 3227414 0 756384 3304870 0 0 0 0 0 0 
 + 253       1 dm-1 98 0 4440 33 0 0 0 0 0 36 33 0 0 0 0 0 0 
 +</code> 
 + 
 +==Partitions== 
 + 
 +<code> 
 +[root@redhat9 ~]# cat /proc/partitions 
 +major minor  #blocks  name 
 + 
 +          0   52428800 sda 
 +          1    1048576 sda1 
 +          2   51379200 sda2 
 +         16   33554432 sdb 
 +  11        0    1048575 sr0 
 + 253        0   46133248 dm-0 
 + 253        1    5242880 dm-1 
 +</code> 
 + 
 +==Espaces de pagination== 
 + 
 +<code> 
 +[root@redhat9 ~]# cat /proc/swaps 
 +Filename                                Type            Size            Used            Priority 
 +/dev/dm-1                               partition       5242876                       -2 
 +</code> 
 + 
 +==Statistiques d'utilisation du processeur== 
 + 
 +<code> 
 +[root@redhat9 ~]# cat /proc/loadavg 
 +0.00 0.00 0.00 1/517 78961 
 +</code> 
 + 
 +==Statistiques d'utilisation de la mémoire== 
 + 
 +<code> 
 +[root@redhat9 ~]# cat /proc/meminfo 
 +MemTotal       7869556 kB 
 +MemFree:         6410452 kB 
 +MemAvailable:    6909420 kB 
 +Buffers:            2780 kB 
 +Cached:           742672 kB 
 +SwapCached:            0 kB 
 +Active:           811444 kB 
 +Inactive:         400224 kB 
 +Active(anon):     519616 kB 
 +Inactive(anon):        0 kB 
 +Active(file):     291828 kB 
 +Inactive(file):   400224 kB 
 +Unevictable:           0 kB 
 +Mlocked:               0 kB 
 +SwapTotal:       5242876 kB 
 +SwapFree:        5242876 kB 
 +Zswap:                 0 kB 
 +Zswapped:              0 kB 
 +Dirty:                 0 kB 
 +Writeback:             0 kB 
 +AnonPages:        457680 kB 
 +Mapped:           202528 kB 
 +Shmem:             53400 kB 
 +KReclaimable:      55616 kB 
 +Slab:             114992 kB 
 +SReclaimable:      55616 kB 
 +SUnreclaim:        59376 kB 
 +KernelStack:        8304 kB 
 +PageTables:        10960 kB 
 +SecPageTables:         0 kB 
 +NFS_Unstable:          0 kB 
 +Bounce:                0 kB 
 +WritebackTmp:          0 kB 
 +CommitLimit:     9177652 kB 
 +Committed_AS:    3436284 kB 
 +VmallocTotal:   34359738367 kB 
 +VmallocUsed:       27556 kB 
 +VmallocChunk:          0 kB 
 +Percpu:             1920 kB 
 +HardwareCorrupted:     0 kB 
 +AnonHugePages:    237568 kB 
 +ShmemHugePages:        0 kB 
 +ShmemPmdMapped:        0 kB 
 +FileHugePages:         0 kB 
 +FilePmdMapped:         0 kB 
 +CmaTotal:              0 kB 
 +CmaFree:               0 kB 
 +Unaccepted:            0 kB 
 +HugePages_Total:       0 
 +HugePages_Free:        0 
 +HugePages_Rsvd:        0 
 +HugePages_Surp:        0 
 +Hugepagesize:       2048 kB 
 +Hugetlb:               0 kB 
 +DirectMap4k:      145256 kB 
 +DirectMap2M:     6146048 kB 
 +DirectMap1G:     4194304 kB 
 +</code> 
 + 
 +==Version du noyau== 
 + 
 +<code> 
 +[root@redhat9 ~]# cat /proc/version 
 +Linux version 5.14.0-427.37.1.el9_4.x86_64 (mockbuild@x86-64-02.build.eng.rdu2.redhat.com) (gcc (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3), GNU ld version 2.35.2-43.el9) #1 SMP PREEMPT_DYNAMIC Fri Sep 13 12:41:50 EDT 2024 
 +</code> 
 + 
 +===Répertoires=== 
 + 
 +==ide/scsi== 
 + 
 +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'énérgie, les températures, les vitesses de ventilateurs, la charge des batteries. 
 + 
 +==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 > /proc/sys/net/ipv4/icmp_echo_ignore_all [Entrée] 
 + 
 +Cette commande a pour résultat d'ignorer les reqûetes ping. 
 + 
 +====3.2 - Utilisation de la Commande sysctl==== 
 + 
 +Les fichiers dans le répertoire **/proc/sys** peuvent être administrés par la commande **sysctl** en temps réel.  
 + 
 +La commande **sysctl** applique les règles consignés dans le fichier **/etc/sysctl.conf** au démarrage de la machine. 
 + 
 +Saisissez la commande : 
 + 
 +<code> 
 +[root@redhat9 ~]# cat /etc/sysctl.conf 
 +# sysctl settings are defined through files in 
 +# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/
 +
 +# Vendors settings live in /usr/lib/sysctl.d/
 +# To override a whole file, create a new file with the same in 
 +# /etc/sysctl.d/ and put new settings there. To override 
 +# only specific settings, add a file with a lexically later 
 +# name in /etc/sysctl.d/ and put new settings there. 
 +
 +# For more information, see sysctl.conf(5) and sysctl.d(5). 
 + 
 +[root@redhat9 ~]# ls -l /etc/sysctl.d/ 
 +total 0 
 +lrwxrwxrwx. 1 root root 14 Jul 18 13:00 99-sysctl.conf -> ../sysctl.conf 
 + 
 +[root@redhat9 ~]# ls -l /usr/lib/sysctl.d/ 
 +total 28 
 +-rw-r--r--. 1 root root 1810 Dec 11  2023 10-default-yama-scope.conf 
 +-rw-r--r--. 1 root root 1816 Jul 18 13:00 50-coredump.conf 
 +-rw-r--r--. 1 root root 1919 Oct 31  2022 50-default.conf 
 +-rw-r--r--. 1 root root  246 Dec  7  2023 50-libkcapi-optmem_max.conf 
 +-rw-r--r--. 1 root root  635 Oct 31  2022 50-pid-max.conf 
 +-rw-r--r--. 1 root root  203 Apr 24 13:50 50-redhat.conf 
 +-rw-r--r--. 1 root root  387 Oct 31  2022 README 
 + 
 +[root@redhat9 ~]# cat /usr/lib/sysctl.d/50-default.conf  
 +#  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. /etc/sysctl.d/90-override.conf), and put any assignments 
 +# there. 
 + 
 +# System Request functionality of the kernel (SYNC) 
 +
 +# Use kernel.sysrq 1 to allow all keys. 
 +# See https://docs.kernel.org/admin-guide/sysrq.html for a list 
 +# of values and keys. 
 +kernel.sysrq = 16 
 + 
 +# Append the PID to the core filename 
 +kernel.core_uses_pid = 1 
 + 
 +# Source route verification 
 +net.ipv4.conf.default.rp_filter = 2 
 +net.ipv4.conf.*.rp_filter = 2 
 +-net.ipv4.conf.all.rp_filter 
 + 
 +# Do not accept source routing 
 +net.ipv4.conf.default.accept_source_route = 0 
 +net.ipv4.conf.*.accept_source_route = 0 
 +-net.ipv4.conf.all.accept_source_route 
 + 
 +# Promote secondary addresses when the primary address is removed 
 +net.ipv4.conf.default.promote_secondaries = 1 
 +net.ipv4.conf.*.promote_secondaries = 1 
 +-net.ipv4.conf.all.promote_secondaries 
 + 
 +# ping(8without CAP_NET_ADMIN and CAP_NET_RAW 
 +The upper limit is set to 2^31-1. Values greater than that get rejected by 
 +# the kernel because of this definition in linux/include/net/ping.h: 
 +#   #define GID_T_MAX (((gid_t)~0U) >> 1) 
 +# That's not so bad because values between 2^31 and 2^32-1 are reserved on 
 +# systemd-based systems anyway: https://systemd.io/UIDS-GIDS#summary 
 +-net.ipv4.ping_group_range 0 2147483647 
 + 
 +# 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 
 + 
 +# Enable regular file and FIFO protection 
 +fs.protected_regular = 1 
 +fs.protected_fifos = 1 
 +</code> 
 + 
 +Les options de la commande **sysctl** sont : 
 + 
 +<code> 
 +[root@redhat9 ~]# sysctl --help 
 + 
 +Usage: 
 + sysctl [options] [variable[=value] ...] 
 + 
 +Options: 
 +  -a, --all            display all variables 
 +  -A                   alias of -a 
 +  -X                   alias of -a 
 +      --deprecated     include deprecated parameters to listing 
 +      --dry-run        Print the key and values but do not write 
 +  -b, --binary         print value without new line 
 +  -e, --ignore         ignore unknown variables errors 
 +  -N, --names          print variable names without values 
 +  -n, --values         print only values of the given variable(s) 
 +  -p, --load[=<file>]  read values from file 
 +  -f                   alias of -p 
 +      --system         read values from all system directories 
 +  -r, --pattern <expression> 
 +                       select setting that match expression 
 +  -q, --quiet          do not echo variable set 
 +  -w, --write          enable writing a value to variable 
 +  -o                   does nothing 
 +  -x                   does nothing 
 +  -d                   alias of -h 
 + 
 + -h, --help     display this help and exit 
 + -V, --version  output version information and exit 
 + 
 +For more details see sysctl(8). 
 +</code>
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important** : Les deux directives **module(load="imudp")** et **input(type="imudp" port="514")** crée un ** Écouteur** sur le port UDP/514 tandis que les deux directives **module(load="imtcp")** et **input(type="imtcp" port="514")** crée un Écouteur sur le port TCP/514. Le port 514 est le port standard pour les Écouteurs de rsyslog. Cependant il est possible de modifier le numéro du port.+**Important** : Consultez la page de la traduction du manuel de **sysctl** **[[http://www.delafond.org/traducmanfr/man/man8/sysctl.8.html|ici]]** pour comprendre la commande.
 </WRAP> </WRAP>
  
-Pour envoyer l'ensemble des traces de journalisation vers un serveur rsyslog distant, il convient de décommenter et modifier une ligne dans la section suivante du fichier **/etc/rsyslog.conf** :+=====LAB#4 - Interprétation des informations dans /proc=====
  
-<file> +Les informations brutes stockées dans /proc peuvent être interprétées grâce à l'utilisation des commandes dites de //gestion des performances// : 
-... + 
-# ### sample forwarding rule ### +  * free, 
-#action(type="omfwd"   +  * uptime et w, 
-An on-disk queue is created for this action. If the remote host is +  * iostat, 
-# downmessages are spooled to disk and sent when it is up again+  * hdparm, 
-#queue.filename="fwdRule1"       unique name prefix for spool files +  * vmstat, 
-#queue.maxdiskspace="1g"         1gb space limit (use as much as possible+  * mpstat, 
-#queue.saveonshutdown="on"       # save messages to disk on shutdown +  * sar. 
-#queue.type="LinkedList"         run asynchronously + 
-#action.resumeRetryCount="-1   # infinite retries if host is down +====4.1 - La Commande free==== 
-# Remote Logging (we use TCP for reliable delivery+ 
-# remote_host isname/ipe.g192.168.0.1, port optional e.g10514 +La commande **free** permet de donner l’état de la mémoire totale, libre, partagée, swap et bufferiséeSaisissez donc la commande suivante : 
-Target="remote_host" Port="514" Protocol="tcp") + 
-... +<code> 
-</file>+[root@redhat9 ~]free -m 
 +               total        used        free      shared  buff/cache   available 
 +Mem:            7685         948        6249          52         782        6736 
 +Swap:           5119                  5119 
 +</code> 
 + 
 +Dans le cas de cet exemple, nous pouvons constater que l’affichage montre : 
 + 
 +  * 7685 Mo de mémoire physique totale, 
 +  * 948 Mo de mémoire physique utilisée et 6249 Mo de mémoire physique libre, 
 +  * 5119 Mo de mémoire swap totale et 0 Mo de swap utilisé 
 + 
 +Les options de cette commande sont : 
 + 
 +<code> 
 +[root@redhat9 ~]free --help 
 + 
 +Usage: 
 + free [options] 
 + 
 +Options: 
 + -b, --bytes         show output in bytes 
 +     --kilo          show output in kilobytes 
 +     --mega          show output in megabytes 
 +     --giga          show output in gigabytes 
 +     --tera          show output in terabytes 
 +     --peta          show output in petabytes 
 + -k, --kibi          show output in kibibytes 
 + -m, --mebi          show output in mebibytes 
 + -g, --gibi          show output in gibibytes 
 +     --tebi          show output in tebibytes 
 +     --pebi          show output in pebibytes 
 + -h, --human         show human-readable output 
 +     --si            use powers of 1000 not 1024 
 + -l, --lohi          show detailed low and high memory statistics 
 + -t, --total         show total for RAM + swap 
 + -s N, --seconds N   repeat printing every N seconds 
 + -c N, --count N     repeat printing N times, then exit 
 + -w, --wide          wide output 
 + 
 +     --help     display this help and exit 
 + -V--version  output version information and exit 
 + 
 +For more details see free(1)
 +</code> 
 + 
 +====4.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 : 
 + 
 +<code> 
 +[root@redhat9 ~]uptime 
 + 12:56:03 up 21:19,  1 user,  load average: 0.00, 0.00, 0.00 
 + 
 +[root@redhat9 ~]
 + 12:56:07 up 21:19,  1 user,  load average: 0.00, 0.00, 0.00 
 +USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT 
 +trainee  pts/0     12:40    6.00s  0.05s  0.02s sshd: trainee [priv] 
 +</code> 
 + 
 +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,48  4,00  3,85** ceci indiquerait que le processeur a du mal à traiter les processus mettant en moyenne : 
 + 
 +  * 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 : 
 + 
 +<code> 
 +[root@redhat9 ~]uptime --help 
 + 
 +Usage: 
 + uptime [options] 
 + 
 +Options: 
 + -p, --pretty   show uptime in pretty format 
 + -h, --help     display this help and exit 
 + -s, --since    system up since 
 + -V, --version  output version information and exit 
 + 
 +For more details see uptime(1)
 + 
 +[root@redhat9 ~]w --help 
 + 
 +Usage: 
 + w [options] 
 + 
 +Options: 
 + -h, --no-header     do not print header 
 + -u, --no-current    ignore current process username 
 + -s, --short         short format 
 + -f, --from          show remote hostname field 
 + -o, --old-style     old style output 
 + -i, --ip-addr       display IP address instead of hostname (if possible) 
 + 
 +     --help     display this help and exit 
 + -V, --version  output version information and exit 
 + 
 +For more details see w(1). 
 +</code> 
 + 
 +====4.3 - La Commande iostat==== 
 + 
 +La commande **iostat** affiche des statistiques sur l'utilisation des disques, des terminaux et des lecteurs de cartouche. Commencez par installer le paquet **sysstat** : 
 + 
 +<code> 
 +[root@redhat9 ~]dnf install sysstat -y 
 +</code> 
 + 
 +Exécutez ensuite la commande **iostat** :  
 + 
 +<code> 
 +[root@redhat9 ~]iostat 
 +Linux 5.14.0-427.37.1.el9_4.x86_64 (redhat9.ittraining.loc)     10/23/2024      _x86_64_        (4 CPU) 
 + 
 +avg-cpu:  %user   %nice %system %iowait  %steal   %idle 
 +           0.14    0.01    0.17    0.05    0.00   99.63 
 + 
 +Device             tps    kB_read/   kB_wrtn/   kB_dscd/   kB_read    kB_wrtn    kB_dscd 
 +dm-0              0.75         9.72         4.09         0.00     748282     315002          0 
 +dm-1              0.00         0.03         0.00         0.00       2220          0          0 
 +sda               0.66        10.49         4.12         0.00     807403     317133          0 
 +sdb               0.00         0.03         0.00         0.00       2100          0          0 
 +</code> 
 + 
 +Au-dessous de la première ligne indiquant la version du noyau du système et son nom d'hôte ainsi que la date actuelle, iostat affiche une vue d'ensemble de l'utilisation CPU moyenne du système depuis le dernier démarrage. Le rapport d'utilisation du CPU inclut les pourcentages suivants : 
 + 
 +  * **%user** - Pourcentage de temps passé en mode utilisateur (exécutant des applications, etc.
 +  * **%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'hyperviseur s'occupe d'un autre CPU virtuel. 
 +  * **%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'utilisation du CPU de la sortie de la commande **iostat** figure le rapport d'utilisation des périphériques. Ce dernier contient une ligne pour chaque périphérique disque du système et inclut les informations suivantes : 
 + 
 +  * 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èrementpour voir les statistiques étendues des disques, utilisez la commande suivante : 
 + 
 +<code> 
 +[root@redhat9 ~]# iostat -d -x 
 +Linux 5.14.0-427.37.1.el9_4.x86_64 (redhat9.ittraining.loc)     10/23/2024      _x86_64_        (4 CPU) 
 + 
 +Device            r/s     rkB/  rrqm/ %rrqm r_await rareq-sz     w/    wkB/  wrqm/ %wrqm w_await wareq-sz     d/    dkB/  drqm/ %drqm d_await dareq-sz     f/s f_await  aqu-sz  %util 
 +dm-0             0.19      9.72     0.00   0.00    6.27    50.38    0.56      4.09     0.00   0.00   80.87     7.36    0.00      0.00     0.00   0.00    0.00     0.00    0.00    0.00    0.05   1.01 
 +dm-1             0.00      0.03     0.00   0.00    0.34    22.65    0.00      0.00     0.00   0.00    0.00     0.00    0.00      0.00     0.00   0.00    0.00     0.00    0.00    0.00    0.00   0.00 
 +sda              0.20     10.48     0.00   0.14    6.29    51.55    0.46      4.12     0.10  17.25   73.40     8.94    0.00      0.00     0.00   0.00    0.00     0.00    0.12   12.27    0.04   1.01 
 +sdb              0.00      0.03     0.00   0.00    0.87    20.00    0.00      0.00     0.00   0.00    0.00     0.00    0.00      0.00     0.00   0.00    0.00     0.00    0.00    0.00    0.00   0.00 
 +</code> 
 + 
 +====4.4 - La Commande hdparm==== 
 + 
 +Pour surveiller la vitesse des entrées et des sorties du disquevous pouvez utiliser la commande **hdparm** : 
 + 
 +<code> 
 +[root@redhat9 ~]# hdparm -t /dev/sda 
 + 
 +/dev/sda: 
 + Timing buffered disk reads: 348 MB in  3.00 seconds = 115.91 MB/sec 
 +</code> 
 + 
 +====4.5 - La Commande vmstat==== 
 + 
 +La commande **vmstat** affiche des statistiques sur la mémoire, la pagination et la charge ponctuelle du processeur : 
 + 
 +<code> 
 +[root@redhat9 ~]# vmstat 1 10 
 +procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- 
 +  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st 
 +  0      0 6183436   2192 914452    0    0           33   51  0  0 100  0  0 
 +  0      0 6183436   2192 914492    0    0          158  238  0  0 100  0  0 
 +  0      0 6183436   2192 914492    0    0           90  151  0  0 100  0  0 
 +  0      0 6183436   2192 914492    0    0           87  144  0  0 100  0  0 
 +  0      0 6183436   2192 914492    0    0           99  156  0  0 100  0  0 
 +  0      0 6183436   2192 914492    0    0           99  159  0  0 100  0  0 
 +  0      0 6183436   2192 914492    0    0           92  152  0  0 100  0  0 
 +  0      0 6183436   2192 914492    0    0           93  156  0  0 100  0  0 
 +  0      0 6183436   2192 914492    0    0           92  156  0  0 100  0  0 
 +  0      0 6183436   2192 914492    0    0           88  150  0  0 100  0  0 
 +</code> 
 + 
 +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 statistiquesLa seconde ligne identifie de manière encore plus détaillée chacun des champs, permettant ainsi de parcourir simplement et rapidement l'ensemble des données lors de la recherche de statistiques spécifiques. 
 + 
 +Les champs relatifs aux processus sont les suivants : 
 + 
 +  * r — Le nombre de processus exécutables attendant d'avoir accès au CPU 
 +  * 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/Sorties (E/S) sont les suivants : 
 + 
 +  * 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'interruptions par seconde 
 +  * 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/
 + 
 +Les options de cette commande sont : 
 + 
 +<code> 
 +[root@redhat9 ~]# vmstat --help 
 + 
 +Usage: 
 + vmstat [options] [delay [count]] 
 + 
 +Options: 
 + -a, --active           active/inactive memory 
 + -f, --forks            number of forks since boot 
 + -m, --slabs            slabinfo 
 + -n, --one-header       do not redisplay header 
 + -s, --stats            event counter statistics 
 + -d, --disk             disk statistics 
 + -D, --disk-sum         summarize disk statistics 
 + -p, --partition <dev>  partition specific statistics 
 + -S, --unit <char>      define display unit 
 + -w, --wide             wide output 
 + -t, --timestamp        show timestamp 
 + 
 + -h, --help     display this help and exit 
 + -V, --version  output version information and exit 
 + 
 +For more details see vmstat(8)
 +</code>
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important** : Ces directives utilisent le protocole TCP. Le serveur distant doit donc être configuré pour ce mode de communication. La directive **Target="remote_host" Port="514" Protocol="tcp")** doit être modifiée pour indiquer l'adresse IP du serveur rsyslog distant.+**Important** : Par défaut la commande vmstat affiche des informations depuis le démarrage du système.
 </WRAP> </WRAP>
  
-===Directives Globales===+====4.6 - La Commande mpstat====
  
-Les directives dans cette section servent à configurer le comportement de rsyslog. Par exemple, nous pouvons constater la présence de la directive suivante :+La commande **mpstat** affiche des statistiques détaillées sur le CPU :
  
-<file+<code
-module(load="builtin:omfile" Template="RSYSLOG_TraditionalFileFormat") +[root@redhat9 ~]# mpstat 
-</file>+Linux 5.14.0-427.37.1.el9_4.x86_64 (redhat9.ittraining.loc    10/23/2024      _x86_64_        (4 CPU)
  
-Cette directive stipule que le format des entrées dans les fichiers de journalisation **ne doit pas** être au format d'horodatage étendu de rsyslog qui offre plus de précision que le format de syslog classique.+01:03:16 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle 
 +01:03:16 PM  all    0.14    0.01    0.12    0.05    0.04    0.02    0.00    0.00    0.00   99.63 
 +</code>
  
-===Règles===+Dans le cas où vous avez plusieurs processeurs ou coeurs, vous pouvez visualiser ces mêmes informations par unité de traitement :
  
-Chaque règle prend la forme suivante :+<code> 
 +[root@redhat9 ~]# mpstat -P ALL 
 +Linux 5.14.0-427.37.1.el9_4.x86_64 (redhat9.ittraining.loc)     10/23/2024      _x86_64_        (4 CPU)
  
-<file> +01:03:38 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle 
-Sélecteur[; ...]  [-] Action +01:03:38 PM  all    0.14    0.01    0.12    0.05    0.04    0.02    0.00    0.00    0.00   99.63 
-</file>+01:03:38 PM    0    0.13    0.00    0.12    0.05    0.04    0.02    0.00    0.00    0.00   99.64 
 +01:03:38 PM    1    0.14    0.01    0.12    0.04    0.03    0.01    0.00    0.00    0.00   99.65 
 +01:03:38 PM    2    0.14    0.01    0.12    0.05    0.04    0.02    0.00    0.00    0.00   99.62 
 +01:03:38 PM    3    0.14    0.01    0.12    0.06    0.04    0.02    0.00    0.00    0.00   99.62 
 +</code>
  
-Un Sélecteur est défini d'une des façons suivantes :+Pour afficher 5 jeux de statistiques à des intervales de 2 secondes pour tous les unités de traitement, il convient d'utiliser la commande suivante :
  
-==Sous-système applicatif.Priorité==+<code> 
 +[root@redhat9 ~]# mpstat -P ALL 2 5 
 +Linux 5.14.0-427.37.1.el9_4.x86_64 (redhat9.ittraining.loc)     10/23/2024      _x86_64_        (4 CPU)
  
-Dans ce cas on ne tient compte que des messages de priorité égale ou supérieure à la Priorité indiquée.+01:04:15 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle 
 +01:04:17 PM  all    0.00    0.00    0.00    0.00    0.00    0.12    0.00    0.00    0.00   99.88 
 +01:04:17 PM    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
 +01:04:17 PM    1    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
 +01:04:17 PM    2    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
 +01:04:17 PM    3    0.00    0.00    0.00    0.00    0.00    0.50    0.00    0.00    0.00   99.50
  
-==Sous-système applicatif!Priorité==+01:04:17 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle 
 +01:04:19 PM  all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
 +01:04:19 PM    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
 +01:04:19 PM    1    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
 +01:04:19 PM    2    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
 +01:04:19 PM    3    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
  
-Dans ce cas on ne tient compte que des messages de priorité inférieure à la Priorité indiquée.+01:04:19 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle 
 +01:04:21 PM  all    0.00    0.00    0.12    0.00    0.25    0.00    0.00    0.00    0.00   99.63 
 +01:04:21 PM    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
 +01:04:21 PM    1    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
 +01:04:21 PM    2    0.00    0.00    0.50    0.00    0.50    0.00    0.00    0.00    0.00   99.01 
 +01:04:21 PM    3    0.00    0.00    0.00    0.00    0.50    0.00    0.00    0.00    0.00   99.50
  
-==Sous-système applicatif=Priorité==+01:04:21 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle 
 +01:04:23 PM  all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
 +01:04:23 PM    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
 +01:04:23 PM    1    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
 +01:04:23 PM    2    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
 +01:04:23 PM    3    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
  
-Dans ce cas on ne tient compte que des messages de priorité égale à la Priorité indiquée.+01:04:23 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle 
 +01:04:25 PM  all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
 +01:04:25 PM    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
 +01:04:25 PM    1    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
 +01:04:25 PM    2    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
 +01:04:25 PM    3    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
  
-==L'utilisation du caractère spécial *==+Average:     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle 
 +Average:     all    0.00    0.00    0.03    0.00    0.05    0.03    0.00    0.00    0.00   99.90 
 +Average:          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
 +Average:          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 
 +Average:          0.00    0.00    0.10    0.00    0.10    0.00    0.00    0.00    0.00   99.80 
 +Average:          0.00    0.00    0.00    0.00    0.10    0.10    0.00    0.00    0.00   99.80 
 +</code>
  
-La valeur du Sous-système applicatif et/ou de la Priorité peut également être *****Dans ce cas, toutes les valeurs possibles du **Sous-système applicatif** et/ou de la **Priorité** sont concernées, par exemple : **cron.***.+====4.La Commande sar====
  
-==n Sous-systèmes avec la même priorité==+La commande **sar** (**S**ystem **A**ctivity **R**eporter) permet de surveiller toutes les ressources du système selon l'option qui est passée en argument à la commande. 
  
-Plusieurs Sous-systèmes applicatifs peuvent être stipulés pour la même Priorité en les séparant avec un **virgule**. Par exemple **uucp,news.crit**.+Sous RedHat 9 la commande **/usr/lib64/sa/sadc** permet de collecter les informations :
  
-==n Sélecteurs avec la même Action==+<code> 
 +[root@redhat9 ~]# ls /usr/lib64/sa 
 +sa1  sa2  sadc 
 +</code>
  
-Une Action peut s'appliquer à plusieurs Sélecteurs en les séparant par le caractère **;**, par exemple : ***.info;mail.none;authpriv.none;cron.none**.+Le script **/usr/lib64/sa/sa1** exécute la commande **sadc**. Ce script prend deux options :
  
 +^ Option ^ Description ^
 +| -t | L'intervalle entre les collectes |
 +| -n | Nombre de collectes |
 +
 +Le script **/usr/lib64/sa/sa2** exécute la commande **sar** et consigne les informations dans un fichier au format **/var/log/sa/sar<jj>**.
 +
 +Sous RedHat 9, l'intervalle entre les collectes des informations est configuré par les **timers** de systemd au lieu des cron jobs :
 +
 +<code>
 +[root@redhat9 ~]# cat /usr/lib/systemd/system/sysstat-collect.timer
 +# /usr/lib/systemd/system/sysstat-collect.timer
 +# (C) 2014 Tomasz Torcz <tomek@pipebreaker.pl>
 +#
 +# sysstat-12.5.4 systemd unit file:
 +#        Activates activity collector every 10 minutes
 +
 +[Unit]
 +Description=Run system activity accounting tool every 10 minutes
 +
 +[Timer]
 +OnCalendar=*:00/10
 +
 +[Install]
 +WantedBy=sysstat.service
 +</code>
 +
 +La valeur de **OnCalendar** indique un collecte toutes les dix minutes.
 +
 +Pour modifier l'intervalle entre les collectes, il faut créer un fichier **override** dans le répertoire **/etc/systemd/system/** en utilisant la commande **systemctl edit**. En effet, il ne faut jamais éditer les fichiers dans le répertoire **/usr/lib/systemd/system** :
 +
 +<code>
 +[root@redhat9 ~]# systemctl edit sysstat-collect.timer
 +
 +[root@redhat9 ~]# cat /etc/systemd/system/sysstat-collect.timer.d/override.conf 
 +[Unit]
 +Description=Run system activity accounting tool every 2 minutes
 +
 +[Timer]
 +OnCalendar=
 +OnCalendar=*:00/2
 +AccuracySec=0
 +</code>
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important** : Une Action précédée par le signe **-** est entreprise d'une manière **asynchrone**. Dans le cas ou l'action est entreprise d'une manière **synchrone**, la pertinence des journaux est garantie mais au prix d'un ralentissement du système.+**Important** : Notez la ligne **OnCalendar=** qui est necessaire afin de surcharger la valeur par défaut.
 </WRAP> </WRAP>
  
-=====LAB #3 - La Commande logger=====+Vérifiez ensuite la prise en compte de la configuration :
  
-La commande **/usr/bin/logger** permet d'intégrer des informations dans rsyslogCeci peut s'avérer utile dans des scripts bash.+<code> 
 +[root@redhat9 ~]# systemctl status sysstat-collect.timer 
 +○ sysstat-collect.timer - Run system activity accounting tool every 2 minutes 
 +     Loaded: loaded (/usr/lib/systemd/system/sysstat-collect.timer; enabled; preset: disabled) 
 +    Drop-In: /etc/systemd/system/sysstat-collect.timer.d 
 +             └─override.conf 
 +     Active: inactive (dead) 
 +    Trigger: n/a 
 +   Triggers: ● sysstat-collect.service 
 +</code>
  
-La syntaxe de la commande est :+Démarrez le timer :
  
-<file+<code
-logger -p Sous-système applicatif.Priorité message +[root@redhat9 ~]# systemctl start sysstat-collect.timer
-</file>+
  
-Par exemple saisissez la commande suivante :+[root@redhat9 ~]# systemctl status sysstat-collect.timer 
 +● sysstat-collect.timer - Run system activity accounting tool every 2 minutes 
 +     Loaded: loaded (/usr/lib/systemd/system/sysstat-collect.timer; enabled; preset: disabled) 
 +    Drop-In: /etc/systemd/system/sysstat-collect.timer.d 
 +             └─override.conf 
 +     Active: active (waiting) since Wed 2024-10-23 13:12:22 CEST; 4s ago 
 +      Until: Wed 2024-10-23 13:12:22 CEST; 4s ago 
 +    Trigger: Wed 2024-10-23 13:14:00 CEST; 1min 32s left 
 +   Triggers: ● sysstat-collect.service 
 + 
 +Oct 23 13:12:22 redhat9.ittraining.loc systemd[1]: Started Run system activity accounting tool every 2 minutes. 
 +</code> 
 + 
 +Attendez 4 minutes, puis lancez la commande suivante :
  
 <code> <code>
-[root@centos8 ~]# logger -p user.info Linux est super+[root@redhat9 ~]# journalctl -g sysstat-collect.service 
 +Oct 23 13:14:00 redhat9.ittraining.loc systemd[1]: sysstat-collect.service: Deactivated successfully. 
 +Oct 23 13:16:00 redhat9.ittraining.loc systemd[1]: sysstat-collect.service: Deactivated successfully.
 </code> </code>
  
-Consultez la fin de votre syslog :+Saisissez la commande sar :
  
 <code> <code>
-[root@centos8 ~]# tail /var/log/messages +[root@redhat9 ~]# sar 
-Jun  3 12:55:01 centos8 systemd[1]: session-237.scope: Succeeded. +Linux 5.14.0-427.37.1.el9_4.x86_64 (redhat9.ittraining.loc)     10/23/2024      _x86_64_        (4 CPU) 
-Jun  3 12:56:01 centos8 systemd[1]: Started Session 238 of user trainee. + 
-Jun  3 12:56:01 centos8 systemd[1]: session-238.scope: Succeeded+01:14:00 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle 
-Jun  3 12:57:01 centos8 systemd[1]: Started Session 239 of user trainee. +01:16:00 PM     all      0.09      0.00      0.09      0.00      0.00     99.81 
-Jun  3 12:57:01 centos8 systemd[1]session-239.scopeSucceeded. +Average       all      0.09      0.00      0.09      0.00      0.00     99.81
-Jun  3 12:58:01 centos8 systemd[1]: Started Session 240 of user trainee. +
-Jun  3 12:58:01 centos8 systemd[1]: session-240.scope: Succeeded. +
-Jun  3 12:58:55 centos8 trainee[5139]: Linux est super +
-Jun  3 12:59:01 centos8 systemd[1]: Started Session 241 of user trainee+
-Jun  3 12:59:01 centos8 systemd[1]: session-241.scope: Succeeded.+
 </code> </code>
  
-Les options de la commande logger sont :+===Statistiques d'Utilisation du CPU=== 
 + 
 +Visualisez maintenant les statistiques d'utilisation du CPU
  
 <code> <code>
-[root@centos8 ~]# logger --help+[root@redhat9 ~]# sar -u 5 3 
 +Linux 5.14.0-427.37.1.el9_4.x86_64 (redhat9.ittraining.loc)     10/23/2024      _x86_64_        (4 CPU)
  
-Usage+01:17:30 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle 
- logger [options] [<message>]+01:17:35 PM     all      0.00      0.00      0.05      0.05      0.00     99.90 
 +01:17:40 PM     all      0.00      0.00      0.10      0.00      0.00     99.90 
 +01:17:45 PM     all      0.00      0.00      0.05      0.00      0.00     99.95 
 +Average:        all      0.00      0.00      0.07      0.02      0.00     99.92 
 +</code>
  
-Enter messages into the system log.+D'avantage de statistiques peuvent être obtenues en utilisant l'option **ALL** :
  
-Options: +<code> 
- -i                       log the logger command's PID +[root@redhat9 ~]# sar -u ALL 5 3 
-     --id[=<id>         log the given <id>, or otherwise the PID +Linux 5.14.0-427.37.1.el9_4.x86_64 (redhat9.ittraining.loc)     10/23/2024      _x86_64_        (4 CPU)
- -f, --file <file>        log the contents of this file +
- -e, --skip-empty         do not log empty lines when processing files +
-     --no-act             do everything except the write the log +
- -p, --priority <prio>    mark given message with this priority +
-     --octet-count        use rfc6587 octet counting +
-     --prio-prefix        look for a prefix on every line read from stdin +
- -s, --stderr             output message to standard error as well +
- -S, --size <size>        maximum size for a single message +
- -t, --tag <tag>          mark every line with this tag +
- -n, --server <name>      write to this remote syslog server +
- -P, --port <port>        use this port for UDP or TCP connection +
- -T, --tcp                use TCP only +
- -d, --udp                use UDP only +
-     --rfc3164            use the obsolete BSD syslog protocol +
-     --rfc5424[=<snip>  use the syslog protocol (the default for remote)+
-                            <snip> can be notime, or notq, and/or nohost +
-     --sd-id <id>         rfc5424 structured data ID +
-     --sd-param <data>    rfc5424 structured data name=value +
-     --msgid <msgid>      set rfc5424 message id field +
- -u, --socket <socket>    write to this Unix socket +
-     --socket-errors[=<on|off|auto>+
-                          print connection errors when using Unix sockets +
-     --journald[=<file> write journald entry+
  
- -h, --help               display this help +01:18:19 PM     CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle 
- -V, --version            display version+01:18:24 PM     all      0.00      0.00      0.00      0.00      0.00      0.00      0.05      0.00      0.00     99.95 
 +01:18:29 PM     all      0.00      0.00      0.00      0.00      0.00      0.00      0.05      0.00      0.00     99.95 
 +01:18:34 PM     all      0.00      0.00      0.00      0.00      0.00      0.05      0.00      0.00      0.00     99.95 
 +Average:        all      0.00      0.00      0.00      0.00      0.00      0.02      0.03      0.00      0.00     99.95 
 +</code>
  
-For more details see logger(1).+Pour consulter les statistiques d'un coeur spécifique, utilisez l'option **-P** : 
 + 
 +<code> 
 +[root@redhat9 ~]# sar -u -P 1 5 3 
 +Linux 5.14.0-427.37.1.el9_4.x86_64 (redhat9.ittraining.loc)     10/23/2024      _x86_64_        (4 CPU) 
 + 
 +01:19:18 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle 
 +01:19:23 PM            0.00      0.00      0.00      0.00      0.00    100.00 
 +01:19:28 PM            0.00      0.00      0.00      0.00      0.00    100.00 
 +01:19:33 PM            0.00      0.00      0.00      0.00      0.00    100.00 
 +Average:          1      0.00      0.00      0.00      0.00      0.00    100.00 
 + 
 +[root@redhat9 ~]# sar -u -P 3 5 3 
 +Linux 5.14.0-427.37.1.el9_4.x86_64 (redhat9.ittraining.loc    10/23/2024      _x86_64_        (4 CPU) 
 + 
 +01:19:57 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle 
 +01:20:02 PM            0.40      0.00      0.60      0.00      0.00     99.00 
 +01:20:07 PM            0.00      0.00      0.20      0.00      0.00     99.80 
 +01:20:12 PM            0.20      0.00      0.00      0.00      0.00     99.80 
 +Average:          3      0.20      0.00      0.27      0.00      0.00     99.53
 </code> </code>
  
-=====LAB #4 - La Commande logrotate=====+===Statistiques d'Utilisation de la Mémoire et du Swap===
  
-Les fichiers journaux grossissent régulièrement. Le programme **/usr/sbin/logrotate** est utilisé pour effectuer des rotations de ces fichiers selon la configuration contenue dans le fichier **/etc/logrotate.conf**.+Utilisez l'option **-r** pour visualiser les statistiques concernant la mémoire : 
 + 
 +<code> 
 +[root@redhat9 ~]# sar -r 5 3 
 +Linux 5.14.0-427.37.1.el9_4.x86_64 (redhat9.ittraining.loc)     10/23/2024      _x86_64_        (4 CPU) 
 + 
 +01:21:09 PM kbmemfree   kbavail kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kbdirty 
 +01:21:14 PM   6291048   6884172    614788      7.81      2780    830192   3436776     26.21    815820    487516         8 
 +01:21:19 PM   6291048   6884172    614788      7.81      2780    830192   3436776     26.21    815872    487516         8 
 +01:21:24 PM   6291048   6884172    614788      7.81      2780    830192   3436776     26.21    815872    487516         8 
 +Average:      6291048   6884172    614788      7.81      2780    830192   3436776     26.21    815855    487516         8 
 +</code>
  
-Visualisez le fichier **/etc/logrotate.conf** :+Utilisez l'option **-S** pour visualiser les statistiques concernant le Swap :
  
 <code> <code>
-[root@centos8 ~]# cat /etc/logrotate.conf +[root@redhat9 ~]# sar -S 5 3 
-# see "man logrotate" for details +Linux 5.14.0-427.37.1.el9_4.x86_64 (redhat9.ittraining.loc)     10/23/2024      _x86_64_        (4 CPU)
-# rotate log files weekly +
-weekly+
  
-# keep 4 weeks worth of backlogs +01:21:48 PM kbswpfree kbswpused  %swpused  kbswpcad   %swpcad 
-rotate 4+01:21:53 PM   5242876              0.00              0.00 
 +01:21:58 PM   5242876              0.00              0.00 
 +01:22:03 PM   5242876              0.00              0.00 
 +Average:      5242876              0.00              0.00 
 +</code>
  
-# create new (empty) log files after rotating old ones +===Statistiques des E/S===
-create+
  
-# use date as a suffix of the rotated file +Utilisez l'option **-b** pour visualiser les statistiques concernant les E/S  :
-dateext+
  
-# uncomment this if you want your log files compressed +<code> 
-#compress+[root@redhat9 ~]sar -b 5 3 
 +Linux 5.14.0-427.37.1.el9_4.x86_64 (redhat9.ittraining.loc)     10/23/2024      _x86_64_        (4 CPU)
  
-# RPM packages drop log rotation information into this directory +01:22:37 PM       tps      rtps      wtps      dtps   bread/s   bwrtn/s   bdscd/
-include /etc/logrotate.d+01:22:42 PM      0.00      0.00      0.00      0.00      0.00      0.00      0.00 
 +01:22:47 PM      0.00      0.00      0.00      0.00      0.00      0.00      0.00 
 +01:22:52 PM      0.00      0.00      0.00      0.00      0.00      0.00      0.00 
 +Average:         0.00      0.00      0.00      0.00      0.00      0.00      0.00 
 +</code>
  
-system-specific logs may be also be configured here.+===Statistiques des E/S par Disque=== 
 + 
 +Utilisez l'option **-d** pour visualiser les statistiques concernant les E/S par disque : 
 + 
 +<code> 
 +[root@redhat9 ~]sar -d 5 3 
 +Linux 5.14.0-427.37.1.el9_4.x86_64 (redhat9.ittraining.loc)     10/23/2024      _x86_64_        (4 CPU) 
 + 
 +01:23:14 PM       DEV       tps     rkB/    wkB/    dkB/  areq-sz    aqu-sz     await     %util 
 +01:23:19 PM       sda      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 
 +01:23:19 PM       sdb      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 
 +01:23:19 PM      dm-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 
 +01:23:19 PM      dm-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 
 + 
 +01:23:19 PM       DEV       tps     rkB/    wkB/    dkB/  areq-sz    aqu-sz     await     %util 
 +01:23:24 PM       sda      0.20      0.00      0.80      0.00      4.00      0.02     78.00      1.58 
 +01:23:24 PM       sdb      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 
 +01:23:24 PM      dm-0      0.20      0.00      0.80      0.00      4.00      0.02     78.00      1.58 
 +01:23:24 PM      dm-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 
 + 
 +01:23:24 PM       DEV       tps     rkB/    wkB/    dkB/  areq-sz    aqu-sz     await     %util 
 +01:23:29 PM       sda      1.00      0.00      5.00      0.00      5.00      0.03     27.20      2.46 
 +01:23:29 PM       sdb      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 
 +01:23:29 PM      dm-0      1.00      0.00      5.00      0.00      5.00      0.03     27.00      2.46 
 +01:23:29 PM      dm-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 
 + 
 +Average:          DEV       tps     rkB/    wkB/    dkB/  areq-sz    aqu-sz     await     %util 
 +Average:          sda      0.40      0.00      1.93      0.00      4.83      0.02     35.67      1.35 
 +Average:          sdb      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 
 +Average:         dm-0      0.40      0.00      1.93      0.00      4.83      0.01     35.50      1.35 
 +Average:         dm-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
 </code> </code>
  
-Dans la première partie de ce fichier on trouve des directives pour :+Les options de la commande sar sont :
  
-  * remplacer les fichiers journaux chaque semaine +<code> 
-  * garder 4 archives des fichiers journaux +[root@redhat9 ~]# sar --help 
-  * créer un nouveau fichier log une fois le précédent archivé +Usage: sar [ options ] [ <interval> [ <count> ] ] 
-  * comprimer les archives créées.+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 { <int_list> | SUM | ALL } 
 +                Interrupts statistics [A_IRQ] 
 +        -m { <keyword> [,...] | ALL } 
 +                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 { <keyword> [,...] | ALL } 
 +                Network statistics [A_NET_...] 
 +                Keywords are: 
 +                DEV     Network interfaces 
 +                EDEV    Network interfaces (errors) 
 +                NFS     NFS client 
 +                NFSD    NFS server 
 +                SOCK    Sockets (v4) 
 +                IP      IP traffic      (v4) 
 +                EIP     IP traffic      (v4) (errors) 
 +                ICMP    ICMP traffic    (v4) 
 +                EICMP   ICMP traffic    (v4) (errors) 
 +                TCP     TCP traffic     (v4) 
 +                ETCP    TCP traffic     (v4) (errors) 
 +                UDP     UDP traffic     (v4) 
 +                SOCK6   Sockets (v6) 
 +                IP6     IP traffic      (v6) 
 +                EIP6    IP traffic      (v6) (errors) 
 +                ICMP6   ICMP traffic    (v6) 
 +                EICMP6  ICMP traffic    (v6) (errors) 
 +                UDP6    UDP traffic     (v6) 
 +                FC      Fibre channel HBAs 
 +                SOFT    Software-based network processing 
 +        -q [ <keyword> [,...] | PSI | ALL ] 
 +                System load and pressure-stall statistics 
 +                Keywords are: 
 +                LOAD    Queue length and load average statistics [A_QUEUE] 
 +                CPU     Pressure-stall CPU statistics [A_PSI_CPU] 
 +                IO      Pressure-stall I/O statistics [A_PSI_IO] 
 +                MEM     Pressure-stall memory statistics [A_PSI_MEM] 
 +        -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] 
 +</code>
  
-La directive **include /etc/logrotate.d** indique que les configurations incluent dans le répertoire cité doivent être incorporées dans le fichier de configuration de logrotate.+=====Modules usb=====
  
-La deuxième partie du fichier concerne des configurations spécifiques pour certains fichiers journaux.+L'**USB** (//Universal Serial Bus//) est un bus de données qui peut offrir des taux de transfert jusqu'à 480Mb/s sous la version 2.0 et jusqu'à 4.8 Gb/s sous la version 3.0. Les modules nécessaires pour les contrôleurs USB sont : 
 + 
 +^ Version USB ^ Module ^ Nom Complet ^ 
 +|  1.0\1.1  | **UHCI** | //Universal Controller Host Interface// | 
 +|  :::  | **OHCI** | //Open Controller Host Interface// | 
 +|  2.0  | **EHCI** | //Enhanced Host Controller Interface// | 
 +|  3.0  | **XHCI** | //Extensible Host Controller Interface// | 
 + 
 +Le tableau suivant liste les modules courrament chargés en fonction du périphérique utilisé : 
 + 
 +^ Module ^ Type de Périphérique ^  
 +|  **usb_storage**  | Supports de masse | 
 +|  **usbhid**  | Periphériques HID (//Human Interface Device//) | 
 +|  **snd-usb-audio**  | Cartes son usb | 
 +|  **usbvidéo**  | Cartes vidéo et d'acquisition | 
 +|  **irda-usb**  | Périphériques infrarouges | 
 +|  **usbnet**  | Cartes réseaux usb | 
 + 
 +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'appelle le **//hotplugging//**. Le //hotplugging// est obtenu grâce à l'utilisation de trois composants : 
 + 
 +  * 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 **/lib/udev/devices** vers /dev, 
 +  * le démon **udevd** collecte des données appelées **uevents** du noyau et cherche une règle correspondante dans le répertoire **/lib/udev/rules.d/**, 
 +  * 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 **/lib/udev/rules.d/*.rules** en mémoire, 
 +  * 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'//User Space//. Par exemple, lors du branchement d'une clé USB, Udev crée **/dev/sdb1** automatiquement et utilise les informations contenues dans le fichier **/lib/modules/`uname -r`/modules.alias** pour trouver le pilote nécessaire : 
 + 
 +Le fichier de configuration principal d'Udev est **/etc/udev/udev.conf** : 
 + 
 +<code> 
 +[root@redhat9 ~]# cat /etc/udev/udev.conf 
 +# see udev.conf(5) for details 
 +
 +# udevd is also started in the initrd.  When this file is modified you might 
 +# also want to rebuild the initrd, so that it will include the modified configuration. 
 + 
 +#udev_log=info 
 +#children_max= 
 +#exec_delay= 
 +#event_timeout=180 
 +#timeout_signal=SIGKILL 
 +#resolve_names=early 
 +</code> 
 + 
 +Les fichiers de règles se trouvent dans **/lib/udev/rules.d/** : 
 + 
 +<code> 
 +[root@redhat9 ~]# ls /lib/udev/rules.d/ 
 +01-md-raid-creating.rules  60-persistent-alsa.rules               65-scsi-cciss_id.rules                70-uaccess.rules                   77-mm-nokia-port-types.rules     90-alsa-restore.rules 
 +10-dm.rules                60-persistent-input.rules              66-kpartx.rules                       70-wacom.rules                     77-mm-qcom-soc.rules             90-bolt.rules 
 +11-dm-lvm.rules            60-persistent-storage.rules            66-md-auto-readd.rules                71-nvmf-netapp.rules               77-mm-quectel-port-types.rules   90-fwupd-devices.rules 
 +11-dm-mpath.rules          60-persistent-storage-tape.rules       68-del-part-nodes.rules               71-prefixdevname.rules             77-mm-sierra.rules               90-iprutils.rules 
 +11-dm-parts.rules          60-persistent-v4l.rules                69-cd-sensors.rules                   71-seat.rules                      77-mm-simtech-port-types.rules   90-libinput-fuzz-override.rules 
 +13-dm-disk.rules           60-sensor.rules                        69-dm-lvm.rules                       73-seat-late.rules                 77-mm-telit-port-types.rules     90-nm-thunderbolt.rules 
 +40-elevator.rules          60-serial.rules                        69-libmtp.rules                       75-net-description.rules           77-mm-tplink-port-types.rules    90-pipewire-alsa.rules 
 +40-libgphoto2.rules        60-tpm-udev.rules                      69-md-clustered-confirm-device.rules  75-probe_mtd.rules                 77-mm-ublox-port-types.rules     90-vconsole.rules 
 +40-redhat.rules            61-gdm.rules                           70-camera.rules                       77-mm-broadmobi-port-types.rules   77-mm-x22x-port-types.rules      91-drm-modeset.rules 
 +40-usb-blacklist.rules     61-gnome-bluetooth-rfkill.rules        70-hypervfcopy.rules                  77-mm-cinterion-port-types.rules   77-mm-zte-port-types.rules       95-cd-devices.rules 
 +40-usb_modeswitch.rules    61-gnome-settings-daemon-rfkill.rules  70-hypervkvp.rules                    77-mm-dell-port-types.rules        78-sound-card.rules              95-dm-notify.rules 
 +50-udev-default.rules      61-mutter.rules                        70-hypervvss.rules                    77-mm-dlink-port-types.rules       80-drivers.rules                 95-upower-hid.rules 
 +60-autosuspend.rules       61-scsi-sg3_id.rules                   70-joystick.rules                     77-mm-ericsson-mbm.rules           80-iio-sensor-proxy.rules        95-upower-wup.rules 
 +60-block.rules             62-multipath.rules                     70-libfprint-2.rules                  77-mm-fibocom-port-types.rules     80-libinput-device-groups.rules  98-kexec.rules 
 +60-cdrom_id.rules          63-fc-wwpn-id.rules                    70-memory.rules                       77-mm-foxconn-port-types.rules     80-mm-candidate.rules            99-qemu-guest-agent.rules 
 +60-drm.rules               63-md-raid-arrays.rules                70-mouse.rules                        77-mm-gosuncn-port-types.rules     80-net-setup-link.rules          99-systemd.rules 
 +60-evdev.rules             63-scsi-sg3_symlink.rules              70-nvmf-autoconnect.rules             77-mm-haier-port-types.rules       80-udisks2.rules                 99-vmware-scsi-udev.rules 
 +60-fido-id.rules           64-btrfs.rules                         70-power-switch.rules                 77-mm-huawei-net-port-types.rules  81-net-dhcp.rules                README 
 +60_flashrom.rules          64-md-raid-assembly.rules              70-printers.rules                     77-mm-linktop-port-types.rules     84-nm-drivers.rules 
 +60-input-id.rules          65-libwacom.rules                      70-spice-vdagentd.rules               77-mm-longcheer-port-types.rules   85-nm-unmanaged.rules 
 +60-net.rules               65-sane-backends.rules                 70-touchpad.rules                     77-mm-mtk-port-types.rules         85-regulatory.rules 
 +</code>
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important** : Notez que la compression des fichiers de journalisation n'est pas activée par défaut.+**Important** : Il vous est possible d'ajouter des règles si besoin est. Dans ce cas, créez un fichier **99-local.rules** est éditez-le au lieu d'éditer les fichiers existants.
 </WRAP> </WRAP>
  
-Les options de la commande logrotate sont :+Comme indique le nom de chaque fichier, le contenu est composé de règles à l'attention d'udev. Le fichier des règles par défaut est le **50-udev-default.rules** :
  
 <code> <code>
-[root@centos8 ~]# logrotate --help +[root@redhat9 ~]# cat /lib/udev/rules.d/50-udev-default.rules | more 
-Usage: logrotate [OPTION...] <configfile> +do not edit this file, it will be overwritten on update
-  -d, --debug               Don'do anything, just test and print debug +
-                            messages +
-  -f, --force               Force file rotation +
-  -m--mail=command        Command to send mail (instead of `/bin/mail'+
-  -s, --state=statefile     Path of state file +
-  -v, --verbose             Display messages during rotation +
-  -l, --log=logfile         Log file or 'syslog' to log to syslog +
-      --version             Display version information+
  
-Help options: +# run a command on remove events 
-  -?, --help                Show this help message +ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" 
-      --usage               Display brief usage message+ACTION=="remove", GOTO="default_end" 
 + 
 +# The md driver increments diskseq *after* emitting 'change' uevent. 
 +# Drop the line below if it is fixed on the kernel side. 
 +SUBSYSTEM=="block", KERNEL=="md*", ENV{ID_IGNORE_DISKSEQ}="1" 
 + 
 +SUBSYSTEM=="virtio-ports", KERNEL=="vport*", ATTR{name}=="?*"SYMLINK+="virtio-ports/$attr{name}" 
 + 
 +# select "system RTC" or just use the first one 
 +SUBSYSTEM=="rtc", ATTR{hctosys}=="1", SYMLINK+="rtc" 
 +SUBSYSTEM=="rtc", KERNEL=="rtc0", SYMLINK+="rtc", OPTIONS+="link_priority=-100" 
 + 
 +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", IMPORT{builtin}="usb_id", IMPORT{builtin}="hwdb --subsystem=usb" 
 +ENV{MODALIAS}!="", IMPORT{builtin}="hwdb --subsystem=$env{SUBSYSTEM}" 
 + 
 +SUBSYSTEM=="net", IMPORT{builtin}="net_driver" 
 + 
 +ACTION!="add", GOTO="default_end" 
 + 
 +SUBSYSTEM=="tty", KERNEL=="ptmx", GROUP="tty", MODE="0666" 
 +SUBSYSTEM=="tty", KERNEL=="tty", GROUP="tty", MODE="0666" 
 +SUBSYSTEM=="tty", KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620" 
 +SUBSYSTEM=="tty", KERNEL=="sclp_line[0-9]*", GROUP="tty", MODE="0620" 
 +SUBSYSTEM=="tty", KERNEL=="ttysclp[0-9]*", GROUP="tty", MODE="0620" 
 +SUBSYSTEM=="tty", KERNEL=="3270/tty[0-9]*", GROUP="tty", MODE="0620" 
 +SUBSYSTEM=="vc", KERNEL=="vcs*|vcsa*", GROUP="tty" 
 +KERNEL=="tty[A-Z]*[0-9]|ttymxc[0-9]*|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout" 
 + 
 +SUBSYSTEM=="mem", KERNEL=="mem|kmem|port", GROUP="kmem", MODE="0640" 
 + 
 +SUBSYSTEM=="input", GROUP="input" 
 +SUBSYSTEM=="input", KERNEL=="js[0-9]*", MODE="0664" 
 + 
 +SUBSYSTEM=="video4linux", GROUP="video" 
 +SUBSYSTEM=="graphics", GROUP="video" 
 +SUBSYSTEM=="drm", KERNEL!="renderD*", GROUP="video" 
 +SUBSYSTEM=="dvb", GROUP="video" 
 +SUBSYSTEM=="media", GROUP="video" 
 +SUBSYSTEM=="cec", GROUP="video" 
 + 
 +SUBSYSTEM=="drm", KERNEL=="renderD*", GROUP="render", MODE="0666" 
 +SUBSYSTEM=="kfd", GROUP="render", MODE="0666" 
 + 
 +SUBSYSTEM=="misc", KERNEL=="sgx_enclave", GROUP="sgx", MODE="0660" 
 +SUBSYSTEM=="misc", KERNEL=="sgx_vepc", GROUP="sgx", MODE="0660" 
 + 
 +# When using static_node= with non-default permissions, also update 
 +# tmpfiles.d/static-nodes-permissions.conf.in to keep permissions synchronized. 
 + 
 +SUBSYSTEM=="sound", GROUP="audio",
 +  OPTIONS+="static_node=snd/seq", OPTIONS+="static_node=snd/timer" 
 +--More--
 </code> </code>
  
-=====LAB #5 - La Journalisation avec journald=====+Chaque règle prend la forme suivante :
  
-Sous RHEL/CentOS 8les fichiers de Syslog sont gardés pour une question de compatibilitéCependanttous les journaux sont d'abord collectés par **Journald** pour ensuite être redistribués vers les fichiers classiques se trouvant dans le répertoire /var/logLes journaux de journald sont stockés dans un seul et unique fichier dynamique dans le répertoire **/run/log/journal** :+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, généralement identique à la valeur du BUS | usb, scsi | 
 +| 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ériqueCe fichier contient le fabricant, le label, le numéro de série et UUID du périphérique. La vérification de jusqu'à 5 fichiers est possible par règle | S/O | 
 +| PROGRAM | Ceci permet à Udev d'appeler un programme externe pour nommer un périphérique | S/O | 
 +| 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'information sur un périphérique il convient d'utiliser la commande **udevadm** :
  
 <code> <code>
-[root@centos8 ~]# ls -/run/log/journal+[root@redhat9 ~]# udevadm info --query=all -n /dev/sda 
-total +P: /devices/pci0000:00/0000:00:05.0/0000:01:01.0/virtio2/host0/target0:0:0/0:0:0:0/block/sda 
-drwxr-s---+ 2 root systemd-journal 60 Jun  3 09:01 de79af4f226d480fa7d3fec4cabbf97a+M: sda 
 +U: block 
 +T: disk 
 +D: b 8:
 +N: sda 
 +L: 0 
 +S: disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0 
 +S: disk/by-path/pci-0000:01:01.0-scsi-0:0:0:
 +S: disk/by-diskseq/
 +Q: 1 
 +E: DEVPATH=/devices/pci0000:00/0000:00:05.0/0000:01:01.0/virtio2/host0/target0:0:0/0:0:0:0/block/sda 
 +E: DEVNAME=/dev/sda 
 +E: DEVTYPE=disk 
 +E: DISKSEQ=1 
 +E: MAJOR=8 
 +E: MINOR=0 
 +E: SUBSYSTEM=block 
 +E: USEC_INITIALIZED=11296575 
 +E: ID_SCSI=1 
 +E: ID_VENDOR=QEMU 
 +E: ID_VENDOR_ENC=QEMU\x20\x20\x20\x20 
 +E: ID_MODEL=QEMU_HARDDISK 
 +E: ID_MODEL_ENC=QEMU\x20HARDDISK\x20\x20\x20 
 +E: ID_REVISION=2.5+ 
 +E: ID_TYPE=disk 
 +E: ID_SERIAL=0QEMU_QEMU_HARDDISK_drive-scsi0 
 +E: ID_SERIAL_SHORT=drive-scsi0 
 +E: ID_BUS=scsi 
 +E: ID_PATH=pci-0000:01:01.0-scsi-0:0:0:
 +E: ID_PATH_TAG=pci-0000_01_01_0-scsi-0_0_0_0 
 +E: ID_PART_TABLE_UUID=d00dfc8a 
 +E: ID_PART_TABLE_TYPE=dos 
 +E: SCSI_TPGS=0 
 +E: SCSI_TYPE=disk 
 +E: SCSI_VENDOR=QEMU 
 +E: SCSI_VENDOR_ENC=QEMU\x20\x20\x20\x20 
 +E: SCSI_MODEL=QEMU_HARDDISK 
 +E: SCSI_MODEL_ENC=QEMU\x20HARDDISK\x20\x20\x20 
 +E: SCSI_REVISION=2.5+ 
 +E: ID_SCSI_INQUIRY=1 
 +E: SCSI_IDENT_LUN_VENDOR=drive-scsi0 
 +E: DEVLINKS=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0 /dev/disk/by-path/pci-0000:01:01.0-scsi-0:0:0:0 /dev/disk/by-diskseq/
 +E: TAGS=:systemd: 
 +E: CURRENT_TAGS=:systemd:
 </code> </code>
  
-A l'extinction de la machine les journaux sont **effacés**.+===Les options de la commande===
  
-Pour rendre les journaux permenants, il faut créer le répertoire **/var/log/journal** :+Les options de la commande udevadm sont :
  
 <code> <code>
-[root@centos8 ~]# mkdir /var/log/journal +[root@redhat9 ~]# udevadm --help 
-[root@centos8 ~]# ls -l /var/log/journal/+udevadm [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS] 
 + 
 +Send control commands or test the device manager. 
 + 
 +Commands: 
 +  info          Query sysfs or the udev database 
 +  trigger       Request events from the kernel 
 +  settle        Wait for pending udev events 
 +  control       Control the udev daemon 
 +  monitor       Listen to kernel and udev events 
 +  test          Test an event run 
 +  test-builtin  Test a built-in command 
 +  wait          Wait for device or device symlink 
 +  lock          Lock a block device 
 + 
 +See the udevadm(8) man page for details. 
 + 
 +[root@redhat9 ~]# udevadm info --help 
 +udevadm info [OPTIONS] [DEVPATH|FILE] 
 + 
 +Query sysfs or the udev database. 
 + 
 +  -h --help                   Print this message 
 +  -V --version                Print version of the program 
 +  -q --query=TYPE             Query device information: 
 +       name                     Name of device node 
 +       symlink                  Pointing to node 
 +       path                     sysfs device path 
 +       property                 The device properties 
 +       all                      All values 
 +     --property=NAME          Show only properties by this name 
 +     --value                  When showing properties, print only their values 
 +  -p --path=SYSPATH           sysfs device path used for query or attribute walk 
 +  -n --name=NAME              Node or symlink name used for query or attribute walk 
 +  -r --root                   Prepend dev directory to path names 
 +  -a --attribute-walk         Print all key matches walking along the chain 
 +                              of parent devices 
 +  -t --tree                   Show tree of devices 
 +  -d --device-id-of-file=FILE Print major:minor of device containing this file 
 +  -x --export                 Export key/value pairs 
 +  -P --export-prefix          Export the key name with a prefix 
 +  -e --export-db              Export the content of the udev database 
 +  -c --cleanup-db             Clean up the udev database 
 +  -w --wait-for-initialization[=SECONDS] 
 +                              Wait for device to be initialized 
 +     --no-pager               Do not pipe output into a pager 
 +</code> 
 + 
 +=====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 : 
 + 
 +<code> 
 +[root@redhat9 ~]# ls -l /sys
 total 0 total 0
-[root@centos8 ~]# systemctl restart systemd-journald +drwxr-xr-x.   2 root root 0 Oct 22 15:36 block 
-[root@centos8 ~]# ls -l /run/log/journal/ +drwxr-xr-x.  36 root root 0 Oct 22 15:36 bus 
-lscannot access '/run/log/journal/': No such file or directory +drwxr-xr-x.  60 root root 0 Oct 22 15:36 class 
-[root@centos8 ~]# ls -l /var/log/journal/ +drwxr-xr-x.   4 root root 0 Oct 22 15:36 dev 
-total +drwxr-xr-x.  16 root root 0 Oct 22 15:36 devices 
-drwxr-xr-x. 2 root root 28 Jun  13:03 de79af4f226d480fa7d3fec4cabbf97a+drwxr-xr-x.   6 root root 0 Oct 22 15:36 firmware 
 +drwxr-xr-x.   8 root root Oct 22 15:36 fs 
 +drwxr-xr-x.   2 root root 0 Oct 22 16:13 hypervisor 
 +drwxr-xr-x.  16 root root 0 Oct 22 15:36 kernel 
 +drwxr-xr-x. 170 root root 0 Oct 22 15:36 module 
 +drwxr-xr-x.   root root 0 Oct 22 15:36 power
 </code> </code>
  
-Journald ne peut pas envoyer les traces à un autre ordinateur. Pour utiliser un serveur de journalisation distant il faut donc inclure la directive **ForwardToSyslog=yes** dans le fichier de configuration de journald, **/etc/systemd/journald.conf**, puis configurer Rsyslog à envoyer les traces au serveur distant :+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** 
 +    * contiententre autre, des informations sur l'ACPI 
 +  * **module** 
 +    * contient des informations sur les modules du noyau 
 +  * **power** 
 +    * contient des informations sur la gestion de l'énergie 
 +  * **fs** 
 +    * contient des informations sur les systèmes de fichiers 
 + 
 +Pour illustrer ceci, saisissez la commande suivante :
  
 <code> <code>
-[root@centos8 ~]# cat /etc/systemd/journald.conf +[root@redhat9 ~]# cat /sys/block/sda/sda1/size 
- This file is part of systemd.+2097152 
 +</code> 
 + 
 +Ce chiffre correspond aux nombre de secteurs. 
 + 
 +=====LAB #5 - Limitation des ressources===== 
 + 
 +====5.1 - ulimit==== 
 + 
 +Les ressources disponibles aux utilisateurs peuvent être limitées par l'utilisation de la commande **ulimit**.  
 + 
 +La commande **ulimit** gère deux types de limite, la limite //hard// en utilisant l'option **-H** et la limite //soft// en utilisant l'option **-S**. Seul root peut positionner une limite //hard// et ceci à condition que la limite ne dépasse pas les ressources réelles. 
 + 
 +La limite //soft// est la limite imposée à l'utilisateur par défaut tandis que la limite //hard// est la limite que l'utilisateur peut atteindre en utilisant la commande ulimit lui-même. 
 + 
 +L'utilisateur root peut paramétrer les limites accordées en éditant la fichier **/etc/security/limits.conf** : 
 + 
 +<code> 
 +[root@redhat9 ~]cat /etc/security/limits.conf 
 +# /etc/security/limits.conf
 # #
- systemd is free software; you can redistribute it and/or modify it +#This file sets the resource limits for the users logged in via PAM. 
-#  under the terms of the GNU Lesser General Public License as published by +#It does not affect resource limits of the system services.
- the Free Software Foundation; either version 2.1 of the License, or +
-#  (at your option) any later version.+
 # #
-Entries in this file show the compile time defaults+#Also note that configuration files in /etc/security/limits.d directory, 
-You can change settings by editing this file. +#which are read in alphabetical order, override the settings in this 
-Defaults can be restored by simply deleting this file.+#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 overridden with a wildcard setting in a config file in the 
 +#subdirectory, but a user specific setting here can be overridden only 
 +#with a user specific setting in the subdirectory
 +# 
 +#Each line describes a limit for a user in the form: 
 +
 +#<domain>        <type>  <item>  <value> 
 +
 +#Where: 
 +#<domain> can be
 +#        - 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 
 +
 +#<type> can have the two values: 
 +#        - "soft" for enforcing the soft limits 
 +#        - "hard" for enforcing hard limits 
 +
 +#<item> can be one of the following: 
 +#        - 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 
 +
 +#<domain>      <type>  <item>         <value>
 # #
-# See journald.conf(5) for details. 
  
-[Journal] +#*               soft    core            0 
-#Storage=auto +#*               hard    rss             10000 
-#Compress=yes +#@student        hard    nproc           20 
-#Seal=yes +#@faculty        soft    nproc           20 
-#SplitMode=uid +#@faculty        hard    nproc           50 
-#SyncIntervalSec=5m +#ftp             hard    nproc           0 
-#RateLimitIntervalSec=30s +#@student        -       maxlogins       4 
-#RateLimitBurst=10000 + 
-#SystemMaxUse= +End of file 
-#SystemKeepFree= +</code>  
-#SystemMaxFileSize= + 
-#SystemMaxFiles=100 +<WRAP center round important 60%> 
-#RuntimeMaxUse= +**Important** : La valeur de la limite peut être un **nombre** ou le mot **unlimited**. 
-#RuntimeKeepFree= +</WRAP> 
-#RuntimeMaxFileSize= + 
-#RuntimeMaxFiles=100 +Par exemple, si root inscrit les deux ligne suivantes dans le fichier /etc/security/limits.conf : 
-#MaxRetentionSec= + 
-#MaxFileSec=1month +<file> 
-#ForwardToSyslog=no +... 
-ForwardToSyslog=yes +trainee                soft        nofile          1024 
-#ForwardToKMsg=no +trainee                hard        nofile          4096 
-#ForwardToConsole=no +... 
-#ForwardToWall=yes +</file> 
-#TTYPath=/dev/console + 
-#MaxLevelStore=debug +la limite du nombre de fichiers ouverts simultanément par trainee est de 1 024. Par contre, trainee a la possibilité d'augmenter cette limite jusqu'à 4 096 en utilisant la commande suivante : 
-#MaxLevelSyslog=debug + 
-#MaxLevelKMsg=notice +<code> 
-#MaxLevelConsole=info +$ ulimit -n 4096
-#MaxLevelWall=emerg +
-#LineMax=48K+
 </code> </code>
  
-====5.1 - Consultation des Journaux====+Pour consulter la liste des limites actuelles, il convient d'utiliser la commande ulimit avec l'option **-a** :
  
-L'utilisation de la commande **journalctl** permet la consultation des journaux :+<code> 
 +[root@redhat9 ~]# ulimit -a 
 +real-time non-blocking time  (microseconds, -R) unlimited 
 +core file size              (blocks, -c) 0 
 +data seg size               (kbytes, -d) unlimited 
 +scheduling priority                 (-e) 0 
 +file size                   (blocks, -f) unlimited 
 +pending signals                     (-i) 30500 
 +max locked memory           (kbytes, -l) 8192 
 +max memory size             (kbytes, -m) unlimited 
 +open files                          (-n) 1024 
 +pipe size                (512 bytes, -p) 8 
 +POSIX message queues         (bytes, -q) 819200 
 +real-time priority                  (-r) 0 
 +stack size                  (kbytes, -s) 8192 
 +cpu time                   (seconds, -t) unlimited 
 +max user processes                  (-u) 30500 
 +virtual memory              (kbytes, -v) unlimited 
 +file locks                          (-x) unlimited 
 +</code> 
 + 
 +====Options de la commande==== 
 + 
 +Les options de **ulimit** sont :
  
 <code> <code>
-[root@centos8 ~]# journalctl +[root@redhat9 ~]# help ulimit 
--- Logs begin at Thu 2021-06-03 09:01:10 EDT, end at Thu 2021-06-03 13:08:01 EDT. -+ulimitulimit [-SHabcdefiklmnpqrstuvxPT] [limit] 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: Linux version 4.18.0-240.22.1.el8_3.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)) #1 SMP Thu Apr 8 19:01:30 UTC 2021 +    Modify shell resource limits
-Jun 03 09:01:10 centos8.ittraining.loc kernel: Command line: BOOT_IMAGE=(hd0,msdos1)/vmlinuz-4.18.0-240.22.1.el8_3.x86_64 root=UUID=4c0cc28c-0d59-45be-bd73-d292b80be33c ro crashkernel=auto resume=UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4> +     
-Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers' +    Provides control over the resources available to the shell and processes 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers+    it createson systems that allow such control
-Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers+     
-Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256 +    Options
-Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format. +      -S        use the `softresource limit 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-provided physical RAM map: +      -H        use the `hardresource limit 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable +      -a        all current limits are reported 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved +      -b        the socket buffer size 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved +      -c        the maximum size of core files created 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x0000000000100000-0x00000000dffeffff] usable +      -d        the maximum size of a process's data segment 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000dfff0000-0x00000000dfffffff] ACPI data +      -e        the maximum scheduling priority (`nice') 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved +      -f        the maximum size of files written by the shell and its children 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved +      -i        the maximum number of pending signals 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved +      -k        the maximum number of kqueues allocated for this process 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x0000000100000000-0x000000011fffffff] usable +      -l        the maximum size a process may lock into memory 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: NX (Execute Disable) protection: active +      -m        the maximum resident set size 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: SMBIOS 2.5 present. +      -n        the maximum number of open file descriptors 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: DMI: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 +      -p        the pipe buffer size 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: Hypervisor detected: KVM +      -q        the maximum number of bytes in POSIX message queues 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: kvm-clock: Using msrs 4b564d01 and 4b564d00 +      -r        the maximum real-time scheduling priority 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: kvm-clock: cpu 0, msr 114801001, primary cpu clock +      -s        the maximum stack size 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: kvm-clock: using sched offset of 5675771878 cycles +      -t        the maximum amount of cpu time in seconds 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: clocksource: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_idle_ns: 881590591483 ns +      -u        the maximum number of user processes 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: tsc: Detected 1190.400 MHz processor +      -v        the size of virtual memory 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: e820: update [mem 0x00000000-0x00000fff] usable ==> reserved +      -x        the maximum number of file locks 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: e820: remove [mem 0x000a0000-0x000fffff] usable +      -P        the maximum number of pseudoterminals 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: last_pfn = 0x120000 max_arch_pfn = 0x400000000 +      -R        the maximum time a real-time process can run before blocking 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: MTRR default type: uncachable +      -T        the maximum number of threads 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: MTRR variable ranges disabled: +     
-Jun 03 09:01:10 centos8.ittraining.loc kernel: Disabled +    Not all options are available on all platforms
-Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/PAT: MTRRs disabledskipping PAT initialization too. +     
-Jun 03 09:01:10 centos8.ittraining.loc kernel: CPU MTRRs all blank - virtualized system. +    If LIMIT is givenit is the new value of the specified resource; the 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/PAT: Configuration [0-7]: WB  WT  UC- UC  WB  WT  UC- UC   +    special LIMIT values `soft'`hard'and `unlimited' stand for the 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: last_pfn = 0xdfff0 max_arch_pfn = 0x400000000 +    current soft limitthe current hard limitand no limitrespectively
-Jun 03 09:01:10 centos8.ittraining.loc kernel: found SMP MP-table at [mem 0x0009fff0-0x0009ffff] +    Otherwisethe current value of the specified resource is printed If 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: kexec: Reserving the low 1M of memory for crashkernel +    no option is giventhen -f is assumed
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a010000x114a01fff] PGTABLE +     
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a020000x114a02fff] PGTABLE +    Values are in 1024-byte increments, except for -t, which is in seconds, 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a030000x114a03fff] PGTABLE +    -p, which is in increments of 512 bytes, and -u, which is an unscaled 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a040000x114a04fff] PGTABLE +    number of processes
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a050000x114a05fff] PGTABLE +     
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a06000, 0x114a06fff] PGTABLE +    Exit Status
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a070000x114a07fff] PGTABLE +    Returns success unless an invalid option is supplied or an error occurs.
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a08000, 0x114a08fff] PGTABLE +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BRK [0x114a090000x114a09fff] PGTABLE +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: RAMDISK: [mem 0x34e00000-0x366f7fff] +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: Early table checksum verification disabled +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: RSDP 0x00000000000E0000 000024 (v02 VBOX  ) +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: XSDT 0x00000000DFFF0030 00003C (v01 VBOX   VBOXXSDT 00000001 ASL  00000061) +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: FACP 0x00000000DFFF00F0 0000F4 (v04 VBOX   VBOXFACP 00000001 ASL  00000061) +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: DSDT 0x00000000DFFF0480 002325 (v02 VBOX   VBOXBIOS 00000002 INTL 20190509) +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: FACS 0x00000000DFFF0200 000040 +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: FACS 0x00000000DFFF0200 000040 +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: ACPI: APIC 0x00000000DFFF0240 00006C (v02 VBOX   VBOXAPIC 00000001 ASL  00000061) +
-lines 1-57+
 </code> </code>
  
-<WRAP center round important 60%> +====5.2 - Groupes de Contrôle====
-**Important** : Notez que les messages importants sont en gras, par exemple les messages de niveaux **notice** ou **warning** et que les messages graves sont en rouge. +
-</WRAP>+
  
-====5.2 - Consultation des Journaux d'une Application Spécifique====+Les **Groupes de Contrôles** (//Control Groups//) aussi appelés **CGroups**, sont une façon de contrôler et de limiter des ressources. Les groupes de contrôle permettent l'allocation de ressources, même d'une manière dynamique pendant que le système fonctionne, telles le temps processeur, la mémoire système, la bande réseau, ou une combinaison de ces ressources parmi des groupes de tâches (processus) définis par l'utilisateur et exécutés sur un système.
  
-Pour consulter les entrées concernant une application spécifiqueil suffit de passer l'exécutabley compris son chemin completen argument à la commande journalctl +Les groupes de contrôle v1 sont organisés de manière hiérarchique, comme des processus. Par contre, la comparaison entre les deux démontre que tandis que les processus se trouvent dans une arborescence unique descandant tous du processus init et héritant de l'environnement de leurs parentsles contrôles groupes peuvent être multiples donnant lieu à des arborescences ou **hiérarchies** multiples qui héritent de certains attributs de leurs groupes de contrôle parents. 
 + 
 +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 sont : 
 + 
 +  * **blkio** - utilisé pour établir des limites sur l'accès des entrées/sorties à partir et depuis des périphériques blocs, 
 +  * **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'accès des tâches aux périphériques dans un groupe de contrôle, 
 +  * **freezer** - utilisé pour suspendre ou pour réactiver les tâches dans un groupe de contrôle, 
 +  * **memory** - utilisé pour établir les limites d'utilisation de la mémoire par les tâches d'un groupe de contrôle et pour génèrer des rapports automatiques sur les ressources rmémoire utilisées par ces tâches, 
 +  * **net_cls** - utilisé pour repèrer les paquets réseau avec un identifiant de classe (//classid//) afin de permettre au contrôleur de trafic Linux, **tc**,  d'identifier les paquets provenant d'une tâche particulière d'un groupe de contrôle. 
 +  * **perf_event**  - utilisé pour permettre le monitoring des CGroups avec l'outil perf, 
 +  * **hugetlb** - utilisé pour limiter des ressources sur des pages de mémoire virtuelle de grande taille. 
 + 
 +A l'opposé des cgroups v1, cgroup v2 n'a qu'une seule arborescence ou hiérarchie et donc un seul point de montage. Tous les contrôleurs compatibles v2 qui ne sont pas liés à une hiérarchie v1 sont automatiquement liés à la hiérarchie v2. Un contrôleur inactif dans la hiérarchie v2 peut être lié à un autre hiérarchie. La migration d'un contrôleur d'une hiérarchie à une autre hiérarchie n'est possible que dans le cas où le contrôleur est désactivé et n'est plus référencé dans la hiérarchie d'origine. 
 + 
 +Pour vérifier l'utilisation de cgroups v2, il convient de visualiser le point de montage :
  
 <code> <code>
-[root@centos8 ~]# journalctl /sbin/anacron +[root@redhat9 ~]# mount -l | grep cgroup 
--- Logs begin at Thu 2021-06-03 09:01:10 EDT, end at Thu 2021-06-03 13:10:01 EDT. -+cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,seclabel,nsdelegate,memory_recursiveprot)
-Jun 03 10:01:01 centos8.ittraining.loc anacron[2575]: Anacron started on 2021-06-03 +
-Jun 03 10:01:01 centos8.ittraining.loc anacron[2575]: Will run job `cron.daily' in 15 min. +
-Jun 03 10:01:01 centos8.ittraining.loc anacron[2575]: Jobs will be executed sequentially +
-Jun 03 10:16:01 centos8.ittraining.loc anacron[2575]: Job `cron.daily' started +
-Jun 03 10:16:01 centos8.ittraining.loc anacron[2575]: Job `cron.daily' terminated +
-Jun 03 10:16:01 centos8.ittraining.loc anacron[2575]: Normal exit (1 job run)+
 </code> </code>
  
-<WRAP center round important 60%> +et de consulter le contenu de ce point de montage :
-**Important** : Rappelez-vous que sous RHEL/CentOS 8 le répertoire **/sbin** est un lien symbolique vers **/usr/sbin**. +
-</WRAP>+
  
-====5.Consultation des Journaux depuis le Dernier Démarrage====+<code> 
 +[root@redhat9 ~]# ls -l /sys/fs/cgroup/ 
 +total 0 
 +-r--r--r-- 1 root root 0 Oct 22 15:36 cgroup.controllers 
 +-rw-r--r--.  1 root root 0 Oct 23 13:46 cgroup.max.depth 
 +-rw-r--r--.  1 root root 0 Oct 23 13:46 cgroup.max.descendants 
 +-rw-r--r--.  1 root root 0 Oct 22 15:36 cgroup.procs 
 +-r--r--r--.  1 root root 0 Oct 23 13:46 cgroup.stat 
 +-rw-r--r--.  1 root root 0 Oct 23 13:09 cgroup.subtree_control 
 +-rw-r--r--.  1 root root 0 Oct 23 13:46 cgroup.threads 
 +-r--r--r--.  1 root root 0 Oct 23 13:46 cpuset.cpus.effective 
 +-r--r--r--.  1 root root 0 Oct 23 13:46 cpuset.cpus.isolated 
 +-r--r--r--.  1 root root 0 Oct 23 13:46 cpuset.mems.effective 
 +-r--r--r--.  1 root root 0 Oct 23 13:46 cpu.stat 
 +drwxr-xr-x.  2 root root 0 Oct 22 15:36 dev-hugepages.mount 
 +drwxr-xr-x.  2 root root 0 Oct 22 15:36 dev-mqueue.mount 
 +drwxr-xr-x.  2 root root 0 Oct 22 15:36 init.scope 
 +-r--r--r--.  1 root root 0 Oct 23 13:46 io.stat 
 +-r--r--r--.  1 root root 0 Oct 23 13:46 memory.numa_stat 
 +--w-------.  1 root root 0 Oct 23 13:46 memory.reclaim 
 +-r--r--r--.  1 root root 0 Oct 23 13:46 memory.stat 
 +-r--r--r--.  1 root root 0 Oct 23 13:46 misc.capacity 
 +-r--r--r--.  1 root root 0 Oct 23 13:46 misc.current 
 +drwxr-xr-x.  2 root root 0 Oct 22 15:36 sys-fs-fuse-connections.mount 
 +drwxr-xr-x.  2 root root 0 Oct 22 15:36 sys-kernel-config.mount 
 +drwxr-xr-x.  2 root root 0 Oct 22 15:36 sys-kernel-debug.mount 
 +drwxr-xr-x.  2 root root 0 Oct 22 15:36 sys-kernel-tracing.mount 
 +drwxr-xr-x. 37 root root 0 Oct 23 13:46 system.slice 
 +drwxr-xr-x.  4 root root 0 Oct 23 12:40 user.slice 
 +</code> 
 + 
 +Sous RedHat 9, **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'arborescence des unités de Systemd. 
 + 
 +En haut de l'arborescence des unités de Systemd se trouve la tranche root - **-.slice**, dont dépend : 
 + 
 +  * le **system.slice** - l'emplacement des services système, 
 +  * le **user.slice** - l'emplacement des sessions des utilisateurs, 
 +  * le **machine.slice** - l'emplacement des machines virtuelles et conteneurs. 
 + 
 +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 : 
 + 
 +<code> 
 +[root@redhat9 ~]# systemctl list-units --type=slice 
 +  UNIT                                        LOAD   ACTIVE SUB    DESCRIPTION                            
 +  -.slice                                     loaded active active Root Slice 
 +  system-getty.slice                          loaded active active Slice /system/getty 
 +  system-modprobe.slice                       loaded active active Slice /system/modprobe 
 +  system-sshd\x2dkeygen.slice                 loaded active active Slice /system/sshd-keygen 
 +  system-systemd\x2dhibernate\x2dresume.slice loaded active active Slice /system/systemd-hibernate-resume 
 +  system.slice                                loaded active active System Slice 
 +  user-1000.slice                             loaded active active User Slice of UID 1000 
 +  user-42.slice                               loaded active active User Slice of UID 42 
 +  user.slice                                  loaded active active User and Session 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. 
 +9 loaded units listed. Pass --all to see loaded but inactive units, too. 
 +To show all installed unit files use 'systemctl list-unit-files'
 +</code>
  
-Pour consulter les entrées depuis le dernier démarrage, il suffit d'utiliser l'option **-b** de la commande journalctl +L'arborescence des unités de Systemd est la suivante :
  
 <code> <code>
-[root@centos8 ~]# journalctl -| more +[root@redhat9 ~]# systemd-cgls | more 
--- Logs begin at Thu 2021-06-03 09:01:10 EDT, end at Thu 2021-06-03 13:11:01 EDT-- +Control group /: 
-Jun 03 09:01:10 centos8.ittraining.loc kernelLinux version 4.18.0-240.22.1.el8_3.x86_64 (mockbuild@kbuilder.bsys.centos.org(gcc version +-.slice 
- 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)) #1 SMP Thu Apr 8 19:01:30 UTC 2021 +├─user.slice (#1202) 
-Jun 03 09:01:10 centos8.ittraining.loc kernelCommand line: BOOT_IMAGE=(hd0,msdos1)/vmlinuz-4.18.0-240.22.1.el8_3.x86_64 root=UUID=4c0cc28 +│ → user.invocation_idf644c59b13764d598a66e47b9f64fdd8 
-c-0d59-45be-bd73-d292b80be33c ro crashkernel=auto resume=UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4 rhgb quiet +│ → trusted.invocation_id: f644c59b13764d598a66e47b9f64fdd8 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers' +│ ├─user-42.slice (#4140
-Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers' +│ │ → user.invocation_id: a6d1a9aebb5f4d4d97c358cffc55c31c 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers' +│ │ → trusted.invocation_id: a6d1a9aebb5f4d4d97c358cffc55c31c 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256 +│ │ ├─session-c1.scope (#4392) 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format. +│ │ │ → user.invocation_ida63e3d93bdf0417b9448307698944a77 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-provided physical RAM map: +│ │ │ → trusted.invocation_ida63e3d93bdf0417b9448307698944a77 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable +│ │ │ ├─1036 gdm-session-worker [pam/gdm-launch-environment] 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved +│ │ │ ├─1626 /usr/libexec/gdm-wayland-session --register-session dbus-run-sessi… 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved +│ │ │ ├─1631 dbus-run-session -- gnome-session --autostart /usr/share/gdm/greet… 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x0000000000100000-0x00000000dffeffff] usable +│ │ │ ├─1632 dbus-daemon --nofork --print-address 4 --session 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000dfff0000-0x00000000dfffffff] ACPI data +│ │ │ ├─1633 /usr/libexec/gnome-session-binary --autostart /usr/share/gdm/greet… 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved +│ │ │ ├─1641 /usr/bin/gnome-shell 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved +│ │ │ ├─1660 /usr/libexec/at-spi-bus-launcher 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved +│ │ │ ├─1665 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/acc… 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: BIOS-e820: [mem 0x0000000100000000-0x000000011fffffff] usable +│ │ │ ├─1671 /usr/bin/Xwayland :1024 -rootless -noreset -accessx -core -auth /r… 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: NX (Execute Disableprotection: active +│ │ │ ├─1678 /usr/libexec/xdg-permission-store 
-Jun 03 09:01:10 centos8.ittraining.loc kernelSMBIOS 2.5 present. +│ │ │ ├─1741 /usr/bin/gjs /usr/share/gnome-shell/org.gnome.Shell.Notifications 
-Jun 03 09:01:10 centos8.ittraining.loc kernelDMI: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 +│ │ │ ├─1743 /usr/libexec/at-spi2-registryd --use-gnome-session 
-Jun 03 09:01:10 centos8.ittraining.loc kernelHypervisor detected: KVM +│ │ │ ├─1747 /usr/libexec/gsd-sharing 
-Jun 03 09:01:10 centos8.ittraining.loc kernelkvm-clock: Using msrs 4b564d01 and 4b564d00 +│ │ │ ├─1749 /usr/libexec/gsd-wacom 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: kvm-clock: cpu 0, msr 114801001, primary cpu clock +│ │ │ ├─1752 /usr/libexec/gsd-color 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: kvm-clock: using sched offset of 5675771878 cycles +│ │ │ ├─1753 /usr/libexec/gsd-keyboard 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: clocksource: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_idle_ns: 881 +│ │ │ ├─1754 /usr/libexec/gsd-print-notifications 
-590591483 ns +│ │ │ ├─1755 /usr/libexec/gsd-rfkill 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: tsc: Detected 1190.400 MHz processor +│ │ │ ├─1756 /usr/libexec/gsd-smartcard 
-Jun 03 09:01:10 centos8.ittraining.loc kernel: e820: update [mem 0x00000000-0x00000fff] usable ==> reserved+│ │ │ ├─1757 /usr/libexec/gsd-datetime 
 +│ │ │ ├─1758 /usr/libexec/gsd-media-keys 
 +│ │ │ ├─1759 /usr/libexec/gsd-screensaver-proxy 
 +│ │ │ ├─1764 /usr/libexec/gsd-sound 
 +│ │ │ ├─1765 /usr/libexec/gsd-a11y-settings 
 +│ │ │ ├─1766 /usr/libexec/gsd-housekeeping 
 +│ │ │ ├─1767 /usr/libexec/gsd-power 
 +│ │ │ ├─1887 /usr/libexec/gsd-printer 
 +│ │ │ ├─2038 /usr/bin/gjs /usr/share/gnome-shell/org.gnome.ScreenSaver 
 +│ │ │ ├─2042 ibus-daemon --panel disable -r --xim 
 +│ │ │ ├─2053 /usr/libexec/ibus-dconf 
 +│ │ │ ├─2055 /usr/libexec/ibus-x11 --kill-daemon 
 +│ │ │ ├─2060 /usr/libexec/ibus-portal 
 +│ │ │ └─2081 /usr/libexec/ibus-engine-simple 
 +│ │ └─user@42.service … (#4212
 +│ │   → user.delegate1 
 +│ │   → trusted.delegate1 
 +│ │   → user.invocation_idfbec37f4c0ef4488990208d436f2aeb8 
 +│ │   → trusted.invocation_idfbec37f4c0ef4488990208d436f2aeb8 
 +│ │   ├─session.slice (#4509) 
 +│ │   │ ├─pipewire-pulse.service (#4617) 
 +│ │   │ │ └─1696 /usr/bin/pipewire-pulse 
 +│ │   │ ├─wireplumber.service (#4581) 
 +│ │   │ │ └─1695 /usr/bin/wireplumber 
 +│ │   │ └─pipewire.service (#4545)
 --More-- --More--
 </code> </code>
 +
 +En utilisant Systemd, plusieurs ressources peuvent être limitées :
 +
 +  * **CPUWeight** - 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,
 +  * **StartupCPUWeight** - 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%> <WRAP center round important 60%>
-**Important** : Notez que vous pouvez consulter les messages des démarrages précédents, il est possible d'utiliser les options **-b 1**, **-b 2** etc.+**Important** : Consultez le manuel systemd.resource-control(5) pour voir les paramètres CGroup qui peuvent être passés à systemctl.
 </WRAP> </WRAP>
  
-====5.4 - Consultation des Journaux d'une Priorité Spécifique====+Commencez par créer le cgroup enfant **pids** dans le cgroup racine : 
 + 
 +<code> 
 +[root@redhat9 ~]# mkdir /sys/fs/cgroup/pids 
 +</code>
  
-Pour consulter les entrées à partir d'une priorité spécifique et supérieur, il suffit d'utiliser l'option **-p** de la commande journalctl en spécifiant la priorité concernée +Placez le PID du terminal courant dans le fichier **cgroup.procs** du cgroup enfant :
  
 <code> <code>
-[root@centos8 ~]# journalctl -p warning +[root@redhat9 ~]# echo $$ 
--- Logs begin at Thu 2021-06-03 09:01:10 EDT, end at Thu 2021-06-03 13:12:01 EDT. -- +78735 
-Jun 03 09:01:10 centos8.ittraining.loc kernel:  #2 +[root@redhat9 ~]# echo $$ /sys/fs/cgroup/pids/cgroup.procs
-Jun 03 09:01:10 centos8.ittraining.loc kernel:  #3 +
-Jun 03 09:01:10 centos8.ittraining.loc kernel: acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration > +
-Jun 03 09:01:12 centos8.ittraining.loc kernel: e1000: E1000 MODULE IS NOT SUPPORTED +
-Jun 03 09:01:12 centos8.ittraining.loc kernel: [drm:vmw_host_log [vmwgfx]] *ERROR* Failed to send host log message. +
-Jun 03 09:01:12 centos8.ittraining.loc kernel: [drm:vmw_host_log [vmwgfx]] *ERROR* Failed to send host log message. +
-Jun 03 09:01:18 centos8.ittraining.loc kernel: printk: systemd: 19 output lines suppressed due to ratelimiting +
-Jun 03 09:01:20 centos8.ittraining.loc firewalld[874]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration> +
-Jun 03 09:01:21 centos8.ittraining.loc systemd[1]: iscsi.service: Unit cannot be reloaded because it is inactive. +
-Jun 03 09:01:24 centos8.ittraining.loc systemd[1]: iscsi.service: Unit cannot be reloaded because it is inactive. +
-Jun 03 09:01:24 centos8.ittraining.loc systemd[1]: iscsi.service: Unit cannot be reloaded because it is inactive. +
-Jun 03 09:01:26 centos8.ittraining.loc chronyd[850]: System clock wrong by 1.753498 seconds, adjustment started +
-Jun 03 09:01:28 centos8.ittraining.loc chronyd[850]: System clock was stepped by 1.753498 seconds +
-Jun 03 12:46:31 centos8.ittraining.loc chronyd[850]: System clock wrong by 47255.336542 seconds, adjustment started +
-lines 1-15/15 (END)+
 </code> </code>
  
-Les priorités reconnues par Journald sont :+Contrôlez maintenant le contenu du fichier cgroup.procs ainsi que le nombre de PIDs dans le cgroup **pids** :
  
-^ Niveau ^ Priorité ^ Description ^ +<code> 
-| 0 | emerg | Système inutilisable | +[root@redhat9 ~]# cat /sys/fs/cgroup/pids/cgroup.procs 
-| 1 | alert | Action immédiate requise | +78735 
-| 2 | crit | Condition critique atteinte | +81077
-| 3 | err | Erreurs rencontrées | +
-| 4 | warning | Avertissements présentés | +
-| 5 | notice | Condition normale - message important | +
-| 6 | info | Condition normale - message simple | +
-| 7 | debug | Condition normale - message de débogage | +
  
-====5.5 - Consultation des Journaux d'une Plage de Dates ou d'Heures====+[root@redhat9 ~]# cat /sys/fs/cgroup/pids/pids.current 
 +
 +</code>
  
-Pour consulter les entrées d'une plage de dates ou d'heures, il suffit de passer cette plage en argument à la commande journalctl +<WRAP center round important > 
 +**Important** - Notez que le fichier cgroup.procs contient **deux** PIDs. Le premier est celui du Shell tandis que le deuxième est celui de la commande cat. 
 +</WRAP> 
 + 
 +Injectez maintenant la valeur de **5** dans le fichier **pids.max** du cgroup ** pids** :
  
 <code> <code>
-[root@centos8 ~]# journalctl --since 12:00 --until now +[root@redhat9 ~]# echo 5 > /sys/fs/cgroup/pids/pids.max
--- Logs begin at Thu 2021-06-03 09:01:10 EDT, end at Thu 2021-06-03 13:14:01 EDT. -- +
-Jun 03 12:00:01 centos8.ittraining.loc systemd[1]: Started Session 181 of user trainee. +
-Jun 03 12:00:01 centos8.ittraining.loc CROND[4238]: (trainee) CMD (/bin/pwd pwd.txt) +
-Jun 03 12:00:01 centos8.ittraining.loc systemd[1]: session-181.scope: Succeeded. +
-Jun 03 12:01:01 centos8.ittraining.loc CROND[4251]: (root) CMD (run-parts /etc/cron.hourly) +
-Jun 03 12:01:01 centos8.ittraining.loc systemd[1]: Started Session 182 of user trainee. +
-Jun 03 12:01:01 centos8.ittraining.loc run-parts[4255]: (/etc/cron.hourly) starting 0anacron +
-Jun 03 12:01:01 centos8.ittraining.loc CROND[4260]: (trainee) CMD (/bin/pwd > pwd.txt) +
-Jun 03 12:01:01 centos8.ittraining.loc run-parts[4262]: (/etc/cron.hourly) finished 0anacron +
-Jun 03 12:01:01 centos8.ittraining.loc systemd[1]: session-182.scope: Succeeded. +
-Jun 03 12:02:01 centos8.ittraining.loc systemd[1]: Started Session 183 of user trainee. +
-Jun 03 12:02:01 centos8.ittraining.loc CROND[4275]: (trainee) CMD (/bin/pwd > pwd.txt) +
-Jun 03 12:02:01 centos8.ittraining.loc systemd[1]: session-183.scope: Succeeded. +
-Jun 03 12:03:01 centos8.ittraining.loc systemd[1]: Started Session 184 of user trainee. +
-Jun 03 12:03:01 centos8.ittraining.loc CROND[4289]: (trainee) CMD (/bin/pwd > pwd.txt) +
-Jun 03 12:03:01 centos8.ittraining.loc systemd[1]: session-184.scope: Succeeded. +
-Jun 03 12:04:01 centos8.ittraining.loc systemd[1]: Started Session 185 of user trainee. +
-Jun 03 12:04:01 centos8.ittraining.loc CROND[4303]: (trainee) CMD (/bin/pwd > pwd.txt) +
-Jun 03 12:04:01 centos8.ittraining.loc systemd[1]: session-185.scope: Succeeded. +
-Jun 03 12:05:01 centos8.ittraining.loc systemd[1]: Started Session 186 of user trainee. +
-Jun 03 12:05:01 centos8.ittraining.loc CROND[4319]: (trainee) CMD (/bin/pwd > pwd.txt) +
-Jun 03 12:05:01 centos8.ittraining.loc systemd[1]: session-186.scope: Succeeded. +
-Jun 03 12:06:02 centos8.ittraining.loc systemd[1]: Started Session 187 of user trainee. +
-Jun 03 12:06:02 centos8.ittraining.loc CROND[4332]: (trainee) CMD (/bin/pwd > pwd.txt) +
-Jun 03 12:06:02 centos8.ittraining.loc systemd[1]: session-187.scope: Succeeded. +
-Jun 03 12:07:01 centos8.ittraining.loc systemd[1]: Started Session 188 of user trainee. +
-Jun 03 12:07:01 centos8.ittraining.loc CROND[4346]: (trainee) CMD (/bin/pwd > pwd.txt) +
-Jun 03 12:07:01 centos8.ittraining.loc systemd[1]: session-188.scope: Succeeded. +
-Jun 03 12:08:01 centos8.ittraining.loc systemd[1]: Started Session 189 of user trainee. +
-Jun 03 12:08:01 centos8.ittraining.loc CROND[4360]: (trainee) CMD (/bin/pwd > pwd.txt) +
-Jun 03 12:08:01 centos8.ittraining.loc systemd[1]: session-189.scope: Succeeded. +
-lines 1-31+
 </code> </code>
  
-<WRAP center round important 60%+Lancez la commande suivante pour créer 6 pids dans le cgroup : 
-**Important** : Il est possible d'utiliser des mots clefs : **yesterday**, **today**, **tomorrow**, **now**.+ 
 +<code> 
 +[root@redhat9 ~]# for a in $(seq 1 5); do sleep 60 & done 
 +[1] 81126 
 +[2] 81127 
 +[3] 81128 
 +[4] 81129 
 +-bash: fork: retry: Resource temporarily unavailable 
 +-bash: fork: retry: Resource temporarily unavailable 
 +-bash: fork: retry: Resource temporarily unavailable 
 +-bash: fork: retry: Resource temporarily unavailable 
 +-bash: fork: Resource temporarily unavailable 
 +</code> 
 + 
 +<WRAP center round important > 
 +**Important** - Notez qu'à la tentative de création du 6ème processus, une erreur est retournée. Le système tente ensuite 4 fois de plus puis renonce finalement avec le message d'erreur **-bash: fork: Resource temporarily unavailable**.
 </WRAP> </WRAP>
  
-====5.6 - Consultation des Journaux en Live====+Dernièrement, essayez de supprimer le cgroup **pids** :
  
-Pour consulter les journaux en live, il suffit d'utiliser l'option **-f** de la commande journalctl +<code> 
 +[root@redhat9 ~]# rmdir /sys/fs/cgroup/pids 
 +rmdir: failed to remove '/sys/fs/cgroup/pids': Device or resource busy 
 +[1]   Done                    sleep 60 
 +[2]   Done                    sleep 60 
 +[3]-  Done                    sleep 60 
 +[4]+  Done                    sleep 60 
 +</code> 
 + 
 +<WRAP center round important > 
 +**Important** - Notez qu'il n'est pas possible de supprimer un cgroup tant que celui-ci contient un processus. 
 +</WRAP> 
 + 
 +Déplacez le processus du terminal courant dans le cgroup racine :
  
 <code> <code>
-[root@centos8 ~]# journalctl -f +[root@redhat9 ~]# echo $$ > /sys/fs/cgroup/cgroup.procs
--- Logs begin at Thu 2021-06-03 09:01:10 EDT. -- +
-Jun 03 13:13:08 centos8.ittraining.loc systemd[1]: Started dnf makecache. +
-Jun 03 13:14:01 centos8.ittraining.loc systemd[1]: Started Session 256 of user trainee. +
-Jun 03 13:14:01 centos8.ittraining.loc CROND[5391]: (trainee) CMD (/bin/pwd pwd.txt) +
-Jun 03 13:14:01 centos8.ittraining.loc systemd[1]: session-256.scope: Succeeded. +
-Jun 03 13:15:01 centos8.ittraining.loc systemd[1]: Started Session 257 of user trainee. +
-Jun 03 13:15:01 centos8.ittraining.loc CROND[5407]: (trainee) CMD (/bin/pwd > pwd.txt) +
-Jun 03 13:15:01 centos8.ittraining.loc systemd[1]: session-257.scope: Succeeded. +
-Jun 03 13:16:02 centos8.ittraining.loc systemd[1]: Started Session 258 of user trainee. +
-Jun 03 13:16:02 centos8.ittraining.loc CROND[5420]: (trainee) CMD (/bin/pwd > pwd.txt) +
-Jun 03 13:16:02 centos8.ittraining.loc systemd[1]: session-258.scope: Succeeded. +
-^C+
 </code> </code>
  
-Ouvrez un deuxième terminal et saisissez la commande suivante :+Il est maintenant possible de supprimer le cgroup **pids** :
  
 <code> <code>
-[trainee@centos8 ~]$ logger -p user.info Linux est super+[root@redhat9 ~]# rmdir /sys/fs/cgroup/pids 
 +[root@redhat9 ~]#
 </code> </code>
  
-Retournez consulter le premier terminal :+Il existe deux façons de limiter les ressources de la CPU : 
 + 
 +  * **CPU bandwidth**, 
 +    * un système de limitation basé sur un pourcentage de CPU pour un ou plusieurs processus, 
 +  * **CPU weight**, 
 +    * un système de limitation basé sur la prioritisassion d'un ou de plusieurs processus par rapports aux autres processus. 
 + 
 +Dans l'exemple suivant, vous allez mettre en place une limite de type **CPU bandwidth**. 
 + 
 +Commencez par créer un service appelé **foo** :
  
 <code> <code>
-[root@centos8 ~]# journalctl -f +[root@redhat9 ~]# vi /lib/systemd/system/foo.service 
--- Logs begin at Thu 2021-06-03 09:01:10 EDT. -- +[root@redhat9 ~]# cat /lib/systemd/system/foo.service 
-Jun 03 13:13:08 centos8.ittraining.loc systemd[1]: Started dnf makecache. +[Unit
-Jun 03 13:14:01 centos8.ittraining.loc systemd[1]: Started Session 256 of user trainee. +Description=The foo service that does nothing useful 
-Jun 03 13:14:01 centos8.ittraining.loc CROND[5391]: (trainee) CMD (/bin/pwd > pwd.txt) +After=remote-fs.target nss-lookup.target 
-Jun 03 13:14:01 centos8.ittraining.loc systemd[1]: session-256.scope: Succeeded. + 
-Jun 03 13:15:01 centos8.ittraining.loc systemd[1]: Started Session 257 of user trainee. +[Service
-Jun 03 13:15:01 centos8.ittraining.loc CROND[5407]: (trainee) CMD (/bin/pwd > pwd.txt) +ExecStart=/usr/bin/sha1sum /dev/zero  
-Jun 03 13:15:01 centos8.ittraining.loc systemd[1]: session-257.scope: Succeeded. +ExecStop=/bin/kill -WINCH ${MAINPID} 
-Jun 03 13:16:02 centos8.ittraining.loc systemd[1]: Started Session 258 of user trainee. + 
-Jun 03 13:16:02 centos8.ittraining.loc CROND[5420]: (trainee) CMD (/bin/pwd > pwd.txt) +[Install] 
-Jun 03 13:16:02 centos8.ittraining.loc systemd[1]: session-258.scope: Succeeded. +WantedBy=multi-user.target
-Jun 03 13:17:01 centos8.ittraining.loc systemd[1]: Started Session 259 of user trainee. +
-Jun 03 13:17:01 centos8.ittraining.loc CROND[5436]: (trainee) CMD (/bin/pwd > pwd.txt) +
-Jun 03 13:17:01 centos8.ittraining.loc systemd[1]: session-259.scope: Succeeded. +
-Jun 03 13:17:19 centos8.ittraining.loc sshd[5439]: Accepted password for trainee from 10.0.2.2 port 39906 ssh2 +
-Jun 03 13:17:19 centos8.ittraining.loc systemd-logind[880]: New session 260 of user trainee+
-Jun 03 13:17:19 centos8.ittraining.loc systemd[1]: Started Session 260 of user trainee. +
-Jun 03 13:17:19 centos8.ittraining.loc sshd[5439]: pam_unix(sshd:session): session opened for user trainee by (uid=0) +
-Jun 03 13:17:34 centos8.ittraining.loc trainee[5470]: Linux est super +
-Jun 03 13:17:34 centos8.ittraining.loc rsyslogd[1113]: imjournal: journal files changed, reloading...  [v8.1911.0-6.el8 try https://www.rsyslog.com/e/0 ] +
-Jun 03 13:18:01 centos8.ittraining.loc systemd[1]: Started Session 261 of user trainee. +
-Jun 03 13:18:01 centos8.ittraining.loc CROND[5481]: (trainee) CMD (/bin/pwd > pwd.txt) +
-Jun 03 13:18:01 centos8.ittraining.loc systemd[1]: session-261.scope: Succeeded. +
-^C+
 </code> </code>
  
-<WRAP center round important 60%> +Démarrez et activez le service : 
-**Important** : Notez la présence de la ligne **Jun 03 13:17:34 centos8.ittraining.loc trainee[5470]: Linux est super**. + 
 +<code> 
 +[root@redhat9 ~]# systemctl enable --now foo.service 
 +Created symlink /etc/systemd/system/multi-user.target.wants/foo.service → /usr/lib/systemd/system/foo.service. 
 + 
 +[root@redhat9 ~]# systemctl status foo.service 
 +● foo.service - The foo service that does nothing useful 
 +     Loaded: loaded (/usr/lib/systemd/system/foo.service; enabled; preset: disabled) 
 +     Active: active (running) since Wed 2024-10-23 13:59:27 CEST; 10s ago 
 +   Main PID: 81361 (sha1sum) 
 +      Tasks: 1 (limit: 48800) 
 +     Memory: 808.0K 
 +        CPU: 10.270s 
 +     CGroup: /system.slice/foo.service 
 +             └─81361 /usr/bin/sha1sum /dev/zero 
 + 
 +Oct 23 13:59:27 redhat9.ittraining.loc systemd[1]: Started The foo service that does nothing useful. 
 +</code> 
 + 
 +Utilisez la commande **ps** pour voir le pourcentage de la CPU utilisé par ce service : 
 + 
 +<code> 
 +[root@redhat9 ~]# ps -p 81361 -o pid,comm,cputime,%cpu 
 +    PID COMMAND             TIME %CPU 
 +  81361 sha1sum         00:00:50 99.3 
 +</code
 + 
 +Créez maintenant un autre service dénommé **bar** : 
 + 
 +<code> 
 +[root@redhat9 ~]# vi /lib/systemd/system/bar.service 
 +[root@redhat9 ~]# cat /lib/systemd/system/bar.service 
 +[Unit] 
 +Description=The bar service that does nothing useful 
 +After=remote-fs.target nss-lookup.target 
 + 
 +[Service] 
 +ExecStart=/usr/bin/md5sum /dev/zero  
 +ExecStop=/bin/kill -WINCH ${MAINPID} 
 + 
 +[Install] 
 +WantedBy=multi-user.target 
 +</code> 
 + 
 +Démarrez et activez le service : 
 + 
 +<code> 
 +[root@redhat9 ~]# systemctl enable --now bar.service 
 +Created symlink /etc/systemd/system/multi-user.target.wants/bar.service → /usr/lib/systemd/system/bar.service. 
 + 
 +[root@redhat9 ~]# systemctl status bar.service 
 +● bar.service - The bar service that does nothing useful 
 +     Loaded: loaded (/usr/lib/systemd/system/bar.service; enabled; preset: disabled) 
 +     Active: active (running) since Wed 2024-10-23 14:01:46 CEST; 21s ago 
 +   Main PID: 81448 (md5sum) 
 +      Tasks: 1 (limit: 48800) 
 +     Memory: 808.0K 
 +        CPU: 21.195s 
 +     CGroup: /system.slice/bar.service 
 +             └─81448 /usr/bin/md5sum /dev/zero 
 + 
 +Oct 23 14:01:46 redhat9.ittraining.loc systemd[1]: Started The bar service that does nothing useful. 
 +</code> 
 + 
 +Utilisez la commande **ps** pour voir le pourcentage de la CPU utilisé par ce service : 
 + 
 +<code> 
 +[root@redhat9 ~]# ps -p 81448 -o pid,comm,cputime,%cpu 
 +    PID COMMAND             TIME %CPU 
 +  81448 md5sum          00:01:34 99.1 
 +</code> 
 + 
 +Vérifiez maintenant la présence des contrôleurs **cpuset** et **cpu** dans l'arborescence du cgroup racine qui est monté à **/sys/fs/cgroup/** : 
 + 
 +<code> 
 +[root@redhat9 ~]# cat /sys/fs/cgroup/cgroup.controllers 
 +cpuset cpu io memory hugetlb pids rdma misc           
 +</code> 
 + 
 +Activez maintenant le contrôleur **cpuset** : 
 + 
 +<code> 
 +[root@redhat9 ~]# cat /sys/fs/cgroup/cgroup.subtree_control 
 +cpu io memory pids 
 + 
 +[root@redhat9 ~]# echo "+cpuset" >> /sys/fs/cgroup/cgroup.subtree_control 
 + 
 +[root@redhat9 ~]# cat /sys/fs/cgroup/cgroup.subtree_control 
 +cpuset cpu io memory pids         
 +</code> 
 + 
 +Créez le cgroup **enfant** appelé **FooBar** : 
 + 
 +<code> 
 +[root@redhat9 ~]# mkdir /sys/fs/cgroup/FooBar/ 
 + 
 +[root@redhat9 ~]# ls -l /sys/fs/cgroup/FooBar/ 
 +total 0 
 +-r--r--r--. 1 root root 0 Oct 23 14:06 cgroup.controllers 
 +-r--r--r--. 1 root root 0 Oct 23 14:06 cgroup.events 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 cgroup.freeze 
 +--w-------. 1 root root 0 Oct 23 14:06 cgroup.kill 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 cgroup.max.depth 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 cgroup.max.descendants 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 cgroup.procs 
 +-r--r--r--. 1 root root 0 Oct 23 14:06 cgroup.stat 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 cgroup.subtree_control 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 cgroup.threads 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 cgroup.type 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 cpu.idle 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 cpu.max 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 cpu.max.burst 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 cpuset.cpus 
 +-r--r--r--. 1 root root 0 Oct 23 14:06 cpuset.cpus.effective 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 cpuset.cpus.exclusive 
 +-r--r--r--. 1 root root 0 Oct 23 14:06 cpuset.cpus.exclusive.effective 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 cpuset.cpus.partition 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 cpuset.mems 
 +-r--r--r--. 1 root root 0 Oct 23 14:06 cpuset.mems.effective 
 +-r--r--r--. 1 root root 0 Oct 23 14:06 cpu.stat 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 cpu.weight 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 cpu.weight.nice 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 io.bfq.weight 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 io.latency 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 io.max 
 +-r--r--r--. 1 root root 0 Oct 23 14:06 io.stat 
 +-r--r--r--. 1 root root 0 Oct 23 14:06 memory.current 
 +-r--r--r--. 1 root root 0 Oct 23 14:06 memory.events 
 +-r--r--r--. 1 root root 0 Oct 23 14:06 memory.events.local 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 memory.high 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 memory.low 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 memory.max 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 memory.min 
 +-r--r--r--. 1 root root 0 Oct 23 14:06 memory.numa_stat 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 memory.oom.group 
 +-r--r--r--. 1 root root 0 Oct 23 14:06 memory.peak 
 +--w-------. 1 root root 0 Oct 23 14:06 memory.reclaim 
 +-r--r--r--. 1 root root 0 Oct 23 14:06 memory.stat 
 +-r--r--r--. 1 root root 0 Oct 23 14:06 memory.swap.current 
 +-r--r--r--. 1 root root 0 Oct 23 14:06 memory.swap.events 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 memory.swap.high 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 memory.swap.max 
 +-r--r--r--. 1 root root 0 Oct 23 14:06 memory.swap.peak 
 +-r--r--r--. 1 root root 0 Oct 23 14:06 memory.zswap.current 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 memory.zswap.max 
 +-r--r--r--. 1 root root 0 Oct 23 14:06 pids.current 
 +-r--r--r--. 1 root root 0 Oct 23 14:06 pids.events 
 +-rw-r--r--. 1 root root 0 Oct 23 14:06 pids.max 
 +-r--r--r--. 1 root root 0 Oct 23 14:06 pids.peak        
 +</code> 
 + 
 +Activez les contrôleurs **cpuset** et **cpu** pour le cgroup **FooBar** : 
 + 
 +<code> 
 +[root@redhat9 ~]# echo "+cpu" >> /sys/fs/cgroup/FooBar/cgroup.subtree_control 
 + 
 +[root@redhat9 ~]# echo "+cpuset" >> /sys/fs/cgroup/FooBar/cgroup.subtree_control 
 + 
 +[root@redhat9 ~]# cat /sys/fs/cgroup/cgroup.subtree_control /sys/fs/cgroup/FooBar/cgroup.subtree_control 
 +cpuset cpu io memory pids 
 +cpuset cpu          
 +</code> 
 + 
 +<WRAP center round important > 
 +**Important** - Notez qu'il n'est pas possible d'activer les contrôleurs pour un cgroup enfant si ces mêmes contrôleurs ne sont pas déjà activés pour le cgroup parent. Notez aussi que dans le cgroup **FooBar**, les contrôleurs **memory** et **pids** ne sont **pas** activés.
 </WRAP> </WRAP>
  
-====5.7 - Consultation des Journaux avec des Mots Clefs===+Créez maintenant le répertoire **/sys/fs/cgroup/FooBar/tasks** :
  
-Pour consulter les mots clefs compris par Journald, tapez la commande **journalctl** puis appuyer **deux** fois sur la touche <key>Tab</key> :+<code> 
 +[root@redhat9 ~]# mkdir /sys/fs/cgroup/FooBar/tasks 
 + 
 +[root@redhat9 ~]# ls -l /sys/fs/cgroup/FooBar/tasks 
 +total 0 
 +-r--r--r--. 1 root root 0 Oct 23 14:08 cgroup.controllers 
 +-r--r--r--. 1 root root 0 Oct 23 14:08 cgroup.events 
 +-rw-r--r--. 1 root root 0 Oct 23 14:08 cgroup.freeze 
 +--w-------. 1 root root 0 Oct 23 14:08 cgroup.kill 
 +-rw-r--r--. 1 root root 0 Oct 23 14:08 cgroup.max.depth 
 +-rw-r--r--. 1 root root 0 Oct 23 14:08 cgroup.max.descendants 
 +-rw-r--r--. 1 root root 0 Oct 23 14:08 cgroup.procs 
 +-r--r--r--. 1 root root 0 Oct 23 14:08 cgroup.stat 
 +-rw-r--r--. 1 root root 0 Oct 23 14:08 cgroup.subtree_control 
 +-rw-r--r--. 1 root root 0 Oct 23 14:08 cgroup.threads 
 +-rw-r--r--. 1 root root 0 Oct 23 14:08 cgroup.type 
 +-rw-r--r--. 1 root root 0 Oct 23 14:08 cpu.idle 
 +-rw-r--r--. 1 root root 0 Oct 23 14:08 cpu.max 
 +-rw-r--r--. 1 root root 0 Oct 23 14:08 cpu.max.burst 
 +-rw-r--r--. 1 root root 0 Oct 23 14:08 cpuset.cpus 
 +-r--r--r--. 1 root root 0 Oct 23 14:08 cpuset.cpus.effective 
 +-rw-r--r--. 1 root root 0 Oct 23 14:08 cpuset.cpus.exclusive 
 +-r--r--r--. 1 root root 0 Oct 23 14:08 cpuset.cpus.exclusive.effective 
 +-rw-r--r--. 1 root root 0 Oct 23 14:08 cpuset.cpus.partition 
 +-rw-r--r--. 1 root root 0 Oct 23 14:08 cpuset.mems 
 +-r--r--r--. 1 root root 0 Oct 23 14:08 cpuset.mems.effective 
 +-r--r--r--. 1 root root 0 Oct 23 14:08 cpu.stat 
 +-rw-r--r--. 1 root root 0 Oct 23 14:08 cpu.weight 
 +-rw-r--r--. 1 root root 0 Oct 23 14:08 cpu.weight.nice        
 +</code> 
 + 
 +<WRAP center round important > 
 +**Important** - Le répertoire **/sys/fs/cgroup/FooBar/tasks** définit un groupe //enfant// du cgroup FooBar qui ne concerne que les contrôleurs **cpuset** et **cpu**. 
 +</WRAP> 
 + 
 +De façon à ce que les deux processus issus des services **foo** et **bar** se font concurrence sur la même CPU, injectez la valeur de **1** dans le fichier **/sys/fs/cgroup/FooBar/tasks/cpuset.cpus** :
  
 <code> <code>
-[root@centos8 ~]# journalctl [tab[tab] +[root@redhat9 ~]# echo "1" > /sys/fs/cgroup/FooBar/tasks/cpuset.cpus  
-_AUDIT_LOGINUID=              _HOSTNAME=                    NM_DEVICE=                    _SYSTEMD_SESSION= + 
-_AUDIT_SESSION=               INITRD_USEC=                  NM_LOG_DOMAINS=               _SYSTEMD_SLICE= +[root@redhat9 ~]# cat /sys/fs/cgroup/FooBar/tasks/cpuset.cpus 
-AVAILABLE=                    INVOCATION_ID=                NM_LOG_LEVEL=                 _SYSTEMD_UNIT= +1     
-AVAILABLE_PRETTY=             JOB_ID=                       N_RESTARTS=                   _SYSTEMD_USER_SLICE= +
-_BOOT_ID=                     JOB_RESULT=                   _PID=                         _SYSTEMD_USER_UNIT= +
-_CAP_EFFECTIVE=               JOB_TYPE=                     PRIORITY=                     TIMESTAMP_BOOTTIME= +
-_CMDLINE=                     JOURNAL_NAME=                 SEAT_ID=                      TIMESTAMP_MONOTONIC= +
-CODE_FILE=                    JOURNAL_PATH=                 _SELINUX_CONTEXT=             _TRANSPORT= +
-CODE_FUNC=                    _KERNEL_DEVICE=               SESSION_ID=                   _UDEV_DEVNODE= +
-CODE_LINE=                    _KERNEL_SUBSYSTEM=            _SOURCE_MONOTONIC_TIMESTAMP=  _UDEV_SYSNAME= +
-_COMM=                        KERNEL_USEC=                  _SOURCE_REALTIME_TIMESTAMP=   _UID= +
-CURRENT_USE=                  LEADER=                       SSSD_DOMAIN=                  UNIT= +
-CURRENT_USE_PRETTY=           LIMIT=                        _STREAM_ID=                   USER_ID= +
-DISK_AVAILABLE=               LIMIT_PRETTY=                 SYSLOG_FACILITY=              USER_INVOCATION_ID= +
-DISK_AVAILABLE_PRETTY=        _MACHINE_ID=                  SYSLOG_IDENTIFIER=            USERSPACE_USEC= +
-DISK_KEEP_FREE=               MAX_USE=                      SYSLOG_PID=                   USER_UNIT= +
-DISK_KEEP_FREE_PRETTY=        MAX_USE_PRETTY=               _SYSTEMD_CGROUP=               +
-_EXE=                         MESSAGE=                      _SYSTEMD_INVOCATION_ID=        +
-_GID=                         MESSAGE_ID=                   _SYSTEMD_OWNER_UID=   +
 </code> </code>
  
-Pour voir la liste des processus dont les traces sont inclus dans les journaux du mots clefstapez la commande journalctl suivi par le nom d'un mot clef puis appuyer deux fois sur la touche <key>Tab</key> :+<WRAP center round important > 
 +**Important** - Notez que dans les faits, le contrôleur **cpu** n'est activé **que** dans le cas où le cgroup contient au moins 2 processus qui se font concurrence sur la même CPU. 
 +</WRAP> 
 + 
 +Mettez en place une limitation des ressources de la CPU avec la commande suivante :
  
 <code> <code>
-[root@centos8 ~]# journalctl _UID= +[root@redhat9 ~]# echo "200000 1000000" > /sys/fs/cgroup/FooBar/tasks/cpu.max          
-0     1000  81    983   990   992   998    +
-[root@centos8 ~]# journalctl _COMM= +
-anacron          dbus-daemon      kdumpctl         NetworkManager   smartd           sssd_nss         systemd-hiberna   +
-auditd           dnf              logger           polkitd          sm-notify        su               systemd-journal   +
-augenrules       dnsmasq          login            rngd             sshd             (systemd)        systemd-logind    +
-chronyd          dracut-cmdline   lvm              rsyslogd         sssd             systemd          systemd-udevd     +
-crond            firewalld        netcf-transacti  sh               sssd_be          systemd-fsck   +
 </code> </code>
 +
 +<WRAP center round important >
 +**Important** - Dans la commande ci-dessus, le premier nombre est un quota en microsecondes pendant lequel les processus dans le cgroup peuvent s'exécuter dans une **période** de temps donnée. Le deuxième nombre, également exprimé en microsecondes, et la **période**. Autrement dit, les processus dans le cgroup seront limités à une exécution de 200 000 / 1 000 000 = 0.2 secondes pendant chaque seconde. 
 +</WRAP>
 +
 +Ajoutez maintenant les processus des services **foo** et **bar** au cgroup **FooBar** : 
 +
 +<code>
 +[root@redhat9 ~]# echo "81361" > /sys/fs/cgroup/FooBar/tasks/cgroup.procs
 +
 +[root@redhat9 ~]# echo "81448" > /sys/fs/cgroup/FooBar/tasks/cgroup.procs         
 +</code>
 +
 +Vérifiez la prise en compte par le système de la commande précédente :
 +
 +<code>
 +[root@redhat9 ~]# cat /proc/81361/cgroup /proc/81448/cgroup
 +0::/FooBar/tasks
 +0::/FooBar/tasks         
 +</code>
 +
 +Dernièrement, utilisez la commande **top** pour constater que la consommation de la CPU et limitée à 20% sur l'ensemble des processus du cgroup **FooBar** **et** que ces 20% sont répartis en parts égales sur les deux processus **foo** et **bar** :
 +
 +<code>
 +top - 14:14:12 up 22:37,  1 user,  load average: 0.29, 1.23, 0.95
 +Tasks: 205 total,   3 running, 202 sleeping,   0 stopped,   0 zombie
 +%Cpu(s):  5.1 us,  0.1 sy,  0.0 ni, 94.7 id,  0.0 wa,  0.1 hi,  0.1 si,  0.0 st
 +MiB Mem :   7685.1 total,   6139.8 free,    961.7 used,    885.4 buff/cache
 +MiB Swap:   5120.0 total,   5120.0 free,      0.0 used.   6723.4 avail Mem 
 +
 +    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                                                                    
 +  81361 root      20    225364   3456   3072 R  10.0   0.0  12:56.32 sha1sum                                                                                                                                    
 +  81448 root      20    225364   3328   2944 R  10.0   0.0  10:47.05 md5sum               
 +</code>
 +
 +===5.3 - La Commande systemctl set-property===
 +
 +Comme déjà vu, systemd organise les processus dans des **slices**, par exemple les utilisateurs sont regroupés dans **/sys/fs/cgroup/user.slice** :
 +
 +<code>
 +[root@redhat9 ~]# ls -l /sys/fs/cgroup/user.slice
 +total 0
 +-r--r--r--. 1 root root 0 Oct 22 15:36 cgroup.controllers
 +-r--r--r--. 1 root root 0 Oct 22 15:36 cgroup.events
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 cgroup.freeze
 +--w-------. 1 root root 0 Oct 22 15:36 cgroup.kill
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 cgroup.max.depth
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 cgroup.max.descendants
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 cgroup.procs
 +-r--r--r--. 1 root root 0 Oct 22 15:36 cgroup.stat
 +-rw-r--r--. 1 root root 0 Oct 23 14:01 cgroup.subtree_control
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 cgroup.threads
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 cgroup.type
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 cpu.idle
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 cpu.max
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 cpu.max.burst
 +-rw-r--r--. 1 root root 0 Oct 23 14:05 cpuset.cpus
 +-r--r--r--. 1 root root 0 Oct 23 14:05 cpuset.cpus.effective
 +-rw-r--r--. 1 root root 0 Oct 23 14:05 cpuset.cpus.exclusive
 +-r--r--r--. 1 root root 0 Oct 23 14:05 cpuset.cpus.exclusive.effective
 +-rw-r--r--. 1 root root 0 Oct 23 14:05 cpuset.cpus.partition
 +-rw-r--r--. 1 root root 0 Oct 23 14:05 cpuset.mems
 +-r--r--r--. 1 root root 0 Oct 23 14:05 cpuset.mems.effective
 +-r--r--r--. 1 root root 0 Oct 22 15:36 cpu.stat
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 cpu.weight
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 cpu.weight.nice
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 io.bfq.weight
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 io.latency
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 io.max
 +-r--r--r--. 1 root root 0 Oct 22 15:36 io.stat
 +-r--r--r--. 1 root root 0 Oct 22 15:36 memory.current
 +-r--r--r--. 1 root root 0 Oct 22 15:36 memory.events
 +-r--r--r--. 1 root root 0 Oct 22 15:36 memory.events.local
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 memory.high
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 memory.low
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 memory.max
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 memory.min
 +-r--r--r--. 1 root root 0 Oct 22 15:36 memory.numa_stat
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 memory.oom.group
 +-r--r--r--. 1 root root 0 Oct 22 15:36 memory.peak
 +--w-------. 1 root root 0 Oct 22 15:36 memory.reclaim
 +-r--r--r--. 1 root root 0 Oct 22 15:36 memory.stat
 +-r--r--r--. 1 root root 0 Oct 22 15:36 memory.swap.current
 +-r--r--r--. 1 root root 0 Oct 22 15:36 memory.swap.events
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 memory.swap.high
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 memory.swap.max
 +-r--r--r--. 1 root root 0 Oct 22 15:36 memory.swap.peak
 +-r--r--r--. 1 root root 0 Oct 22 15:36 memory.zswap.current
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 memory.zswap.max
 +-r--r--r--. 1 root root 0 Oct 22 15:36 pids.current
 +-r--r--r--. 1 root root 0 Oct 22 15:36 pids.events
 +-rw-r--r--. 1 root root 0 Oct 22 15:36 pids.max
 +-r--r--r--. 1 root root 0 Oct 22 15:36 pids.peak
 +drwxr-xr-x. 4 root root 0 Oct 23 14:14 user-1000.slice
 +drwxr-xr-x. 4 root root 0 Oct 22 15:37 user-42.slice
 +</code>
 +
 +et les processus d'un utilisateur spécifique dans un slice dénommé **user-UID.slice** :
 +
 +<code>
 +[root@redhat9 ~]# ls -l /sys/fs/cgroup/user.slice/user-1000.slice
 +total 0
 +-r--r--r--. 1 root    root    0 Oct 23 12:40 cgroup.controllers
 +-r--r--r--. 1 root    root    0 Oct 23 12:40 cgroup.events
 +-rw-r--r--. 1 root    root    0 Oct 23 12:40 cgroup.freeze
 +--w-------. 1 root    root    0 Oct 23 12:40 cgroup.kill
 +-rw-r--r--. 1 root    root    0 Oct 23 12:40 cgroup.max.depth
 +-rw-r--r--. 1 root    root    0 Oct 23 12:40 cgroup.max.descendants
 +-rw-r--r--. 1 root    root    0 Oct 23 12:40 cgroup.procs
 +-r--r--r--. 1 root    root    0 Oct 23 12:40 cgroup.stat
 +-rw-r--r--. 1 root    root    0 Oct 23 14:01 cgroup.subtree_control
 +-rw-r--r--. 1 root    root    0 Oct 23 12:40 cgroup.threads
 +-rw-r--r--. 1 root    root    0 Oct 23 12:40 cgroup.type
 +-r--r--r--. 1 root    root    0 Oct 23 12:40 cpu.stat
 +-r--r--r--. 1 root    root    0 Oct 23 12:40 memory.current
 +-r--r--r--. 1 root    root    0 Oct 23 12:40 memory.events
 +-r--r--r--. 1 root    root    0 Oct 23 12:40 memory.events.local
 +-rw-r--r--. 1 root    root    0 Oct 23 12:40 memory.high
 +-rw-r--r--. 1 root    root    0 Oct 23 12:40 memory.low
 +-rw-r--r--. 1 root    root    0 Oct 23 12:40 memory.max
 +-rw-r--r--. 1 root    root    0 Oct 23 12:40 memory.min
 +-r--r--r--. 1 root    root    0 Oct 23 12:40 memory.numa_stat
 +-rw-r--r--. 1 root    root    0 Oct 23 12:40 memory.oom.group
 +-r--r--r--. 1 root    root    0 Oct 23 12:40 memory.peak
 +--w-------. 1 root    root    0 Oct 23 12:40 memory.reclaim
 +-r--r--r--. 1 root    root    0 Oct 23 12:40 memory.stat
 +-r--r--r--. 1 root    root    0 Oct 23 12:40 memory.swap.current
 +-r--r--r--. 1 root    root    0 Oct 23 12:40 memory.swap.events
 +-rw-r--r--. 1 root    root    0 Oct 23 12:40 memory.swap.high
 +-rw-r--r--. 1 root    root    0 Oct 23 12:40 memory.swap.max
 +-r--r--r--. 1 root    root    0 Oct 23 12:40 memory.swap.peak
 +-r--r--r--. 1 root    root    0 Oct 23 12:40 memory.zswap.current
 +-rw-r--r--. 1 root    root    0 Oct 23 12:40 memory.zswap.max
 +-r--r--r--. 1 root    root    0 Oct 23 12:40 pids.current
 +-r--r--r--. 1 root    root    0 Oct 23 12:40 pids.events
 +-rw-r--r--. 1 root    root    0 Oct 23 12:40 pids.max
 +-r--r--r--. 1 root    root    0 Oct 23 12:40 pids.peak
 +drwxr-xr-x. 2 root    root    0 Oct 23 12:40 session-2395.scope
 +drwxr-xr-x. 5 trainee trainee 0 Oct 23 12:45 user@1000.service
 +</code>
 +
 +De ce fait, il est possible d'utiliser systemd pour la mise en place des limitations des ressources en utilisant la commande **systemd set-property** :
 +
 +==CPU==
 +
 +<code>
 +[root@redhat9 ~]# systemctl set-property user-1000.slice CPUQuota=40%
 +
 +[root@redhat9 ~]# cat /sys/fs/cgroup/user.slice/user-1000.slice/cpu.max
 +40000 100000
 +</code>
 +
 +==Mémoire==
 +
 +<code>
 +[root@redhat9 ~]# systemctl set-property user-1000.slice MemoryMax=1G
 +
 +[root@redhat9 ~]# cat /sys/fs/cgroup/user.slice/user-1000.slice/memory.max
 +1073741824
 +</code>
 +
 +<WRAP center round important >
 +**Important** - Notez que l'utilisation de **MemoryMax** met en place un **hard limit**. Il est aussi possible de mettre en place un **soft limit** en utilisant **MemoryHigh**. 
 +</WRAP>
  
 ----- -----
 Copyright © 2024 Hugh Norris. Copyright © 2024 Hugh Norris.
Menu