How to change Node Exporter port
Node Exporter by default use port 9100. You may need to use another port for Node Exporter if port 9100 is already used by another program on your server. On an OVH VPS, noderig was running in port 9100 and Node Exporter failed to start. To fix the issue, i had to run Node Exporter on a different port.
To change Node Exporter port, edit file
1 |
/etc/systemd/system/node_exporter.service |
Find line
1 |
ExecStart=/usr/local/bin/node_exporter |
Replace it with
1 |
ExecStart=/usr/local/bin/node_exporter --web.listen-address=:9101 |
In the above line, 9101 is the new Node Exporter port. You can change it to any other port as required.
Here is the complete code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
root@ns568267:~# cat /etc/systemd/system/node_exporter.service [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 --web.listen-address=:9101 [Install] WantedBy=multi-user.target root@ns568267:~# |
Reload systemd
1 |
systemctl daemon-reload |
Restart node exporter
1 |
systemctl start node_exporter |
You can verify node_exporter is running with the command
1 2 3 |
root@ns568267:~# netstat -lntp | grep node_ tcp6 0 0 :::9101 :::* LISTEN 15630/node_exporter root@ns568267:~# |