Hello, 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. Ronald. -- Ronald Klop, Amsterdam, The Netherlands
Ronald Klop wrote:> Hello, > > 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.The long way around is: Install net-snmp from the ports and look at the MIB tree behind: 1.3.6.1.4.1.2021 All kinds of nice numbers there which you could get at with snmpget. If you are using MRTG to make the stats, then this is actually the short way. --WjW UCD-SNMP-MIB::memIndex.0 = INTEGER: 0 UCD-SNMP-MIB::memErrorName.0 = STRING: swap UCD-SNMP-MIB::memTotalSwap.0 = INTEGER: 1048448 UCD-SNMP-MIB::memAvailSwap.0 = INTEGER: 1037596 UCD-SNMP-MIB::memTotalReal.0 = INTEGER: 429172 UCD-SNMP-MIB::memAvailReal.0 = INTEGER: 24856 UCD-SNMP-MIB::memTotalSwapTXT.0 = INTEGER: -1 UCD-SNMP-MIB::memAvailSwapTXT.0 = INTEGER: -1 UCD-SNMP-MIB::memTotalRealTXT.0 = INTEGER: -1 UCD-SNMP-MIB::memAvailRealTXT.0 = INTEGER: -1 UCD-SNMP-MIB::memTotalFree.0 = INTEGER: 43840 UCD-SNMP-MIB::memMinimumSwap.0 = INTEGER: 16000 UCD-SNMP-MIB::memShared.0 = INTEGER: 36856 UCD-SNMP-MIB::memBuffer.0 = INTEGER: 61888 UCD-SNMP-MIB::memCached.0 = INTEGER: 18984 UCD-SNMP-MIB::memSwapError.0 = INTEGER: 0 UCD-SNMP-MIB::memSwapErrorMsg.0 = STRING: UCD-SNMP-MIB::dskIndex.1 = INTEGER: 1 UCD-SNMP-MIB::dskIndex.2 = INTEGER: 2 UCD-SNMP-MIB::dskIndex.3 = INTEGER: 3 UCD-SNMP-MIB::dskIndex.4 = INTEGER: 4 UCD-SNMP-MIB::dskIndex.5 = INTEGER: 5 UCD-SNMP-MIB::dskIndex.6 = INTEGER: 6 UCD-SNMP-MIB::dskPath.1 = STRING: / UCD-SNMP-MIB::dskPath.2 = STRING: /tmp UCD-SNMP-MIB::dskPath.3 = STRING: /usr UCD-SNMP-MIB::dskPath.4 = STRING: /var UCD-SNMP-MIB::dskPath.5 = STRING: /home1 UCD-SNMP-MIB::dskPath.6 = STRING: /home2 UCD-SNMP-MIB::dskDevice.1 = STRING: /dev/mirror/mirror1s1a UCD-SNMP-MIB::dskDevice.2 = STRING: /dev/mirror/mirror1s1d UCD-SNMP-MIB::dskDevice.3 = STRING: /dev/mirror/mirror1s1f UCD-SNMP-MIB::dskDevice.4 = STRING: /dev/mirror/mirror1s1e UCD-SNMP-MIB::dskDevice.5 = STRING: /dev/mirror/mirror1s1g UCD-SNMP-MIB::dskDevice.6 = STRING: /dev/mirror/mirror1s1h UCD-SNMP-MIB::dskMinimum.1 = INTEGER: -1 UCD-SNMP-MIB::dskMinimum.2 = INTEGER: -1 UCD-SNMP-MIB::dskMinimum.3 = INTEGER: -1 UCD-SNMP-MIB::dskMinimum.4 = INTEGER: -1 UCD-SNMP-MIB::dskMinimum.5 = INTEGER: -1 UCD-SNMP-MIB::dskMinimum.6 = INTEGER: -1 UCD-SNMP-MIB::dskMinPercent.1 = INTEGER: 5 UCD-SNMP-MIB::dskMinPercent.2 = INTEGER: 5 UCD-SNMP-MIB::dskMinPercent.3 = INTEGER: 5 UCD-SNMP-MIB::dskMinPercent.4 = INTEGER: 5 UCD-SNMP-MIB::dskMinPercent.5 = INTEGER: 5 UCD-SNMP-MIB::dskMinPercent.6 = INTEGER: 5 UCD-SNMP-MIB::dskTotal.1 = INTEGER: 1012974 UCD-SNMP-MIB::dskTotal.2 = INTEGER: 1012974 UCD-SNMP-MIB::dskTotal.3 = INTEGER: 20308398 UCD-SNMP-MIB::dskTotal.4 = INTEGER: 1012974 UCD-SNMP-MIB::dskTotal.5 = INTEGER: 20308398 UCD-SNMP-MIB::dskTotal.6 = INTEGER: 30998412 UCD-SNMP-MIB::dskAvail.1 = INTEGER: 904702 UCD-SNMP-MIB::dskAvail.2 = INTEGER: 929282 UCD-SNMP-MIB::dskAvail.3 = INTEGER: 18279706 UCD-SNMP-MIB::dskAvail.4 = INTEGER: 875106 UCD-SNMP-MIB::dskAvail.5 = INTEGER: 17470944 UCD-SNMP-MIB::dskAvail.6 = INTEGER: 27181836 UCD-SNMP-MIB::dskUsed.1 = INTEGER: 27236 UCD-SNMP-MIB::dskUsed.2 = INTEGER: 2656 UCD-SNMP-MIB::dskUsed.3 = INTEGER: 404022 UCD-SNMP-MIB::dskUsed.4 = INTEGER: 56832 UCD-SNMP-MIB::dskUsed.5 = INTEGER: 1212784 UCD-SNMP-MIB::dskUsed.6 = INTEGER: 1336704 UCD-SNMP-MIB::dskPercent.1 = INTEGER: 3 UCD-SNMP-MIB::dskPercent.2 = INTEGER: 0 UCD-SNMP-MIB::dskPercent.3 = INTEGER: 2 UCD-SNMP-MIB::dskPercent.4 = INTEGER: 6 UCD-SNMP-MIB::dskPercent.5 = INTEGER: 6 UCD-SNMP-MIB::dskPercent.6 = INTEGER: 5 UCD-SNMP-MIB::dskPercentNode.1 = INTEGER: 1 UCD-SNMP-MIB::dskPercentNode.2 = INTEGER: 0 UCD-SNMP-MIB::dskPercentNode.3 = INTEGER: 1 UCD-SNMP-MIB::dskPercentNode.4 = INTEGER: 1 UCD-SNMP-MIB::dskPercentNode.5 = INTEGER: 2 UCD-SNMP-MIB::dskPercentNode.6 = INTEGER: 4 UCD-SNMP-MIB::dskErrorFlag.1 = INTEGER: 0 UCD-SNMP-MIB::dskErrorFlag.2 = INTEGER: 0 UCD-SNMP-MIB::dskErrorFlag.3 = INTEGER: 0 UCD-SNMP-MIB::dskErrorFlag.4 = INTEGER: 0 UCD-SNMP-MIB::dskErrorFlag.5 = INTEGER: 0 UCD-SNMP-MIB::dskErrorFlag.6 = INTEGER: 0 UCD-SNMP-MIB::dskErrorMsg.1 = STRING: UCD-SNMP-MIB::dskErrorMsg.2 = STRING: UCD-SNMP-MIB::dskErrorMsg.3 = STRING: UCD-SNMP-MIB::dskErrorMsg.4 = STRING: UCD-SNMP-MIB::dskErrorMsg.5 = STRING: UCD-SNMP-MIB::dskErrorMsg.6 = STRING: UCD-SNMP-MIB::laIndex.1 = INTEGER: 1 UCD-SNMP-MIB::laIndex.2 = INTEGER: 2 UCD-SNMP-MIB::laIndex.3 = INTEGER: 3 UCD-SNMP-MIB::laNames.1 = STRING: Load-1 UCD-SNMP-MIB::laNames.2 = STRING: Load-5 UCD-SNMP-MIB::laNames.3 = STRING: Load-15 UCD-SNMP-MIB::laLoad.1 = STRING: 0.01 UCD-SNMP-MIB::laLoad.2 = STRING: 0.14 UCD-SNMP-MIB::laLoad.3 = STRING: 0.18 UCD-SNMP-MIB::laConfig.1 = STRING: 12.00 UCD-SNMP-MIB::laConfig.2 = STRING: 12.00 UCD-SNMP-MIB::laConfig.3 = STRING: 12.00 UCD-SNMP-MIB::laLoadInt.1 = INTEGER: 0 UCD-SNMP-MIB::laLoadInt.2 = INTEGER: 13 UCD-SNMP-MIB::laLoadInt.3 = INTEGER: 18 UCD-SNMP-MIB::laLoadFloat.1 = Opaque: Float: 0.005859 UCD-SNMP-MIB::laLoadFloat.2 = Opaque: Float: 0.136230 UCD-SNMP-MIB::laLoadFloat.3 = Opaque: Float: 0.182617 UCD-SNMP-MIB::laErrorFlag.1 = INTEGER: 0 UCD-SNMP-MIB::laErrorFlag.2 = INTEGER: 0 UCD-SNMP-MIB::laErrorFlag.3 = INTEGER: 0 UCD-SNMP-MIB::laErrMessage.1 = STRING: UCD-SNMP-MIB::laErrMessage.2 = STRING: UCD-SNMP-MIB::laErrMessage.3 = STRING: UCD-SNMP-MIB::ssIndex.0 = INTEGER: 1 UCD-SNMP-MIB::ssErrorName.0 = STRING: systemStats UCD-SNMP-MIB::ssSwapIn.0 = INTEGER: 0 UCD-SNMP-MIB::ssSwapOut.0 = INTEGER: 0 UCD-SNMP-MIB::ssIOSent.0 = INTEGER: -1 UCD-SNMP-MIB::ssIOReceive.0 = INTEGER: -1 UCD-SNMP-MIB::ssSysInterrupts.0 = INTEGER: 9 UCD-SNMP-MIB::ssSysContext.0 = INTEGER: 8 UCD-SNMP-MIB::ssCpuUser.0 = INTEGER: 0 UCD-SNMP-MIB::ssCpuSystem.0 = INTEGER: 0 UCD-SNMP-MIB::ssCpuIdle.0 = INTEGER: 100 UCD-SNMP-MIB::ssCpuRawUser.0 = Counter32: 219370266 UCD-SNMP-MIB::ssCpuRawNice.0 = Counter32: 11192 UCD-SNMP-MIB::ssCpuRawSystem.0 = Counter32: 52976699 UCD-SNMP-MIB::ssCpuRawIdle.0 = Counter32: 1222367694 UCD-SNMP-MIB::ssCpuRawKernel.0 = Counter32: 51087846 UCD-SNMP-MIB::ssCpuRawInterrupt.0 = Counter32: 1888853 UCD-SNMP-MIB::ssRawInterrupts.0 = Counter32: 3940707008 UCD-SNMP-MIB::ssRawContexts.0 = Counter32: 3534318709 UCD-DLMOD-MIB::dlmodNextIndex.0 = INTEGER: 1 UCD-DISKIO-MIB::diskIOIndex.1 = INTEGER: 1 UCD-DISKIO-MIB::diskIOIndex.2 = INTEGER: 2 UCD-DISKIO-MIB::diskIODevice.1 = STRING: ad0 UCD-DISKIO-MIB::diskIODevice.2 = STRING: ad3 UCD-DISKIO-MIB::diskIONRead.1 = Counter32: 3870801920 UCD-DISKIO-MIB::diskIONRead.2 = Counter32: 2381194752 UCD-DISKIO-MIB::diskIONWritten.1 = Counter32: 1653008896 UCD-DISKIO-MIB::diskIONWritten.2 = Counter32: 3777115136 UCD-DISKIO-MIB::diskIOReads.1 = Counter32: 5812743 UCD-DISKIO-MIB::diskIOReads.2 = Counter32: 6427627 UCD-DISKIO-MIB::diskIOWrites.1 = Counter32: 41260724 UCD-DISKIO-MIB::diskIOWrites.2 = Counter32: 40672870
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@allantgroup.com