Prometheus: Configure Prometheus server to scrape data from Node Exporter

This documentation is part of the Retrieving metrics from Linux guide. You can view the complete guide here: How to retrieve Linux server metrics in Prometheus using Node Exporter.

👋 Welcome to the Stackhero documentation!

Stackhero offers a ready-to-use Prometheus cloud solution designed for reliability and simplicity:

  • Alert Manager is included, allowing you to send alerts directly to Slack, Mattermost, PagerDuty, and other popular platforms.
  • A dedicated email server enables you to send unlimited email alerts with no additional configuration required.
  • Blackbox is provided, so you can probe HTTP, ICMP, TCP, and more for comprehensive monitoring.
  • Simple configuration with the online configuration file editor—no need to manage YAML manually.
  • Easy updates with just one click.
  • Optimal performance and enhanced security thanks to your own private, dedicated VM.

Save time and make your life easier: it takes just 5 minutes to try Stackhero's Prometheus cloud hosting solution!

After installing Node Exporter and securing it, configure your Prometheus server to scrape metrics on a regular schedule.

On Stackhero, select your Prometheus service and go to the "Prometheus configuration" URL. Then add the following to your scrape_configs section:

scrape_configs:

  - job_name: "My servers pool"
    static_configs:
      - targets: [ "<yourLinuxServerDomain>:9100" ]
    basic_auth:
      username: "prometheus"
      password: "<password>"
    scheme: https
    tls_config:
      insecure_skip_verify: true
    # Relabeling "instance" to remove the ":9100" part
    relabel_configs:
      - source_labels: [__address__]
        target_label: instance
        regex: '([^:]+)(:[0-9]+)?'
        replacement: '${1}'

Save the file and check your Prometheus logs to confirm that it has reloaded successfully (you can view the logs from the Stackhero dashboard by selecting your Prometheus service and clicking on the "Logs" tab).

Finally, verify that Prometheus is scraping metrics by accessing the Prometheus UI on the Stackhero dashboard and navigating to Status > Targets. Your Linux server should appear in the target list as UP.

The target "myLinuxServer" is UPThe target "myLinuxServer" is UP