[mrtg] Re: Monitoring hard disk activity

Thomas Koeppe thomas at kgt.org
Fri Sep 8 12:20:54 MEST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Thomas Koeppe wrote:
> can somebody tell me how to monitoring the hard disk activity (sectors/s
> or kbyte/s) of linux machine ? (ide and without raid)

script is successfully runnunig now. If someone is interested to get
some nice graphs of the hard disk i/o performance, here are the relevant
files. Last error was fixed by Gerhard from FH-Giessen.
(thanks Gerhard !)

### diskio.pl ###
#!/usr/bin/perl
use FileHandle;

my $fh = FileHandle->new("cat /proc/diskstats|");
while(<$fh>){
	if(/md0 [0-9]+ [0-9]+ ([0-9]+) [0-9]+ [0-9]+ [0-9]+ ([0-9]+)/) {
		print "$1\n";
		print "$2\n\n\n";
	}
}
close($fh);
### EOF ###

Change /md0 to whatever your partition is called. (hda, sda, ...) Script
assumes that you have linux with kernel 2.6.x. (with /proc filesystem)

### mrtg.cfg ###
Target[disk_io]: `perl /root/diskio.pl`
Options[disk_io]: nopercent,bits
MaxBytes[disk_io]: 4000
Unscaled[disk_io]: dwmy
Title[disk_io]: Disk I/O
PageTop[disk_io]: <H1>Disk I/O</H1>
ShortLegend[disk_io]: blocks/s
LegendI[disk_io]: Reading block count
LegendO[disk_io]: Entry block count
### EOF ###



/Thomas


- --
E-Mail: thomas at kgt.org
ICQ: 454-030
Public Key: http://www.kgt.org/gpg/thomas.asc
Fingerprint: 64A3 9CD5 FB28 3C1B 170F B64F 7D5A B951 6720 4523
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFFAUQGfVq5UWcgRSMRAki1AJ9bj23tzluO/r+HQIMtRhalWl0XkACcD40p
wpwepXYWvdqNxtnyxVgWXg8=
=AHKb
-----END PGP SIGNATURE-----

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://lists.ee.ethz.ch/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the mrtg mailing list