I have a requirement, where I have enabled NGINX metrics and I am trying to plot metrics with Prometheus. I am trying to plot metrics for NGINX EC2 server which has a tag named test=nginx
or by running on specific port 9113. I am trying to use the below config, but after adding this config I am unable to see the targets in Prometheus
- job_name: "prometheus_nginx"
ec2_sd_configs:
- region: us-east-1
access_key: XXXXXXXXXX
secret_key: XXXXXXXXXX/
port: 9113
relabel_configs:
- source_labels: [__meta_ec2_tag_test]
regex: nginx
action: keep
- source_labels: []
regex: .*
action: drop
So can someone please help in what modifications are needed. NGINX is running on EC2 and Prometheus is running as a pod. Already enabled the traffic between NGINX and Prometheus pod and I am able to plot metrics.
But I am looking at more feasible option which should automatically get the dynamic targets based on the tag of the EC2 server