You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Mark Webb <el...@gmail.com> on 2023/01/11 13:41:33 UTC

How to get docker stats ?

I have a Docker instance running multiple containers.  I'm trying to figure
out how to get stats for each container.  The problem I've run in to is
that the Docker stats operation is only a producer so I can only use the
"from" in a route.  So if I don't know the container ID at build time, how
can I inject the container ID in a "from" line to follow the producer-only
requirement to get Docker container stats.

Re: How to get docker stats ?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

A producer to get status would be nice as well, as its easier to do with
just to docker:status?...

On Wed, Jan 11, 2023 at 7:56 PM Mark Webb <el...@gmail.com> wrote:

> That worked.  Thank you.
>
>
>
> On Wed, Jan 11, 2023 at 10:43 AM Mikael Koskinen <mi...@gmail.com>
> wrote:
>
> > Hey,
> >
> > Can you use PollEnrich to work around this? Here's an example in YAML:
> >
> > - route:
> >     from:
> >       uri: timer:test
> >       steps:
> >         - pollEnrich:
> >             expression:
> >               constant:
> >                 expression: docker:stats?containerId=fa05264a1bed
> >         - to:
> >             uri: log:logger
> >       parameters:
> >         period: '5000'
> >
> > Best regards,
> > Mikael
> >
> > ke 11. tammik. 2023 klo 17.02 Mark Webb (elihusmails@gmail.com)
> kirjoitti:
> > >
> > > Yes, you are correct.  I had the consumer/producer backwards in my
> email.
> > >
> > > I'll look into writing up a PR.
> > >
> > > Thanks,
> > > Mark
> > >
> > >
> > >
> > > On Wed, Jan 11, 2023 at 9:18 AM Claus Ibsen <cl...@gmail.com>
> > wrote:
> > >
> > > > Hi
> > > >
> > > > I think you swap the camel consumer vs producer.
> > > >
> > > > from = consumer
> > > > to = producer
> > > >
> > > > So you want a on-demand get status in a producer (eg to)
> > > >
> > > > to docker:status?id=aaa
> > > >
> > > > If so then maybe see if you can add that to the camel-docer and send
> a
> > PR
> > > > and create a JIRA
> > > >
> > > > On Wed, Jan 11, 2023 at 2:42 PM Mark Webb <el...@gmail.com>
> > wrote:
> > > >
> > > > > I have a Docker instance running multiple containers.  I'm trying
> to
> > > > figure
> > > > > out how to get stats for each container.  The problem I've run in
> to
> > is
> > > > > that the Docker stats operation is only a producer so I can only
> use
> > the
> > > > > "from" in a route.  So if I don't know the container ID at build
> > time,
> > > > how
> > > > > can I inject the container ID in a "from" line to follow the
> > > > producer-only
> > > > > requirement to get Docker container stats.
> > > > >
> > > >
> > > >
> > > > --
> > > > Claus Ibsen
> > > > -----------------
> > > > @davsclaus
> > > > Camel in Action 2: https://www.manning.com/ibsen2
> > > >
> >
>


-- 
Claus Ibsen
-----------------
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: How to get docker stats ?

Posted by Mark Webb <el...@gmail.com>.
That worked.  Thank you.



On Wed, Jan 11, 2023 at 10:43 AM Mikael Koskinen <mi...@gmail.com> wrote:

> Hey,
>
> Can you use PollEnrich to work around this? Here's an example in YAML:
>
> - route:
>     from:
>       uri: timer:test
>       steps:
>         - pollEnrich:
>             expression:
>               constant:
>                 expression: docker:stats?containerId=fa05264a1bed
>         - to:
>             uri: log:logger
>       parameters:
>         period: '5000'
>
> Best regards,
> Mikael
>
> ke 11. tammik. 2023 klo 17.02 Mark Webb (elihusmails@gmail.com) kirjoitti:
> >
> > Yes, you are correct.  I had the consumer/producer backwards in my email.
> >
> > I'll look into writing up a PR.
> >
> > Thanks,
> > Mark
> >
> >
> >
> > On Wed, Jan 11, 2023 at 9:18 AM Claus Ibsen <cl...@gmail.com>
> wrote:
> >
> > > Hi
> > >
> > > I think you swap the camel consumer vs producer.
> > >
> > > from = consumer
> > > to = producer
> > >
> > > So you want a on-demand get status in a producer (eg to)
> > >
> > > to docker:status?id=aaa
> > >
> > > If so then maybe see if you can add that to the camel-docer and send a
> PR
> > > and create a JIRA
> > >
> > > On Wed, Jan 11, 2023 at 2:42 PM Mark Webb <el...@gmail.com>
> wrote:
> > >
> > > > I have a Docker instance running multiple containers.  I'm trying to
> > > figure
> > > > out how to get stats for each container.  The problem I've run in to
> is
> > > > that the Docker stats operation is only a producer so I can only use
> the
> > > > "from" in a route.  So if I don't know the container ID at build
> time,
> > > how
> > > > can I inject the container ID in a "from" line to follow the
> > > producer-only
> > > > requirement to get Docker container stats.
> > > >
> > >
> > >
> > > --
> > > Claus Ibsen
> > > -----------------
> > > @davsclaus
> > > Camel in Action 2: https://www.manning.com/ibsen2
> > >
>

Re: How to get docker stats ?

Posted by Mikael Koskinen <mi...@gmail.com>.
Hey,

Can you use PollEnrich to work around this? Here's an example in YAML:

- route:
    from:
      uri: timer:test
      steps:
        - pollEnrich:
            expression:
              constant:
                expression: docker:stats?containerId=fa05264a1bed
        - to:
            uri: log:logger
      parameters:
        period: '5000'

Best regards,
Mikael

ke 11. tammik. 2023 klo 17.02 Mark Webb (elihusmails@gmail.com) kirjoitti:
>
> Yes, you are correct.  I had the consumer/producer backwards in my email.
>
> I'll look into writing up a PR.
>
> Thanks,
> Mark
>
>
>
> On Wed, Jan 11, 2023 at 9:18 AM Claus Ibsen <cl...@gmail.com> wrote:
>
> > Hi
> >
> > I think you swap the camel consumer vs producer.
> >
> > from = consumer
> > to = producer
> >
> > So you want a on-demand get status in a producer (eg to)
> >
> > to docker:status?id=aaa
> >
> > If so then maybe see if you can add that to the camel-docer and send a PR
> > and create a JIRA
> >
> > On Wed, Jan 11, 2023 at 2:42 PM Mark Webb <el...@gmail.com> wrote:
> >
> > > I have a Docker instance running multiple containers.  I'm trying to
> > figure
> > > out how to get stats for each container.  The problem I've run in to is
> > > that the Docker stats operation is only a producer so I can only use the
> > > "from" in a route.  So if I don't know the container ID at build time,
> > how
> > > can I inject the container ID in a "from" line to follow the
> > producer-only
> > > requirement to get Docker container stats.
> > >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
> >

Re: How to get docker stats ?

Posted by Mark Webb <el...@gmail.com>.
Yes, you are correct.  I had the consumer/producer backwards in my email.

I'll look into writing up a PR.

Thanks,
Mark



On Wed, Jan 11, 2023 at 9:18 AM Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> I think you swap the camel consumer vs producer.
>
> from = consumer
> to = producer
>
> So you want a on-demand get status in a producer (eg to)
>
> to docker:status?id=aaa
>
> If so then maybe see if you can add that to the camel-docer and send a PR
> and create a JIRA
>
> On Wed, Jan 11, 2023 at 2:42 PM Mark Webb <el...@gmail.com> wrote:
>
> > I have a Docker instance running multiple containers.  I'm trying to
> figure
> > out how to get stats for each container.  The problem I've run in to is
> > that the Docker stats operation is only a producer so I can only use the
> > "from" in a route.  So if I don't know the container ID at build time,
> how
> > can I inject the container ID in a "from" line to follow the
> producer-only
> > requirement to get Docker container stats.
> >
>
>
> --
> Claus Ibsen
> -----------------
> @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>

Re: How to get docker stats ?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I think you swap the camel consumer vs producer.

from = consumer
to = producer

So you want a on-demand get status in a producer (eg to)

to docker:status?id=aaa

If so then maybe see if you can add that to the camel-docer and send a PR
and create a JIRA

On Wed, Jan 11, 2023 at 2:42 PM Mark Webb <el...@gmail.com> wrote:

> I have a Docker instance running multiple containers.  I'm trying to figure
> out how to get stats for each container.  The problem I've run in to is
> that the Docker stats operation is only a producer so I can only use the
> "from" in a route.  So if I don't know the container ID at build time, how
> can I inject the container ID in a "from" line to follow the producer-only
> requirement to get Docker container stats.
>


-- 
Claus Ibsen
-----------------
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2