In this demo, I will show you
how to use the Node Exporter.
To install the Node Exporter I have another script.
It's the 2-node-exporter.sh
and this can install the Node Exporter for you.
So this is the version,
you can change it when there is newer release.
First you download the node_exporter
from the GitHub website, extract it, cd into directory,
and then we're going to copy the only binary that you need
to /usr/local/bin.
You're gonna create a user for node_exporter
so it doesn't run as root.
And then we're going to change permissions
of this node_exporter, this binary file.
And then we also want to create a system descript,
this is the system descript right here.
That will just start the node_exporter.
And then we're going to do daemon-reload,
start and enable of the node_exporter.
It just echoes that the setup is complete.
And then we also need to add some lines
to our prometheus.yml file.
Gonna run this.
It's gonna download the Node Exporter, install it,
and now we just need to add the following lines
to our Prometheus config.
So we're gonna add these lines here.
Just have to make sure the indentation's right
so this needs to be the same level as this.
So now we have one job which is Prometheus
and now you have a second job which is the node_exporter.
We're going to connect to localhost:9100
and that's the URL that node_exporter is running on.
So it should already be running now.
So we can check whether we get something back
from the Node Exporter.
And, yes, it's running.
So /metrics, which is the default script URL,
and then you see here, here are all the metrics
that the Node Exporter is returning.
You can now reload Prometheus, let's have a look.
Prometheus, systemctl reload prometheus.
We don't have reload so we have to do
kill -HUP of this process ID and then it should reload.
Loading configuration file, it says, so it all went fine.
Now have our new configuration file.
And let's have a look in our UI.
Targets, now we have a second target.
So this was our first one and this is our second one,
which is up, so the metrics is working.
Last scraped two seconds ago.
So let's go to the dashboard
and then here we have our new metrics.
Let's have a look at our MemFree.
So execute this, make a graph of it.
And here we have a graph of the node_memory_MemFree
in bytes for localhost:9100 for our node_exporter.
And this will then change over time.
So this is then how you can get the metrics
from a node, from a Linux node,
and then you can get all sorts of metrics
that you can then start analyzing and you can start
putting in graphs and compare over multiple nodes.
We are now only scraping one node
but we could scrape multiple nodes.
In one of the next exercises
we will also see service discovery,
so how that we can discovery more services
to not having to configure every single one.
So that's it for the Node Exporter for Linux.
In the next demo I will show you the same for Windows.