# adamon output

**URL:** <https://techcommunity.softwareag.com/t/adamon-output/99541>\
**Category:** Forum\
**Tags:** Adabas-Natural, Adabas, Adabas-Basics-on-Linux-Unix-Windows, Adabas-on-Windows-UNIX, Adabas-on-Linux\
**Created:** [January 20, 2012, 11:00am UTC](https://techcommunity.softwareag.com/t/adamon-output/99541 "2012-01-20T11:00:22Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [January 20, 2012, 11:00am UTC](https://techcommunity.softwareag.com/t/adamon-output/99541/1 "2012-01-20T11:00:22Z")

</div>

Hello all!

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

```auto
$ 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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [January 21, 2012, 12:35pm UTC](https://techcommunity.softwareag.com/t/adamon-output/99541/2 "2012-01-21T12:35:27Z")

</div>

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:

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

---

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [January 23, 2012, 9:41am UTC](https://techcommunity.softwareag.com/t/adamon-output/99541/3 "2012-01-23T09:41:37Z")

</div>

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

What I want is this:

```auto
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   
```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [January 23, 2012, 10:15am UTC](https://techcommunity.softwareag.com/t/adamon-output/99541/4 "2012-01-23T10:15:50Z")

</div>

> [@Matthias](#):
>
> What I want is this:

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [January 23, 2012, 12:48pm UTC](https://techcommunity.softwareag.com/t/adamon-output/99541/5 "2012-01-23T12:48:05Z")

</div>

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:

```auto
adamon db=14 int=1 loops=5 DATETIME
```

😉

---

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [January 23, 2012, 1:23pm UTC](https://techcommunity.softwareag.com/t/adamon-output/99541/6 "2012-01-23T13:23:43Z")

</div>

```auto
$ 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 ☹

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [January 23, 2012, 1:34pm UTC](https://techcommunity.softwareag.com/t/adamon-output/99541/7 "2012-01-23T13:34:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [January 24, 2012, 12:41pm UTC](https://techcommunity.softwareag.com/t/adamon-output/99541/8 "2012-01-24T12:41:18Z")

</div>

> [@](#):
>
> Apart from suggesting to upgrade

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:

> [@](#):
>
> %ADAMON-I-TERMINATED, 23-JAN-2012 18:30:40, elapsed time: 12:00:40

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.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [January 24, 2012, 8:02pm UTC](https://techcommunity.softwareag.com/t/adamon-output/99541/9 "2012-01-24T20:02:57Z")

</div>

> [@Matthias](#):
>
> > [@](#):
> >
> > Apart from suggesting to upgrade
> 
> 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.

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

> [@Matthias](#):
>
> But maybe I got a solution… let me try something out.

So ? Any news ? 😉

---

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [January 25, 2012, 8:57am UTC](https://techcommunity.softwareag.com/t/adamon-output/99541/10 "2012-01-25T08:57:50Z")

</div>

> [@Wolfgang Winter](#):
>
> > [@Matthias](#):
> >
> > But maybe I got a solution… let me try something out.
> 
> So ? Any news ? 😉

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.

```auto
#!/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:

```auto
$ 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
$
```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [January 25, 2012, 9:24am UTC](https://techcommunity.softwareag.com/t/adamon-output/99541/11 "2012-01-25T09:24:18Z")

</div>

I see, interesting “workaround” 😉

Thanks !

&nbsp;&nbsp;&nbsp;Wolfgang

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 3:01pm UTC](https://techcommunity.softwareag.com/t/adamon-output/99541/12 "2021-04-02T15:01:28Z")

</div>

Closed on April 2, 2021, 3:01pm UTC


