[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [hobbit] Graphing iostat on Linux systems?
- To: hobbit (at) hswn.dk
- Subject: Re: [hobbit] Graphing iostat on Linux systems?
- From: "Husemann, Harald" <Harald.Husemann (at) materna.de>
- Date: Thu, 02 Apr 2009 15:55:33 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=materna.de; s=mail; t=1238680534; bh=23FH4AFjTgBGuFjFcGXfixIUripCFaLLMPfMdKYO/IE=; h=Message-ID:Date:From:MIME-Version:To:Subject:References: In-Reply-To:Content-Type; b=SFAF/SmobISeMcWenUFd5uq2a9ap7YA/EMMJ9N0EHMQYEbiDlK6LJpivuAk1u6kxd pNAjLLVeykxKKciZQSqWXL9GHbjW/4kHfv9TYXPeCFM8JkQIE09B/dTFd1gNfV9aoq 0VMoV3loxVtKEGtYH3JzurFNE7JDSRpMR6BgNhwo=
- References: <49D228B3.10703 (at) makelofine.org> <961092e10903310738p567aee1dwffa4ca90328e7523 (at) mail.gmail.com> <49D22DB4.5010003 (at) makelofine.org> <49D23642.106 (at) materna.de> <49D24E38.7070209 (at) materna.de> <Pine.LNX.4.64.0903311925030.21257 (at) pal33.desy.de>
- User-agent: Mozilla-Thunderbird 2.0.0.16 (X11/20080724)
Hi Martin,
thanks for the link (and thanks to the programmer of linux-iostat), I've
installed it (with some additions/changes, see below) as described, and
it works and shows what I need, :-).
I attach my version of the script to this mail, since I made some edits:
1. Added my "preamble" which I use in every extension script:
===============/snip/======================
my $TEST = "iostat";
(...)
my $HOST = $ENV{"MACHINE"};
$HOST =~ s/(.*),.*,.*$/$1/;
if (system("$ENV{'BBHOME'}/bin/bbhostgrep $TEST | grep $HOST > /dev/null
2>&1") != 0) {
print "Not running on $HOST..." if $debug;
exit 0;
}
==============/snap/========================
With this, I can have the same scripts and config files on all systems
(helps to keep things up2date), and just add the appr. entry (in this
case, iostat) to the host part in bb-hosts ti run the script on a
particular host.
2. Cleaned up the regex a bit
3. As we're using drbd (DistributedRemoteBlockDevice, often used with
Linux-HA), I added "drbd" to the devices list.
Maybe someone can use my version, or get some ideas from it.
hh
Martin Flemming schrieb:
Hi, Harald !
http://www.docum.org/foswiki/bin/view/Xymon/LinuxIostatGraphs
Cheers,
martin
On Tue, 31 Mar 2009, Husemann, Harald wrote:
Hi all,
I'd like to use iostat for performance monitoring, and include its output in
the Hobbit pages.
I've found an old post about it, but it seems that the URL mentioned there
(http://www.docum.org/twiki/bin/view/Hobbit/LinuxIostatGraphs) is no longer
valid.
Any ideas where I can get it?
Thanks,
Harald
--
Harald Husemann
Netzwerk- und Systemadministrator
Operation Management Center (OMC)
MATERNA GmbH
Information & Communications
Westfalendamm 98
44141 Dortmund
Geschäftsführer: Dr. Winfried Materna, Helmut an de Meulen, Ralph Hartwig
Amtsgericht Dortmund HRB 5839
Tel: +49 231 9505 222
Fax: +49 231 9505 100
www.annyway.com <http://www.annyway.com/>
www.materna.com <http://www.materna.com/>
To unsubscribe from the hobbit list, send an e-mail to
hobbit-unsubscribe (at) hswn.dk
--
Harald Husemann
Netzwerk- und Systemadministrator
Operation Management Center (OMC)
MATERNA GmbH
Information & Communications
Westfalendamm 98
44141 Dortmund
Geschäftsführer: Dr. Winfried Materna, Helmut an de Meulen, Ralph Hartwig
Amtsgericht Dortmund HRB 5839
Tel: +49 231 9505 222
Fax: +49 231 9505 100
www.annyway.com <http://www.annyway.com/>
www.materna.com <http://www.materna.com/>
#!/usr/bin/perl
use strict ;
my $TEST = "iostat";
my $rrd_return ;
# y for debugging
my $debug = "n" ;
my %result ;
my $HOST = $ENV{"MACHINE"};
$HOST =~ s/(.*),.*,.*$/$1/;
if (system("$ENV{'BBHOME'}/bin/bbhostgrep $TEST | grep $HOST > /dev/null 2>&1") != 0) {
print "Not running on $HOST..." if $debug;
exit 0;
}
# Collect the bytes statistics of the disks
foreach my $vmstat (`iostat -d -k -p ALL`) {
chomp $vmstat ;
if ( $vmstat =~ /^(sd|hd)[a-z]|^drbd\d|^md\d/ ) {
$vmstat =~ s/[\.|,]//g ;
#$vmstat =~ s/,//g ;
my @split = split " ", $vmstat ;
$result{$split[0]} .= $split[1] . ":" . $split[4] . ":" . $split[5] ;
} else {
}
}
# Collect the bloks statistics of the disks
foreach my $vmstat (`iostat -d -p ALL`) {
chomp $vmstat ;
if ( $vmstat =~ /^(sd|hd)[a-z]|^drbd\d|^md\d/ ) {
$vmstat =~ s/[\.|,]//g ;
my @split = split " ", $vmstat ;
$result{$split[0]} .= ":" . $split[4] . ":" . $split[5] ;
} else {
}
}
#use Data::Dumper ;
#print Dumper {%result} ;
#print "\n" ;
foreach my $key (keys(%result)) {
my @split = split ":", $result{$key} ;
# If there is number at the end, it is a partition, otherwise it is the whole disk
if ( $key =~ /\d$/ ) {
$rrd_return .= "[iostat-part.$key.rrd]\n" ;
} else {
$rrd_return .= "[iostat-disk.$key.rrd]\n" ;
}
$rrd_return .= "DS:tps:GAUGE:600:0:U $split[0]\n" ;
$rrd_return .= "DS:Kb_read:DERIVE:600:0:U $split[1]\n" ;
$rrd_return .= "DS:Kb_wrtn:DERIVE:600:0:U $split[2]\n" ;
$rrd_return .= "DS:blk_read:DERIVE:600:0:U $split[3]\n" ;
$rrd_return .= "DS:blk_wrtn:DERIVE:600:0:U $split[4]\n" ;
$rrd_return .= "\n" ;
}
$rrd_return = "$ENV{BB} $ENV{BBDISP} \"data $ENV{MACHINE}.trends\n" . $rrd_return . "\"\n" ;
if ( $debug eq "y" ) {
print "$rrd_return" ;
} else {
system ( $rrd_return ) ;
}