IO Monitor

De Wiki Clusterlab.com.br
Revisão de 12h46min de 4 de abril de 2019 por Damato (discussão | contribs) (Criou página com '<syntaxhighlight lang="bash" line=1> #!/bin/bash export amostra=1 export tempo=1 echo rc=reads completed successfully echo rm=reads merged echo rs=sectors read echo rt=time sp...')
(dif) ← Edição anterior | Revisão atual (dif) | Versão posterior → (dif)
Ir para navegação Ir para pesquisar
#!/bin/bash
export amostra=1
export tempo=1
echo rc=reads completed successfully
echo rm=reads merged
echo rs=sectors read
echo rt=time spent reading \(ms\)
echo wc=writes completed
echo wm=writes merged
echo ws=sectors written
echo wt=time spent writing \(ms\)
echo io=I/Os currently in progress
echo iot=time spent doing I/Os \(ms\)
echo iow=weighted time spent doing I/Os \(ms\)
while true
do
	date
	cat /proc/diskstats | awk '{print $3}' |egrep -w "fioa|fiob" |\
	while read dispositivo
	do
		arc=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $4}')
		arm=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $5}')
		ars=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $6}')
		art=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $7}')
		awc=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $8}')
		awm=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $9}')
		aws=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $10}')
		awt=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $11}')
		aio=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $12}')
		aiot=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $13}')
		aiow=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $14}')
		sleep $amostra
		drc=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $4}')
		drm=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $5}')
		drs=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $6}')
		drt=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $7}')
		dwc=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $8}')
		dwm=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $9}')
		dws=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $10}')
		dwt=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $11}')
		dio=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $12}')
		diot=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $13}')
		diow=$(cat /proc/diskstats |grep -w $dispositivo| awk '{print $14}')
		echo Dispositivo=$dispositivo \
		rc=$(expr $drc - $arc) \
		wc=$(expr $dwc - $awc) \
		total=$(expr $(expr $drc - $arc) + $(expr $dwc - $awc) )
	done | column -t
done