Author Archives: admin

Install Docker on a Raspberry Pi 4

Add your new user to the sudo group

sudo usermod -aG sudo g1

Update the apt package index & Upgrade all current program package

sudo apt-get update
sudo apt-get upgrate

Install packages to allow apt to use a repository over HTTPS:

sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common

Add Docker’s official GPG key:

curl -fsSL https://download.docker.com/linux/raspbian/gpg | sudo apt-key add -

look up the name of your linux distribution

lsb_release -cs

Setup the Docker Repo.

sudo su
echo "deb [arch=armhf] https://download.docker.com/linux/raspbian buster stable" > /etc/apt/sources.list.d/docker.list
exit

Update the apt package index.

sudo apt-get update

Install the latest version of Docker Engine – Community and containerd without AUFS

sudo apt-get install --no-install-recommends docker-ce docker-ce-cli containerd.io

Show Docker Version

sudo docker version

Verify that Docker Engine – Community is installed correctly by running the hello-world image.

sudo docker run hello-world

Give the ‘g1’ user the ability to run Docker.

sudo usermod -aG docker g1

How To Install Prometheus on Raspberry PI or Orange PI

Prometheus is a leading open-source monitoring solution with alerting functional. By default, Prometetheus export only itself metrics and need aditioanl module for accept more information. You can finde more information on: https://prometheus.io/

Safety First

We need one new user for prometeus service without home directory and shell access.

sudo useradd --no-create-home --shell /bin/false prometheus 

according linux best practise create two directorise, one for configuration and other for data.

sudo mkdir /etc/prometheus 
sudo mkdir /var/lib/prometheus

and set new user and group ownership

sudo chown prometheus:prometheus /etc/prometheus 
sudo chown prometheus:prometheus /var/lib/prometheus

Download and Unpack prometheus

Before download, find the latest stable verion on Prometeus download page. At this time it’s: prometheus-2.12.0.linux-armv7.tar.gz

download file and compere checksum:

cd ~
wget https://github.com/prometheus/prometheus/releases/download/v2.12.0/prometheus-2.12.0.linux-armv7.tar.gz
sha256sum prometheus-2.12.0.linux-armv7.tar.gz

if checksume match than unpack archive:

tar xvf  prometheus-2.12.0.linux-armv7.tar.gz 

copy files and directories

sudo cp  prometheus-2.12.0.linux-armv7/prometheus /usr/local/bin/ 
sudo cp prometheus-2.12.0.linux-armv7/promtool /usr/local/bin/
sudo cp -r prometheus-2.12.0.linux-armv7/consoles /etc/prometheus
sudo cp -r prometheus-2.12.0.linux-armv7/console_libraries /etc/prometheus

and set the user and group ownership

sudo chown prometheus:prometheus /usr/local/bin/prometheus 
sudo chown prometheus:prometheus /usr/local/bin/promtool
sudo chown -R prometheus:prometheus /etc/prometheus/consoles
sudo chown -R prometheus:prometheus /etc/prometheus/console_libraries

finally, delete files and directory from your home

rm -rf prometheus-2.12.0.linux-armv7.tar.gz prometheus-2.12.0.linux-armv7

Configuring prometeus to monitor itself

Create configuration in a file with named prometheus.yml:

sudo nano /etc/prometheus/prometheus.yml 

Prometheus config file /etc/prometheus/prometheus.yml

Important: Prometheus configuration file uses the YAML format, don’t user tabs!

global:
  scrape_interval: 15s

scrape_configs:
  - job_name: 'prometheus'
    scrape_interval: 5s
    static_configs:
      - targets: ['localhost:9090']

set the user and group ownership

sudo chown prometheus:prometheus /etc/prometheus/prometheus.yml

Let’s running Prometheus

create a new systemd service file.

sudo nano /etc/systemd/system/prometheus.service 

add following data into the file: /etc/systemd/system/prometheus.service

[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target

[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
    --config.file /etc/prometheus/prometheus.yml \
    --storage.tsdb.path /var/lib/prometheus/ \
    --web.console.templates=/etc/prometheus/consoles \
    --web.console.libraries=/etc/prometheus/console_libraries

[Install]
WantedBy=multi-user.target

then reload systemd,

sudo systemctl daemon-reload 

start service,

sudo systemctl start prometheus 

check status,

sudo systemctl status prometheus 

and after successful running enable the service to start on boot

sudo systemctl enable prometheus

find out your IP address

ifconfig

open link in browser

ESP8266: ThingBoard платформа для сбора и обработки данных

 

code

[collapse]

Цифровой датчик света и ультрафиолета на Si1145

UV Sensor

[collapse]

OpenWeatherMap пример работы

GET

[collapse]
JSON

[collapse]

Thingspeak пример работы

ESP8266

[collapse]
ESP32

[collapse]

web server css

Title

[collapse]

Web Weather Station

Title

[collapse]

ESP8266 Web Server

Title

[collapse]