Install Prometheus with Node Exporter and Grafana on FreeBSD 14

Prometheus is an open-source tool for monitoring targeted systems by collecting metrics, indexing the metrics for visualization, and alerting. Prometheus has a multi-dimensional data model and a powerful query language that is used to generate reports for the resources being monitored. This guide will discuss how to set up Prometheus with Node Exporter and Grafana on FreeBSD 14.

Prometheus node exporter exports hardware and OS metrics exposed by *NIX kernels for consumption by Prometheus. This exporter is written in Go with pluggable metric collectors.

Setup Procedure

  1. Install Prometheus, Grafana and node_exporter.
  2. Configure Prometheus on FreeBSD 14
  3. Configure Node Exporter on nodes to be monitored.
  4. Configure Grafana data sources
  5. Configure Grafana Dashboards
  6. Visualize data with Grafana

Step 1. Install Prometheus, Grafana and Node Exporter on FreeBSD 14

Install the latest packages from FreeBSD’s package manager.

cloudspinx@freebsd14:~ # pkg install prometheus node_exporter grafana
Checking integrity... done (0 conflicting)
[1/1] Upgrading pkg from 1.21.3 to 2.1.2...
[1/1] Extracting pkg-2.1.2: 100%
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 4 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	ca_root_nss: 3.108
	grafana: 11.6.1
	node_exporter: 1.8.2_1
	prometheus: 2.55.1_3

Number of packages to be installed: 4

The process will require 743 MiB more space.
150 MiB to be downloaded.

Proceed with this action? [y/N]: Y
[1/4] Fetching grafana-11.6.1.pkg: 100%  105 MiB 262.4kB/s    07:01
[2/4] Fetching prometheus-2.55.1_3.pkg: 100%   40 MiB 261.8kB/s    02:41
[3/4] Fetching node_exporter-1.8.2_1.pkg: 100%    4 MiB 195.1kB/s    00:20
[4/4] Fetching ca_root_nss-3.108.pkg: 100%  282 KiB 144.2kB/s    00:02
Checking integrity... done (0 conflicting)
[1/4] Installing ca_root_nss-3.108...
[1/4] Extracting ca_root_nss-3.108: 100%
Scanning /usr/share/certs/untrusted for certificates...
Scanning /usr/share/certs/trusted for certificates...
Scanning /usr/local/share/certs for certificates...
[2/4] Installing grafana-11.6.1...
===> Creating groups
Creating group 'grafana' with gid '904'
===> Creating users
Creating user 'grafana' with uid '904'
[2/4] Extracting grafana-11.6.1: 100%
[3/4] Installing node_exporter-1.8.2_1...
[3/4] Extracting node_exporter-1.8.2_1: 100%
[4/4] Installing prometheus-2.55.1_3...
===> Creating groups
Creating group 'prometheus' with gid '478'
===> Creating users
Creating user 'prometheus' with uid '478'
===> Creating homedir(s)
[4/4] Extracting prometheus-2.55.1_3: 100%
=====
Message from ca_root_nss-3.108:

--
FreeBSD does not, and can not warrant that the certification authorities
whose certificates are included in this package have in any way been
audited for trustworthiness or RFC 3647 compliance.

Assessment and verification of trust is the complete responsibility of
the system administrator.

This package installs symlinks to support root certificate discovery
for software that either uses other cryptographic libraries than
OpenSSL, or use OpenSSL but do not follow recommended practice.

If you prefer to do this manually, replace the following symlinks with
either an empty file or your site-local certificate bundle.

  * /etc/ssl/cert.pem
  * /usr/local/etc/ssl/cert.pem
  * /usr/local/openssl/cert.pem
=====
Message from node_exporter-1.8.2_1:

--
If upgrading from a version of node_exporter <0.15.0 you'll need to update any
custom command line flags that you may have set as it now requires a
double-dash (--flag) instead of a single dash (-flag).
The collector flags in 0.15.0 have now been replaced with individual boolean
flags and the -collector.procfs` and -collector.sysfs` flags have been renamed
to --path.procfs and --path.sysfs respectively.

The above downloads and installs the latest packages for Prometheus, Grafana and Node_eporter on FreeBSD 13.

Enable the three services installed above:

# sudo sysrc prometheus_enable=YES
# sudo sysrc node_exporter_enable=YES
# sudo sysrc grafana_enable=YES

Step 2. Configure Prometheus on FreeBSD 14

The next step is to configure Prometheus on FreeBSD so that we can enable metrics collection from Node exporter. This is also where you can add the external systems that needs to be monitored by prometheus.

Edit the file /usr/local/etc/prometheus.yml and add the content below for the node_exporter job running on the local machine.

- job_name: 'node_exporter'
  scrape_interval: 5s
  static_configs:
    - targets: ['localhost:9100']

The configuration file should look like one below:

Start the three services:

# sudo service prometheus start
# sudo service node_exporter start
# sudo service grafana start

Verify that you can reach the Prometheus service on web via: http://freebsd-IP:9090

Step 3. Configure Grafana web Interface

Login to Grafana dashboard on http://freebsd-IP:3000. Login with admin/admin as the username and password.

You will be required to set a custom password upon first-time login.

Add Grafana Data Source

We then need to configure the prometheus datasource for metrics visualization. At the home screen, select “Add your first data source”.

Select Prometheus as the new data source.

Choose Prometheus for the name of the data source, put http://localhost:9090 as the data source URL.

Click on “Save & test” to save and test the data source. A working data source will indicate as shown below:

Import Grafana Dashboard

After successfully adding a data source to Grafana, the next step is to import a dashboard that will be used to visualize the metrics from Prometheus.

You can get customized Grafana dashboards from Grafana website. Copy the dashboard ID or the JSON data for the dashboard you wish to import.

On your Grafana web interface, click on “Dashboard” then click on “Import Dashboard” on the next page.

You will be presented with an interface where you have to input the dashboard ID or the JSON data of your desired dashboard.

Click “Load” to load the imported dashboard. Also select the Prometheus data source as shown below.

Click on “Import” to import the dashboard. You will then be redirected to the dashboard where you can now visualize your data.

There you go! You now have your dashboard ready for visualization and alerting. You can add more nodes to the Prometheus configuration for monitoring. Cheers!

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Unlock the Right Solutions with Confidence

At CloudSpinx, we don’t just offer services - we deliver clarity, direction, and results. Whether you're navigating cloud adoption, scaling infrastructure, or solving DevOps challenges, our seasoned experts help you make smart, strategic decisions with total confidence. Let us turn complexity into opportunity and bring your vision to life.

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

The problem of uploading large media files, themes, and plugins is common in every WordPress website. This upload size limit […]

In this article we explain how one can install and use MariaDB 11.4 on RHEL 9 | CentOS Stream 9. […]

What are Linux processes? In Linux systems, a process refers to a program that is already executing/ running. It is […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.