# disk I/O statistics



## blumstng (Apr 8, 2010)

I'm wondering how I can find information about the number of bytes transferred to and from the hard drive within a given period of time, as well as the mb/sec rates?  I have checked into iostat, and that gives me part of that information, but not all.


----------



## Matty (Apr 8, 2010)

check out gstat.

doesn't do the counting part tho.


----------



## blumstng (Apr 8, 2010)

I like gstat.  I think I can use that for watching a device.  But, I think I found part of the information I needed (if I'm reading it right).

```
iostat -dhI
gives:
             ad4 
  KB/t xfrs   MB 
 20.91 663400 13545.41
```
And, It looks like 13454.41 MB have been transferred in total.  So, I should be able to save that number and on the next interval, determine a difference.  Unless there's a better way?


----------



## aragon (Apr 8, 2010)

blumstng said:
			
		

> So, I should be able to save that number and on the next interval, determine a difference.  Unless there's a better way?


That might be the most accurate way of doing it.  Only thing to watch out for is wrap around... the counter is probably a 64 bit unsigned integer which would wrap back to zero after about 18 exabytes.


----------



## blumstng (Apr 8, 2010)

> Only thing to watch out for is wrap around... the counter is probably a 64 bit unsigned integer which would wrap back to zero after about 18 exabytes.


Though I don't expect this to be a problem, I have added a check to make sure of wrap around. Better to account for as many possibilities as you can.

Thanks for all the input.


----------



## phoenix (Apr 8, 2010)

Enable *bsnmpd* in /etc/rc.conf.

Edit /etc/snmpd.config to set the IP to listen on and the community string (password) to use.

Install the net-mgmt/bsnmp-ucd port, and enable the ucd-snmp module in /etc/snmpd.config.

Then use SNMP to query the diskIO* MIBs:  diskIONRead shows the number of bytes read, diskIONWritten shows the number of bytes written.

Use MRTG to poll it and generate pretty graphs.


----------



## vbelousov (Feb 27, 2012)

@phoenix

I've been used that sources (diskIONRead and diskIONWritten) to gather info for RRDTool and this is what I've got:

12 disks, stripe of two raidz2, 6 disks each.






4 disks, simple stripe.





4 disks, raidz1





All of them are very weird. It does not seem to be a Megabyte per second. I don't even have a clue what it can be. Maybe you can tell me - what does it mean?


----------



## vbelousov (Feb 29, 2012)

Okay... Doesn't matter. I will use collectd instead of SNMP.


----------

