io_all / io collectors

2 views
Skip to first unread message

c0ns0le

unread,
Jun 24, 2010, 11:12:39 AM6/24/10
to yaketystats-devel
ALL:

is the intention behind the io check to collect the average @ each
interval or the current value, i'm not certain if the io collector is
collecting both the first value out from iostat and the second value
or if it's just collecting the first set of data points.

Sam Rowe

unread,
Jun 24, 2010, 11:14:45 AM6/24/10
to yaketyst...@googlegroups.com
Hi Brandon,

Happy, who wrote the bulk of the plugins, is out of town until the
middle of next week. Seems unlikely that you'll get a reply until
then.

Thanks,
Sam

Scott Parish

unread,
Jun 24, 2010, 1:08:56 PM6/24/10
to yaketyst...@googlegroups.com
For what its worth, i think the sar script has a similar problem--it
samples data from 3 seconds out of each minute, rather then sampling
for the whole minute

sRp

Sam Rowe

unread,
Jun 24, 2010, 2:03:09 PM6/24/10
to yaketyst...@googlegroups.com
If you guys would like to suggest an alternate method for collecting
the stats, I'm guessing that would skip one round of Happy asking what
you'd like it to be :)

Scott Parish

unread,
Jun 24, 2010, 2:23:07 PM6/24/10
to yaketyst...@googlegroups.com
I ended up writing my own collector. I have a long lived python script
that popen()s sar, telling it to report every 60 seconds, and then
parses and pushes the results (every 60s) back into yacketystats. The
downside is if/when it crashes it has to be restarted by something (eg
monit or similar) or you just don't have any stats until someone
notices and restarts it.

If anyone's interested i could clean it up and send it out for other
people to use. Probably only works on linux at the moment.

sRp

c0ns0le

unread,
Jun 25, 2010, 9:26:05 AM6/25/10
to yaketystats-devel
some reason in my head this doesn't seem terribly difficult but again
i'm not a programmer.


it would seem that right around line 403 of the io script is where the
logic might be or should be which will exclude the first bit of data.

# The get data from iostat
# This doesn't include tps
#$cmd = 'iostat -x ALL 5 2';
# So use this hilarious hack to get all the data for the same 5
seconds:
$cmd = "(iostat -x ALL 5 2 2>&1 | sed 's/^/ALL /') & (iostat 5 2
2>&1 | sed 's/^/TPS /') &";
($status, @data) = run_prg ($cmd, $g_default_timeout);
if ( $status != 0 ) {
fileit ("Bad status for $cmd: $status. Output was: @data\n");
return (undef);
}

foreach $hack qw(ALL TPS) {
$saw_device = 0;
LOOP: foreach $line (@data) {
undef (%s);
chomp ($line);
if ( $line !~ /^$hack / || $line =~ /^$hack $/ ) {
next LOOP;
}
if ( $line =~ /^$hack Device:/ ) {
$saw_device++;
if ( $line =~ /rkB\/s wkB\/s/ ) {
$splice = 1;
} else {
$splice = 0;
}
next LOOP;
}
if ( $saw_device == 2 ) {
$line =~ s/^\w+ //;
if ( $hack eq 'ALL' ) {
if ( $splice ) {
@t = splice (@{[(split (/\s+/, $line))]}, 7, 2);
} else {
@t = split (/\s+/, $line);
}
($dev, $s{'rrqm'}, $s{'wrqm'}, $s{'readreq'},
$s{'writereq'}, $s{'read'},
$s{'write'}, $s{'avgrq_sz'}, $s{'avgqu_sz'}, $s{'avwait'},
$s{'svctm'},
$s{'util'}) = @t;
} else {
($dev, $s{'tps'}) = (split (/\s+/, $line))[0, 1];
}

essentially what you would want to do is read in the values to store
an array maybe something like:

index,data1,data2,data3,etc....
device,0,0,0,0,etc...

once you've built the array, simply overwrite the data in the array
with the 2nd set of data. that could very well be what it's doing, i'm
just not experienced enough to know.


On Jun 24, 1:23 pm, Scott Parish <srpar...@gmail.com> wrote:
> I ended up writing my own collector. I have a long lived python script
> that popen()s sar, telling it to report every 60 seconds, and then
> parses and pushes the results (every 60s) back into yacketystats. The
> downside is if/when it crashes it has to be restarted by something (eg
> monit or similar) or you just don't have any stats until someone
> notices and restarts it.
>
> If anyone's interested i could clean it up and send it out for other
> people to use. Probably only works on linux at the moment.
>
> sRp
>
> On Thu, Jun 24, 2010 at 1:03 PM, Sam Rowe <sam.r...@gmail.com> wrote:
> > If you guys would like to suggest an alternate method for collecting
> > the stats, I'm guessing that would skip one round of Happy asking what
> > you'd like it to be :)
>
> > On Thu, Jun 24, 2010 at 1:08 PM, Scott Parish <srpar...@gmail.com> wrote:
> >> For what its worth, i think the sar script has a similar problem--it
> >> samples data from 3 seconds out of each minute, rather then sampling
> >> for the whole minute
>
> >> sRp
>

Mark Plaksin

unread,
Jun 27, 2010, 8:05:37 AM6/27/10
to yaketyst...@googlegroups.com
c0ns0le <brandon...@gmail.com> writes:

Hi Brandon & Scott:

It's supposed to collect stats for current moment, not the average. The
code is stupid and hard to read but it's supposed to use the number
after the second occurrance of "^Device:" in the iostat output. That's
what this line is for:

if ( $saw_device == 2 ) {

When I wrote it I convinced myself that it worked :) io_all was added
quick-n-dirty style to investigate a specific problem we were having.
So it's more likely to have problems than the rest.

All of the collectors that use sar and iostat are designed to work the
same way--they're supposed to use the last section of output, not the
first. Like io_all, I think they do the right thing but feel free to
add some debugging and prove me wrong! :)

The daemon idea is interesting. If I understand how it works, it gives
you the average for the past minute. All of my collectors (are supposed
to :) just look for the current value when they run.

Reply all
Reply to author
Forward
0 new messages