# gstat batch mode



## spork (Mar 27, 2011)

Hi all,

I need to collect some stats on disk IO, and *bsnmpd* doesn't give me as much detail as I'd like (and I want to avoid *net-snmp* unless I really cannot).  Mainly I want to look at tps, but %busy and other stuff *gstat* throws out would be interesting as well.  I'm likely going to feed *gstat* output to a script and grab the output via snmp.  Nagios will monitor this, but I'm really collecting the data for pnp so I can see some usage trends.

That said, when *gstat* is run in single-shot mode with the "-b" flag, does anyone know what data that represents? Is it a snapshot or an average over the last X seconds or what?  The manpage isn't terribly clear on that.

If anyone wants to make an argument for *iostat* instead, I'm all ears.  My main concern is that I'm getting somewhat accurate data.

Thanks!


----------



## francis (Mar 27, 2011)

Hi, You wrote that *bsnmpd* does not giving you much details. But did you use it with the *bsnmpd-ucd*[1] module, which can monitor disk, but also CPU, network and memory? You should be able to get full information about disk with ucd module via snmp queries.



			
				spork said:
			
		

> If anyone wants to make an argument for iostat...



There is also few commands to display I/O disk statistics. Some of them are]iostat 2[/CMD] `# systat -iostat 1` Try to look here; iostat(8) (especially -x option), diskinfo(8).

[1] *bsnmpd-ucd* module is available in ports tree under net-mgmt/bsnmp-ucd category. So install it, then load usc module via /etc/snmpd.config file, and restart *bsnmpd*. Remember to put 
	
	



```
bsnmpd_enable="YES"
```
 in the /etc/rc.conf file. Maybe it will be useful for you?


----------



## spork (Mar 28, 2011)

*bsnmpd* doesn't quite give me what I want, even with the ucd-snmp additions.  I did end up settling on *iostat* instead, since I'm finding people claiming that if *iostat* is run twice, with say a 5 minute delay, the second set of stats returned will be an average of the last 5 minutes.  This is perfect for our graphing.  I just couldn't find a reference for *gstat* that described the batch stats.

Anyhow, this is what I'm pulling from *iostat* (in "extended" mode):


```
extended device statistics  
device     r/s   w/s    kr/s    kw/s wait svc_t  %b  
ada0      30.5   0.0  2974.7     0.0    1  11.0   5 
ada1      28.5   0.0  2367.0     0.0    1   2.6   3 
ada2      23.5   0.0  1855.2     0.0    0   2.8   2
```

My main interest is the tps on read and write and the number of outstanding transactions.

Hopefully this is helpful to someone else - lots of googling strongly suggests that setting a long delay and taking 2 samples will give the right information.


----------

