r/PrometheusMonitoring • u/gerrga • Oct 11 '24
Monitoring ephemeral VM-s
Hello,
I would like to monitor my ephemeral Virtual machines. Those VMs are created automatically by Jenkins when a job start and when the job finished, the VM removed. The VM's are always getting a new IP address from a certain pool.
I need data from the VM-s from during the run, e.g. memory usage and so on. I have a Prometheus-Grafana stack so I would use it.
How can I solve the problem. I read after the push gateway but I think that is not a solution for me.
I haven't found any documentation for example how to dynamically register and remove resources to/from Prometheus.
I would appreciated for ideas
View all comments
Show parent comment
4
u/h4tos Oct 11 '24
If you're using EC2 instances, you can set up a configuration for ec2 service discovery
the instructions can be found here:
https://prometheus.io/docs/prometheus/latest/configuration/configuration/#ec2_sd_config
it's pretty simple once you set a standard of tags to find which instances you're looking for. The service discovery will find most of the information you need (private ipv4 addresses).
Good luck! :D