Member-only story
Guide to set up Node exporter, Prometheus and Grafana to monitor your computer resource
Recently I was told by my boss that the two Ubuntu servers we had at the office ‘died off’ quite often and after “bwoah”ing the situation a few times I was told again to monitor when did the computer resource run out and deal with this properly. After searching for a while I had noticed that Node exporter + Prometheus + Grafana stacks should be a very easy to set up and lightweight solution to cache the hardware metrics as a time series and visualize them.
Though they are widely used in the industry I don’t really see many resources online to put them together. So I decided to write this piece to document how to set them up in the most simple way. I have also tried my best to keep it short and clear as much as possible.
So what is Node Exporter, Prometheus, and Grafana anyway?
A very simple one-line explanation would be:
Node Exporter is a tool built by Prometheus that exposes a wide variety of hardware- and kernel-related metrics whenever you call it via HTTP get request.
The output chunk is big but well-formatted for Proemthesus to consume, cache (saved), and transform into time-series data that allow Grafana to visualize the data.
1.1 Download Node Exporter
Visit https://github.com/prometheus/node_exporter/releases/ and look for the link to the latest release. For example, 1.3.1 is the latest version as of writing. Then I will open a terminal and execute (Assuming you are at home (~) directory)
wget https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-amd64.tar.gz
Unzip the tarball and cd
into the directory:
tar xvfz node_exporter-*.*-amd64.tar.gz
cd node_exporter-*.*-amd64
Run the Node Exporter binary and test if it got executed successfully:
./node_exporter
Tail of the successful output:
level=info ts=2021-02-15T03:38:01.468Z caller=node_exporter.go:113 collector=zfs
level=info ts=2021-02-15T03:38:01.468Z caller=node_exporter.go:195 msg="Listening…