Let's try to translate the commands we executed manually into a Jenkins job. If we manage to do that, we can go further and let Alertmanager trigger that job whenever certain thresholds are reached in Prometheus.
We'll start by downloading Jenkins stack from the vfarcic/docker-flow-monitor (https://github.com/vfarcic/docker-flow-monitor) repository.
curl -o jenkins.yml \ https://raw.githubusercontent.com/vfarcic/docker-\flow-monitor/master/stacks/jenkins-aws-secret.ymlcat jenkins.yml
The stack definition we just downloaded is almost identical to the one we used before so we'll comment only the differences.
version: "3.2"services: ... agent: image: vfarcic/jenkins-swarm-agent ... secrets: - aws ...secrets: aws: external: ...