#!/bin/bash # # ------------------------------------------------------------------ # made by sputnick in da FreAkY lApPy lAb (c) 2009 # gilles.quenot gmail com # # This program is free software; you can redistribute it and/or # modify it under the terms of version 2 of the GNU General Public # License published by the Free Software Foundation. # (see http://www.gnu.org/licenses/gpl.html). # ------------------------------------------------------------------ # ,,_ # o" )@ # '''' # ------------------------------------------------------------------ # # vim:ts=4:sw=4 echo $'Pimp my vmstat...\n' Head(){ # 19 lignes if [[ $LC_ALL == fr* ]]; then cat<<-EOF "Nombre de processus en competition pour le temps CPU." | "Nombre de processus dormants, bloquants" | | "Quantite de memoire virtuelle utilisee (ko)" | | | "Quantite de memoire libre (ko)" | | | | "Quantite de memoire utilisee comme tampons d'E/S (ko)." | | | | | "Quantite de memoire utilisee comme cache." | | | | | | "Quantite de memoire paginee lue depuis un disque en ko/s." | | | | | | | "Quantite de memoire paginee transferee sur disque en ko/s." | | | | | | | | "Blocs lus par seconde sur des peripheriques orientes bloc." | | | | | | | | | "Blocs ecrits par seconde sur des peripheriques orientes bloc." | | | | | | | | | | "Nombre d'interruptions par seconde, y compris l'horloge." | | | | | | | | | | | "Nombre de changement de contextes par seconde. | | | | | | | | | | | | "temps consomme par les processus utilisateur" | | | | | | | | | | | | | "temps passe dans le noyau." | | | | | | | | | | | | | | "temps CPU inutilise" | | | | | | | | | | | | | | | "temps consomme en attente des E/S. | | | | | | | | | | | | | | | | -procs--- --------memory------------ ---swap-- ---io----- -system--- -----------cpu--------- r b swpd free buff cache si so bi bo in cs us sy id wa EOF else cat<<-EOF "The number of processes waiting for run time." | "The number of processes in uninterruptible sleep." | | "the amount of virtual memory used." | | | "the amount of idle memory." | | | | "the amount of memory used as buffers." | | | | | "the amount of memory used as cache." | | | | | | "Amount of memory swapped in from disk (/s)." | | | | | | | "Amount of memory swapped to disk (/s)." | | | | | | | | "Blocks received from a block device (blocks/s)." | | | | | | | | | "Blocks sent to a block device (blocks/s)." | | | | | | | | | | "The number of interrupts per second, including the clock." | | | | | | | | | | | "The number of context switches per second." | | | | | | | | | | | | "Time spent running non-kernel code." | | | | | | | | | | | | | "Time spent running kernel code. (system time)" | | | | | | | | | | | | | | "Time spent idle." | | | | | | | | | | | | | | | "Time spent waiting for IO." | | | | | | | | | | | | | | | | -procs--- --------memory------------ ---swap-- ---io----- -system--- -----------cpu--------- r b swpd free buff cache si so bi bo in cs us sy id wa EOF fi } PerlMain(){ perl -e ' qx(vmstat|tail -1) =~ m/\s*(\d*)\s*(\d*)\s*(\d*)\s*(\d*)\s*(\d*)\s*(\d*)\s*(\d*)\s*(\d*)\s*(\d*)\s*(\d*)\s*(\d*)\s*(\d*)\s*(\d*)\s*(\d*)\s*(\d*)\s*(\d*)\s*/; write; format STDOUT = @<<<<< @<<<<< @<<<<< @<<<<< @<<<<< @<<<<< @<<<<< @<<<<< @<<<<< @<<<<< @<<<<< @<<<<< @<<<<< @<<<<< @<<<<< @<<<<< $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, . ' } c=1 if [[ $1 == [0-9]* ]]; then Head while true; do PerlMain sleep $1 ((c++)) if ((c==25)); then clear Head c=0 fi done elif [[ $1 ]]; then printf >&2 "Usage : [ LC_ALL=C ] bash $0 [0-9]\n" else Head PerlMain fi