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?

4
  • If its blocked from the inside, maybe you have some firewall (e.g. ufw) blocking the port on the instance? Commented Aug 21, 2020 at 0:19
  • @Marcin I already added the port 9000 to the firewall as well. Commented Aug 21, 2020 at 4:57
  • 1
    Can you disable ufw for a moment just to double check it effects? Commented Aug 21, 2020 at 5:02
  • 3
    @Marcin It's resolved. I need to add a custom TCP inbound rule in my AWS security group. Commented Aug 21, 2020 at 9:45

1 Answer 1

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>
Sign up to request clarification or add additional context in comments.

1 Comment

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.