Docker Community Forums

Share and learn in the Docker community.

Docker Swarm cluster monitoring using Prometheus and Cloudwatch


(Deepsonune) #1

Hello All,

I am trying monitor docker swarm cluster using Prometheus and AWS Cloudwatch.
I was able to monitor same using Grafana dashboard, however I need to publish metrics in Cloudwatch. Does anyone has any idea, how can this be achieved.


(Ove "Lime" Lindström) #2

One way to get metrics into the Cloudwatch is to use the awslogs-driver for Docker. That will send all your loggings to Cloudwatch. From there, you can filter out the metrics as you would do with any AWS resources. See https://docs.docker.com/config/containers/logging/awslogs/

{
  "log-driver": "awslogs",
  "log-opts": {
    "awslogs-region": "us-east-1"
  }
}

However, that is not really what I think you want to do, since that is for all logging and not really the metrics collected in Prometheus by the Prometheus agents.

The other option is to use an adapter that takes the Prometheus data and push it into Cloudwatch. Theoretically, you could just use Prometheus Remote Write Path (https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write) and use Cloudwatch as an endpoint (Using the Cloudwatch API https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/Welcome.html). But… The formats are not compatible and you can’t configure the AWS key/tokens in the remote_write. :frowning:

Our pals at Cloudposse has solved that. :smiley:

Take a look at https://github.com/cloudposse/prometheus-to-cloudwatch