Monitorare Linux in tempo reale con dstat
dstat è un ottimo tool per monitorare la nostra Linux in tempo reale.
Genera statistiche per praticamente qualsiasi cosa, ed è in grado di prendere i dati anche da altri comandi.
Per installarlo su Debian:
# aptitude install dstat
Vediamo qualche esempio:
$ dstat
You did not select any stats, using -cdngy by default.
----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai hiq siq| read writ| recv send| in out | int csw
1 0 99 0 0 0| 11k 26k| 0 0 | 0 0 | 109 169
0 0 100 0 0 0| 0 0 | 300B 1114B| 0 0 | 160 129
0 0 100 0 0 0| 0 0 | 66B 358B| 0 0 | 180 178
0 0 100 0 0 0| 0 0 | 66B 358B| 0 0 | 153 152 ^
Dove:
- CPU stats: uso della CPU per processi utente (usr), processi di sistema (sys), numero di processi idle (idl) e processi in attesa (wai), hard interrupt (hiq) e soft interrupt (siq)
- Disk stats: numero totale di operazioni su disco in lettura (read) and scrittura (writ)
- Network stats: numero totale di bytes ricevuti (recv) e inviati (send)
- Paging stats: infromazioni copiate in (in) e spostate fuori (out) dalla memoria
- System stats: numero di interrupts (int) e context switches (csw)
Se volete visualizzare i vari plugin, esterni ed interni, disponibili:
$ dstat --list
Volendo fare un esempio più approfondito, che mii è giusto servito su un server:
$ dstat -c --top-cpu -dn --top-mem
----total-cpu-usage---- -most-expensive- -dsk/total- -net/total- --most-expensive-
usr sys idl wai hiq siq| cpu process | read writ| recv send| memory process
1 0 99 0 0 0|teamviewerd 0.0| 11k 26k| 0 0 |mysqld 99.0M
0 0 100 0 0 0| | 0 0 | 562B 940B|mysqld 99.0M
0 0 100 0 0 0|kworker/6:0 0.1| 0 0 | 66B 358B|mysqld 99.0M
0 0 100 0 0 0| | 0 0 | 394B 358B|mysqld 99.0M
0 0 100 0 0 0| | 0 0 | 66B 358B|mysqld 99.0M
Questo comando ci da queste informazioni:
- -c: utilizzo CPU
- --top-cpu: processi che consuma più CPU
- -dn: statistiche dico e rete
- --top-mem: processi che consumano più memoria
Enjoy!
linux dstat
Commentami!