Install Second Prometheus Node Exporter
Video Lecture
Description
I will install a Prometheus Node Exporter on a different server and connect to it using the main Prometheus service.
On the other server install it,
# |
|
Check its status.
# |
|
It has created a specific user called prometheus
. We can inspect it.
# # # |
|
It is now exposing the metrics endpoint on http://[your domain or ip]:9100
Now to create a scrape config on the Prometheus server that retrieves metrics from this new URL.
Go back onto your main Prometheus server and edit the existing scrape config for node
and add the new metrics
endpoint for the other server.
# |
|
# ... existing config
scrape_configs:
# ... existing config
- job_name: node
# If prometheus-node-exporter is installed, grab stats about the local
# machine by default.
static_configs:
- targets: ['localhost:9100']
- targets: ['IP_ADDRESS_OR_DOMAIN_NAME_OF OTHER_SERVER:9100']
Nginx Reverse Proxy
If you have Nginx running on your other server already, with a domain name and an SSL certificate setup, then you can add a location
to an existing website config.
For the following instructions, presume that I have already installed Nginx, with a custom domain and installed an SSL certificate as outlined in the sections below, but customized for this other server where I've just installed the Prometheus Node Exporter.
Add the location to your websites existing Nginx configuration
sudo nano /etc/nginx/sites-enabled/YOUR-EXISTING-CONFIGURATION.conf
# ... existing Nginx config
location /prometheus-node/ {
proxy_set_header Host $http_host;
proxy_pass http://localhost:9100/;
}
Prometheus Course
If you want to try a more detailed course on Prometheus, then you can visit my Prometheus tutorials.