3

I am setting up prometheus/node_exporter on AWS EC2. With the following configuration

[Unit]
Description=Node Exporter
Wants=network-online.target
After=network-online.target

[Service]
User=node_exporter
Group=node_exporter
Type=simple
ExecStart=/usr/local/bin/node_exporter

[Install]
WantedBy=multi-user.target

And I can access metrics by using curl with localhost. Something like the following

curl localhost:9100/metrics

I can access the metric via private IP address as well. For example

curl private_ip_address:9100/metrics

But, when I try to access it via public IP address. It's not working, got curl timeout.

curl public_ip_address:9100/metrics

I try accessing from the ipv4:9100 from the server itself and from my local machine. Both got the same issue.

How can I enable to make it accessible from the ipv4 address?

Set Kyar Wa Lar
  • 4,488
  • 4
  • 30
  • 57

1 Answers1

2

By default, EC2 instances do not allow accessing the port directly.

You need to create a Custom TCP rule for the port 9100 in the Inbound rules if it does not exist.

If you have also configured a firewall, you need to allow port 9100 too.

You can test remote ports are reachable or not (REF: https://stackoverflow.com/a/9463554/664229):

nc -zvw 5 <ip> <port>
La Min Ko
  • 36
  • 1
  • 6
  • how to setup routing on aws account where prometheus is running to collect metrics from a different aws account where node-exporter is installed on the ec2 instance. All aws accounts are within the same AZ – Emmanuel Spencer Egbuniwe Nov 09 '22 at 07:46