adamon output

Hello all!

I tried to enrich the output of adamon with a timestamp. Like that:

$ adamon db=14 int=1 loops=5  | while read line; do echo `date '+%H:%M:%S'` "$line"; done
10:43:53 %ADAMON-I-STARTED,      20-JAN-2012 10:43:53, Version 6.1.10.10 (Solaris 64Bit)
10:43:53
10:43:53 Database 14, startup at 29-DEC-2011 01:50:55
10:43:53 ADANUC Version 6.1.10.10, PID 9082
10:43:53
10:43:53
10:43:58
10:43:58 Commands         I/Os per sec      Throw   Buffer pool
10:43:58 per sec      ASSO DATA WORK PLOG   backs   Hit  Flushs
10:43:58 ------------------------------------------------------
10:43:58 0        0    0    0    0       0     -       0
10:43:58 0        0    0    0    0       0     -       0
10:43:58 0        0    0    0    0       0     -       0
10:43:58 0        0    0    0    0       0     -       0
10:43:58 0        0    0    0    0       0     -       0
10:43:58
10:43:58
10:43:58 Summary (measurement time: 00:00:04)
10:43:58
10:43:58 Totals    Ratio per sec
10:43:58 ----------------------------------------
10:43:58 Commands     :        0                0
10:43:58 ASSO I/Os    :        0                0
10:43:58 DATA I/Os    :        0                0
10:43:58 WORK I/Os    :        0                0
10:43:58 TEMP I/Os    :        0                0
10:43:58 PLOG I/Os    :        0                0
10:43:58 Throwbacks   :        0                0
10:43:58 Buffer Hit   :        -
10:43:58 Buffer flushs:        0
10:43:58
10:43:58 %ADAMON-I-TERMINATED,   20-JAN-2012 10:43:58, elapsed time: 00:00:05

But as you can see, it doesn’t work. I think adamon buffers its output when it’s redirected…

Any ideas for a workaround?

Matthias

No, the problem isn’t buffering, it’s actually the opposite, when adamon starts up
it writes the header, then does its processing, when the 5*1 seconds are over
the actual output is written.

Possible workaround:

adamon db=14 int=1 loops=5 >adamon.txt; cat adamon.txt | while read line; do echo `date '+%H:%M:%S'` "$line"; done

Thanks for answering.
Sorry, maybe my question was a bit unclear.

What I want is this:

10:43:53 Commands         I/Os per sec      Throw   Buffer pool   
10:43:53 per sec      ASSO DATA WORK PLOG   backs   Hit  Flushs   
10:43:53 ------------------------------------------------------   
10:43:53 0        0    0    0    0       0     -       0   
10:43:54 0        0    0    0    0       0     -       0   
10:43:55 0        0    0    0    0       0     -       0   
10:43:56 0        0    0    0    0       0     -       0   
10:43:57 0        0    0    0    0       0     -       0   

I see, understood now, let me think about it.

Looks like you are correct, I’m afraid, there doesn’t seem to be a way of
getting around buffering of piped output.

BUT, and that’s the good news, there is a much simpler solution:

adamon db=14 int=1 loops=5 DATETIME

:wink:

$ adamon db=14 int=1 loops=5 DATETIME
%ADAMON-I-STARTED,      23-JAN-2012 13:20:22, Version 6.1.10.10 (Solaris 64Bit)

Database 14, startup at 29-DEC-2011 01:50:55
ADANUC Version 6.1.10.10, PID 9082

DATETIME
       ^
%ADAMON-E-INVKEY, Invalid keyword
%ADAMON-I-ABORTED,      23-JAN-2012 13:20:22, elapsed time: 00:00:00
$

Interesting. But due to documentation this is a feature of Version 6.2 and higher :frowning:

Sorry, hadn’t noticed you are still on 6.1 !

Apart from suggesting to upgrade I’m running out of ideas then.

Probably the only immediate solution would be to execute adamon
5 times with loops=1 instead and parse out that one line each time.

Oh no! Not again. We went to 6.1.10 only half a year ago. The last relevant bug was fixed on 2011-10-24.

But back on topic: I want to run adamon half a day and log the information automatically into a file. So in reality it will be interval=10 loops=4320.

And then the next problem is:
10sec * 4320 loops doesn’t make 12h exactly. Yesterday’s example:

I think adamon needs a small amount of runtime for maesurement between the loops. So it’s not enough to write a script which adds the interval to a time variable for each line.

But maybe I got a solution… let me try something out.

And, according to empower, it’ll go out of support in Q3/2012 (6.2 in Q4, btw) …

So ? Any news ? :wink:

I think my script works! 8)
Here’s the regarding code snippet (in perl). OK. It’s weird, but it’s working. Of course you can write it as a bash-script, too.

#!/usr/bin/perl
use strict;
my $opt_i=10;       # interval in seconds
my $firststat=1;
my $timenow = my $timeflush = my $timeoldflush = time();
while (<>) {     # read adamon-output from STDIN
  print if (/%ADAMON/);
  if (/^[0-9 ]{43}([0-9 ]{3}%|  - )[0-9 ]{7} /) { # stat line
    if ($firststat) {$firststat=0; next};         # skip 1st line
    if ($timeflush + 1 < time()) {   # time ajustment
      $timeoldflush=$timeflush;
      $timeflush=time();
    }
    if ($timenow < $timeoldflush) {
      $timenow = $timeoldflush + $opt_i;
    } else {
      $timenow+=$opt_i;
    }
    my @timevals=(localtime $timenow)[0..5];   # convert unix-time
    $timevals[5]+=1900; $timevals[4]+=1;
    printf("%04d-%02d-%02d %02d:%02d:%02d %s",reverse (@timevals), $_);
  }
}

example:

$ adamon db=14 int=10 loops=5 | test.pl
%ADAMON-I-STARTED,      25-JAN-2012 08:53:23, Version 6.1.10.10 (Solaris 64Bit)
2012-01-25 08:53:33        1        0    0    0    0       0   100%      0
2012-01-25 08:53:43        1        0    0    0    0       0     -       0
2012-01-25 08:53:53        1        0    0    0    0       0     -       0
2012-01-25 08:54:03        0        0    0    0    0       0     -       0
%ADAMON-I-TERMINATED,   25-JAN-2012 08:54:14, elapsed time: 00:00:51
$

I see, interesting “workaround” :wink:

Thanks !

   Wolfgang