The YouTube video is in German.
- Installing Grafana server
- Build MQTT data source
- Install and configure Mosquitto
- Install and configure Prometheus; Add a node to Prometheus
- Install the node exporter
Installing Grafana server:
Official documentation: https://grafana.com/docs/grafana/latest/installation/debian/
sudo adduser grafana
sudo usermod -aG sudo grafana
sudo su grafana
cd ~
sudo apt-get install -y apt-transport-https
sudo apt-get install -y software-properties-common wget
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
echo "deb https://packages.grafana.com/enterprise/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
sudo apt-get update
sudo apt-get install grafana-enterprise
sudo systemctl enable grafana-server
sudo systemctl start grafana-serverBuild MQTT data source:
GitHub issue explanation: https://github.com/grafana/mqtt-datasource/issues/15#issuecomment-894477802
Install Go:
wget -O -https://raw.githubusercontent.com/mauleyzaola/scripts/master/go/go.install.sh | sh
source ~/.bashrcInstall Mage:
sudo apt install git
git clone https://github.com/magefile/mage
cd mage
go run bootstrap.goInstall NodeJS 16:
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejsEnable yarn:
sudo corepack enableConfigure Grafana:
sudo nano /etc/grafana/grafana.iniChange the following values:
plugins = /var/lib/grafana/plugins
allow_loading_unsigned_plugins = grafana-mqtt-datasourceCreate Grafana plugin directory:
mkdir /var/lib/grafana/pluginsChange into the plugin directory and start the build process:
mkdir /var/lib/grafana/plugins
cd /var/lib/grafana/plugins
git clone https://github.com/grafana/mqtt-datasource.git
cd mqtt-datasource
yarn add @grafana/toolkit
yarn build
yarn install
sudo systemctl restart grafana-serverInstall and configure Mosquitto:
Create service account and install Mosquitto
sudo adduser mosquitto
sudo usermod -aG sudo mosquitto
sudo su mosquitto
cd ~
sudo apt install mosquitto
sudo systemctl enable mosquitto
sudo systemctl start mosquittoCreate the config file:
sudo nano /etc/mosquitto/conf.d/mosquitto.confInsert the following config:
listener 1883 0.0.0.0
log_dest syslog
log_dest stdout
log_dest topic
log_type error
log_type warning
log_type notice
log_type information
connection_messages true
log_timestamp true
allow_anonymous false
password_file /etc/mosquitto/pwfileCreate the password file:
sudo nano /etc/mosquitto/pwfileType the username and password in this format:
username:passwordHash the password:
sudo mosquitto_passwd -U /etc/mosquitto/pwfile
sudo systemctl restart mosquittoInstall and configure Prometheus; Add a node to Prometheus:
Create service account and install Prometheus:
sudo adduser prometheus
sudo usermod -aG sudo prometheus
sudo su prometheus
cd ~
wget https://github.com/prometheus/prometheus/releases/download/v2.36.0/prometheus-2.36.0.linux-amd64.tar.gz
tar -xzvf prometheus-2.36.0.linux-amd64.tar.gz
mv prometheus-2.36.0.linux-amd64/ prometheus/Create the prometheus service:
sudo nano /etc/systemd/system/prometheus.serviceAdd service config:
[Unit]
Description=Prometheus Server
After=network-online.target
[Service]
User=prometheus
Restart=on-failure
ExecStart=/home/prometheus/prometheus/prometheus \
--config.file=/home/prometheus/prometheus/prometheus.yml \
--storage.tsdb.path=/home/prometheus/prometheus/data
[Install]
WantedBy=multi-user.targetReload systemd and start the service:
sudo systemctl daemon-reload
sudo systemctl enable prometheusInstall the node exporter:
Create service account (if it doesn’t exist yet):
sudo usermod -aG sudo prometheus 
sudo adduser prometheus
sudo su prometheusInstall the node exporter:
cd ~
wget https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-amd64.tar.gz
tar -xzvf node_exporter-1.3.1.linux-amd64.tar.gz
mv node_exporter-1.3.1.linux-amd64/ node_exporter/Create the service for the node exporter:
sudo nano /etc/systemd/system/node_exporter.servicePaste service config:
[Unit]
Description=Node Exporter
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
ExecStart=/home/prometheus/node_exporter/node_exporter
[Install]
WantedBy=default.targetReload systemd and enable the service:
sudo systemctl daemon-reload
sudo systemctl enable node_exporterConfigure Prometheus data source:
sudo su prometheus
cd ~
nano ./prometheus/prometheus.ymlPaste at the end of the config file:
- job_name: 'node_exporter'
  static_configs:
   - targets: ['localhost:9100']Restart prometheus:
sudo systemctl restart prometheusNow you have to import the node exporter dashboard (ID: 1860) to Grafana.
You’re done installing a up and running open source monitoring system.