Monitoring Linux host metrics with the Node Exporter
In this guide, you will:
- Start up a Node Exporter on
- Start up a Prometheus instance on
localhost
that’s configured to scrape metrics from the running Node Exporter
The Prometheus Node Exporter is a single static binary that you can install via tarball. Once you’ve downloaded it from the Prometheus extract it, and run it:
You should see output like this indicating that the Node Exporter is now running and exposing metrics on port 9100:
INFO[0000] Starting node_exporter (version=0.16.0, branch=HEAD, revision=d42bd70f4363dced6b77d8fc311ea57b63387e4f) source="node_exporter.go:82"
INFO[0000] Build context (go=go1.9.6, [email protected], date=20180515-15:53:28) source="node_exporter.go:83"
INFO[0000] - boottime source="node_exporter.go:97"
...
INFO[0000] Listening on :9100 source="node_exporter.go:111"
You should see output like this:
# HELP go_gc_duration_seconds A summary of the GC invocation durations.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0.25"} 4.5926e-05
go_gc_duration_seconds{quantile="0.5"} 5.846e-05
Success! The Node Exporter is now exposing metrics that Prometheus can scrape, including a wide variety of system metrics further down in the output (prefixed with node_
). To view those metrics (along with help and type information):
Your locally running Prometheus instance needs to be properly configured in order to access Node Exporter metrics. The following prometheus.yml
example configuration file will tell the Prometheus instance to scrape, and how frequently, from the Node Exporter via localhost:9100
:
global:
scrape_interval: 15s
scrape_configs:
static_configs:
- targets: ['localhost:9100']
Once Prometheus is installed you can start it up, using the --config.file
flag to point to the Prometheus configuration that you created :
./prometheus --config.file=./prometheus.yml
Now that Prometheus is scraping metrics from a running Node Exporter instance, you can explore those metrics using the Prometheus UI (aka the expression browser). Navigate to localhost:9090/graph
in your browser and use the main expression bar at the top of the page to enter expressions. The expression bar looks like this:
Click on the links below to see some example metrics: