gstat and scripting

Dan Nelson dnelson at allantgroup.com
Wed Apr 20 16:10:42 PDT 2005


In the last episode (Apr 21), Ronald Klop said:
> The tool gstat can produce very nice stats. Can I get these stats
> from the system periodicly for use in my one scripts/graphs? Is there
> a sysctl like kern.ad0.reads? Or some other way of retreiving this
> info from the kernel. Looking at the gstat output, the numbers must
> be in there.

You can use net-snmp and mrtg to graph disk stats.
I suggest applying the patch at
http://sourceforge.net/tracker/index.php?func=detail&aid=1085243&group_id=12694&atid=312694
so you get 64-bit counters (32-bit counters roll over too fast to be
useful):

$ snmptable -v2c localhost diskiotable
SNMP table: enterprises.ucdavis.ucdExperimental.ucdDiskIOMIB.diskIOTable

 diskIOIndex diskIODevice diskIONRead diskIONWritten diskIOReads diskIOWrites diskIONReadX diskIONWrittenX diskIOLA1 diskIOLA5 diskIOLA15
           1          da0  3682573440     4134971392     7734458     71468595  68107082880    828768692224      1794       398        138
           2          cd0          24              0           3            0           24               0         0         0          0
           3          cd1   911237260              0       13932            0    911237260               0         0         0          0
           4        pass0        1622             24          40            1         1622              24         0         0          0
           5        pass1           0              0           0            0            0               0         0         0          0
           6        pass2       57676     2710198624        3302        42848        57676      2710198624         0         0          0

If you graph diskIONReadX and diskIONWrittenX over time, you'll get a
nice graph of throughput.

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-stable mailing list