Informazioni di sistema con procinfo
Nei sistemi Linux e BSD, esiste la "directory" /proc che da molte informazioni riguardanti il sistema.
Provate a dare questo comando per vedere cosa c'è dentro:
$ ls -l /proc
Solo che non è molto facile da leggere, soprattutto per i neofiti.
Ma ho scoperto una piccola utility da riga di comando che si occupa di formattare le varie informazioni per renderle più leggibili: procinfo.
Provate a lanciarlo senza parametri:
$ procinfo
Memory: Total Used Free Buffers
RAM: 32785248 8066664 24718584 455556
Swap: 0 0 0
Bootup: Mon Jul 11 09:24:16 2016 Load average: 0.09 0.11 0.09 1/470 18180
user : 04:11:54.19 7.3% page in : 28756888
nice : 00:00:01.60 0.0% page out: 36124012
system: 06:30:31.25 11.4% page act: 7866661
IOwait: 00:15:18.20 0.4% page dea: 0
hw irq: 00:00:00.00 0.0% page flt: 160436368
sw irq: 00:00:43.84 0.0% swap in : 0
idle : 1d 22:17:14.64 80.8% swap out: 0
uptime: 3d 23:11:15.66 context : 580691538
irq 0: 16 2-edge timer irq 25: 0 1-edge dmar1
irq 1: 12 1-edge i8042 irq 27: 1477258 327680-edge xhci_
irq 5: 0 5-edge parport0 irq 28: 1665205 512000-edge ahci[
irq 8: 1 8-edge rtc0 irq 29: 13 360448-edge mei_m
irq 9: 28 9-fasteoi acpi irq 30: 8799908 1572864-edge enp3
irq 12: 19 12-edge i8042 irq 31: 21 49152-edge snd_hd
irq 16: 131 16-fasteoi ehci_h irq 32: 24 32768-edge i915
irq 17: 5678 17-fasteoi snd_hd irq 33: 205 442368-edge snd_h
irq 23: 151 23-fasteoi ehci_h irq 34: 3050368 524288-edge nvidi
irq 24: 0 0-edge dmar0
sda 900972r 641803w sdc 938r 21w
sdb 233r 280w
enp3s0 TX 3.63GiB RX 6.64GiB lo TX 9.65MiB RX 9.65MiB
Ci sono poi diverse opzioni, che danno sempre le stesse info, ma con formattazioni diverse.
Ad esempio, per rendere tutto più leggibile:
$ procinfo -H
Memory: Total Used Free Buffers
RAM: 31.27GiB 7.71GiB 23.56GiB 444.88MiB
Swap: 0.00B 0.00B 0.00B
Bootup: Mon Jul 11 09:24:16 2016 Load average: 0.04 0.10 0.08 2/467 18183
user : 04:11:57.53 7.3% page in : 28756888
nice : 00:00:01.60 0.0% page out: 36141480
system: 06:30:32.00 11.3% page act: 7866661
IOwait: 00:15:18.26 0.4% page dea: 0
hw irq: 00:00:00.00 0.0% page flt: 160453047
sw irq: 00:00:43.85 0.0% swap in : 0
idle : 1d 22:22:57.16 80.9% swap out: 0
uptime: 3d 23:11:59.01 context : 580731332
irq 0: 16 2-edge timer irq 25: 0 1-edge dmar1
irq 1: 12 1-edge i8042 irq 27: 1477983 327680-edge xhci_
irq 5: 0 5-edge parport0 irq 28: 1665347 512000-edge ahci[
irq 8: 1 8-edge rtc0 irq 29: 13 360448-edge mei_m
irq 9: 28 9-fasteoi acpi irq 30: 8799990 1572864-edge enp3
irq 12: 19 12-edge i8042 irq 31: 21 49152-edge snd_hd
irq 16: 131 16-fasteoi ehci_h irq 32: 24 32768-edge i915
irq 17: 5678 17-fasteoi snd_hd irq 33: 205 442368-edge snd_h
irq 23: 151 23-fasteoi ehci_h irq 34: 3051202 524288-edge nvidi
irq 24: 0 0-edge dmar0
sda 900972r 641918w sdc 938r 21w
sdb 233r 280w
enp3s0 TX 3.63GiB RX 6.64GiB lo TX 9.65MiB RX 9.65MiB
Per quanto riguarda le varie opzioni, leggete la pagina man; ma sono queste:
$ procinfo -h
procinfo version 2.0 $Rev: 304 $
usage: procinfo [-sidDSbhHv] [-nN]
-nN pause N second between updates (implies -f)
-d show differences rather than totals (implies -f)
-D show current memory/swap usage, differences on rest
-S with -nN and -d/-D, always show values per second
-b show number of bytes instead of requests for disk statistics
-H show memory stats in KiB/MiB/GiB
-r show memory usage -/+ buffers/cache
-s Don't skip netdevs in /etc/procinfo/skipIfaces
-h print this help
-v print version info
Per quanto riguarda il dettaglio delle varie info:
Memory:
See the man page for free(1)
Bootup:
The time the system was booted.
Load average:
The average number of jobs running, followed by the number of runnable processes and the total number of processes, followed by the PID of the last process run. The pid of the last running
process will probably always be procinfo's PID.
user: The amount of time spent running jobs in user space.
nice: The amount of time spent running niced jobs in user space.
system:
The amount of time spent running in kernel space. Note: the time spent servicing interrupts is not counted by the kernel (and nothing that procinfo can do about it).
idle: The amount of time spent doing nothing.
uptime:
The time that the system has been up. The above four should more or less add up to this one.
page in:
The number of disk blocks paged into core from disk. 1 block is equal to 1 kiB.
page out:
The number of disk blocks paged out of core to disk. This includes regular disk-writes.
swap in:
The number of memory pages paged in from swap.
swap out:
The number of memory pages paged out to swap.
context:
The number of context switches, either since bootup or per interval.
Disk stats(hda, hdb, sda, sdb):
The number of reads and writes made to disks, whether CD-ROM, hard-drive, or USB. Shows all disks if they either are an hdX or sdX, or if they have a non-zero read/write count.
Interrupts:
Number of interrupts serviced since boot, or per interval, listed per IRQ.
E' un bel programmino, anche se va sicuramente studiato un attimo per capire bene le varie informazioni che tira fuori.
Enjoy!
linux proc procinfo
Commentami!