Merge branch 'master' into master

This commit is contained in:
don
2021-10-20 22:27:01 -04:00
committed by GitHub
14 changed files with 326 additions and 11 deletions

View File

@@ -33,6 +33,7 @@ You're done! Now just click App Templates and deploy applications!
[![Pi-Hosted Playlist](https://i.ytimg.com/vi/cO2-gQ09Jj0/hqdefault.jpg?sqp=-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLAfgdX8HlHas2CddSmgwJzergnTzQ)](https://www.youtube.com/watch?v=cO2-gQ09Jj0&list=PL846hFPMqg3jwkxcScD1xw2bKXrJVvarc)
| | Episode |
|---|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1 | [Raspberry Pi 4 Server Setup, Docker Install, Portainer Install, Shell In A Box](https://www.youtube.com/watch?v=cO2-gQ09Jj0&list=PL846hFPMqg3jwkxcScD1xw2bKXrJVvarc&index=1) |
@@ -43,6 +44,12 @@ You're done! Now just click App Templates and deploy applications!
| 6 | [Portainer.io App Template for Raspberry Pi arm/arm64 I Need Your Help!](https://www.youtube.com/watch?v=Zn-VELlaIN4&list=PL846hFPMqg3jwkxcScD1xw2bKXrJVvarc&index=6) |
| 7 | [Upgrading Portainer and Updating Containers](https://www.youtube.com/watch?v=q3wKqk8qVS8&list=PL846hFPMqg3jwkxcScD1xw2bKXrJVvarc&index=7) |
| 8 | [Raspberry Pi Docker Monitoring](https://www.youtube.com/watch?v=IoD3vFuep64&list=PL846hFPMqg3jwkxcScD1xw2bKXrJVvarc&index=8) |
=======
### Addition Documentation can be found in the Docs Folder
https://github.com/novaspirit/pi-hosted/tree/master/docs
### Contributors

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

171
docs/rpi_docker_monitor.md Executable file
View File

@@ -0,0 +1,171 @@
# Install and setup instructions for the RPI Docker Monitor
## Introduction
A monitoring solution for Docker hosts and containers with [Prometheus](https://prometheus.io/), [Grafana](http://grafana.org/), [cAdvisor](https://github.com/google/cadvisor), [NodeExporter](https://github.com/prometheus/node_exporter).
## Screenshot
![screencapture-192-168-1-100-1013-d-Ss3q6hSZk-docker-and-os-metrics-2021-10-13-21_35_57](https://user-images.githubusercontent.com/18188407/137201307-a47cf9c3-fe8b-4792-8bd1-3fc02f89893b.png)
# Installation
## Pre-Installation Steps
First SSH into your Pi and there is one thing we need to do before we get cracking. We need to enable `c-groups` so the stack will work out of the box. To do this you need to modify the configuration file `cmdline.txt`: This is stored in various locations depending on your OS.
### Pi OS
```
sudo nano /boot/cmdline.txt
```
### Ubuntu OS
```
sudo nano /boot/firmware/cmdline.txt
```
### All OS's add the following options to the begin of the line:
```
cgroup_enable=memory cgroup_memory=1
```
### Now save the file in your editor and reboot:
```
sudo reboot
```
### Confirm that c-groups are enabled
```
cat /proc/cgroups
```
You should see output something like this.
```
#subsys_name hierarchy num_cgroups enabled
cpuset 9 15 1
cpu 7 69 1
cpuacct 7 69 1
blkio 8 69 1
memory 11 158 1
devices 3 69 1
freezer 5 16 1
net_cls 2 15 1
perf_event 6 15 1
net_prio 2 15 1
pids 4 76 1
rdma 10 1 1
```
The numbers aren't really important what is important is that you see memory in the list if you don't confirm you have put it in the correct file. Don't go on until you get this working.
## Folder Setup Script
First thing we need to do is setup the folder structure and install some files that need to be in place for everything to work correctly.
Run the following script
```
sudo ./rpi_docker_monitor.sh
```
Your output should look something like this
```
# sudo ./rpi_docker_monitor.sh
creating directories
downloading prometheus config files
--2021-10-17 00:56:28-- https://raw.githubusercontent.com/oijkn/Docker-Raspberry-PI-Monitoring/main/prometheus/prometheus.yml
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.110.133, 185.199.109.133, 185.199.111.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 163 [text/plain]
Saving to: /portainer/Files/AppData/Config/prometheus/config/prometheus.yml
/portainer/Files/AppData/Config/prometheus/config/promethe 100%[=======================================================================================================================================>] 163 --.-KB/s in 0s
2021-10-17 00:56:28 (971 KB/s) - /portainer/Files/AppData/Config/prometheus/config/prometheus.yml saved [163/163]
setting permissions
Done You are ready to goto next step in the install document
```
### This Step is now complete go to the next step.
<br><br>
## Install the App Template.<br>
[comment]: # (FixMe)
![alt text](https://raw.githubusercontent.com/novaspirit/pi-hosted/master/docs/images/rpi_docker_monitor-AppTemplatesList.png)
Goto App Templates and install "Raspberry Pi Docker Monitor"
The default settings should all be good so **Deploy the Stack**
<br><br>
## Setup Grafana
Navigate to Grafana `http://<host-ip>:3000` and login with user ***admin*** password ***admin***. You can change the credentials in the template file or by supplying the `ADMIN_USER` and `ADMIN_PASSWORD` environment variables inside the container monitoring-prometheus.
```yaml
GF_SECURITY_ADMIN_USER=admin
GF_SECURITY_ADMIN_PASSWORD=changeme
GF_USERS_ALLOW_SIGN_UP=false
```
### Setup Prometheus as the default data source.
```
Grafana > Configuration > Data Sources > Prometheus
```
**It is important that you set the URL to http://monitoring-prometheus:9090/**<br><br>
![image](https://raw.githubusercontent.com/novaspirit/pi-hosted/master/docs/images/rpi_docker_monitor-DataSource.png)
### Setup the Dashboard
Grafana is not preconfigured with dashboard, so you have to import it from the [json](https://github.com/oijkn/Docker-Raspberry-PI-Monitoring/blob/main/grafana/dashboard_by_oijkn.json) file.
```
Grafana > + > Import
```
![image](https://raw.githubusercontent.com/novaspirit/pi-hosted/master/docs/images/rpi_docker_monitor-Dashboard-Menu-Import.png)
Now we open the [json](https://github.com/oijkn/Docker-Raspberry-PI-Monitoring/blob/main/grafana/dashboard_by_oijkn.json) file and Click on the "raw" button to copy the content from the json file.
(!["raw" button](https://raw.githubusercontent.com/novaspirit/pi-hosted/master/docs/images/rpi_docker_monitor-Raw.png))
Once copied into the bigger of the 2 boxes Click Load.
![image](https://raw.githubusercontent.com/novaspirit/pi-hosted/master/docs/images/rpi_docker_monitor-Dashboard-Import.png)
Now we can display the dashboard
```
Grafana > Dashboard > Manage
```
![image](https://raw.githubusercontent.com/novaspirit/pi-hosted/master/docs/images/rpi_docker_monitor-Menu-Dashboard-Manage.png)
There should be just the one item list. Select "Docker and OS Metrics" from the list and you should see the dashboard listed below.
![image](https://raw.githubusercontent.com/novaspirit/pi-hosted/master/docs/images/rpi_docker_monitor-Dashboard-Manage.png)
![screencapture-192-168-1-100-1013-d-Ss3q6hSZk-docker-and-os-metrics-2021-10-13-21_35_57](https://user-images.githubusercontent.com/18188407/137201307-a47cf9c3-fe8b-4792-8bd1-3fc02f89893b.png)
> Hint: Well the Dashboard is displayed you can select your profile > Preferences and change the default Dashboard to the new Dashboard you just create and it will always display the new Dashboad when you login.
![image](https://raw.githubusercontent.com/novaspirit/pi-hosted/master/docs/images/rpi_docker_monitor-Menu-User-Preferences.png)
![image](https://raw.githubusercontent.com/novaspirit/pi-hosted/master/docs/images/rpi_docker_monitor-Preferences-Dashboard.png)
## Pi Hosted : Raspberry Pi Docker Monitoring Part 7
[![Pi Hosted : Raspberry Pi Docker Monitoring Part 7](https://i.ytimg.com/vi/IoD3vFuep64/hqdefault.jpg?sqp=-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE&rs=AOn4CLDBjV3a9aT7NV28n88mqqogOzLUww)](https://www.youtube.com/watch?v=IoD3vFuep64)4
## Acknowledgment
* based on [Docker-Raspberry-PI-Monitoring](https://github.com/oijkn/Docker-Raspberry-PI-Monitoring) by Oijkn

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@@ -388,6 +388,35 @@
]
},
{
"categories": [
"Other",
"Tools"
],
"description": "InfluxDB is an open source time series database for recording metrics, events, and analytics. You will need to add /portainer/Files/AppData/Config/Influxdb/config/influxdb.conf",
"image": "influxdb:1.8.10",
"logo": "https://raw.githubusercontent.com/docker-library/docs/43d87118415bb75d7bb107683e79cd6d69186f67/influxdb/logo.png",
"name": "influxdb1810",
"platform": "linux",
"ports": [
"8086:8086/tcp"
],
"restart_policy": "unless-stopped",
"hostname": "rpi-influxdb1810",
"title": "Influxdb 1.8.10",
"type": 1,
"volumes": [
{
"bind": "/portainer/Files/AppData/Config/Influxdb/data",
"container": "/var/lib/influxdb"
},
{
"bind": "/portainer/Files/AppData/Config/Influxdb/config",
"container": "/var/lib/influxdb"
}
]
},
{
"categories": [
"Downloaders",
@@ -930,6 +959,38 @@
"title": "Minisatip",
"type": 1
},
{
"categories": [
"Other",
"Tools"
],
"description": "Eclipse Mosquitto is an open source implementation of a server for versions 5, 3.1.1, and 3.1 of the MQTT protocol.\r\nYou will need to create /portainer/Files/AppData/Config/Mosquitto/config/mosquitto.conf and if needed your password file.\r\nHave a look on https://mosquitto.org/man/mosquitto_passwd-1.html",
"image": "eclipse-mosquitto:latest",
"logo": "https://raw.githubusercontent.com/docker-library/docs/757578e3a44e5460a8a11d32a81776f8b74231a9/eclipse-mosquitto/logo.png",
"name": "mosquitto",
"platform": "linux",
"ports": [
"1883:1883/tcp"
],
"restart_policy": "unless-stopped",
"hostname": "rpi-mosquitto",
"title": "Eclipse Mosquitto",
"type": 1,
"volumes": [
{
"bind": "/portainer/Files/AppData/Config/Mosquitto/config",
"container": "/mosquitto/config"
},
{
"bind": "/portainer/Files/AppData/Config/Mosquitto/data",
"container": "/mosquitto/data"
},
{
"bind": "/portainer/Files/AppData/Config/Mosquitto/log",
"container": "/mosquitto/log"
}
]
},
{
"categories": [
"Other",
@@ -2566,7 +2627,7 @@
"53:53/udp",
"67:67/udp",
"1010:80/tcp",
"4443:443/tcp"
"443:443/tcp"
],
"restart_policy": "unless-stopped",
"title": "Pi-Hole",
@@ -4174,14 +4235,9 @@
"description": "Run a Speedtest every hour and graph the results.",
"env": [
{
"default": "1000",
"label": "PUID",
"name": "PUID"
},
{
"default": "100",
"label": "PGID",
"name": "PGID"
"default": "arch",
"label": "arch",
"set": "x86_64"
},
{
"label": "OOKLA_EULA_GDPR",
@@ -4189,7 +4245,7 @@
"set": "true"
}
],
"image": "henrywhitaker3/speedtest-tracker:latest-arm",
"image": "henrywhitaker3/speedtest-tracker:dev-arm",
"logo": "https://raw.githubusercontent.com/novaspirit/pi-hosted/master/pi-hosted_template/images/speedtest-tracker.png",
"name": "speedtest-tracker",
"platform": "linux",
@@ -4293,6 +4349,87 @@
"container": "/app/data"
}
]
},
{
"categories": [
"Other",
"Tools"
],
"description": "A self-hosted recipe manager and meal planner",
"image": "hkotel/mealie:latest",
"logo": "https://raw.githubusercontent.com/novaspirit/pi-hosted/master/pi-hosted_template/images/mealie.png",
"name": "mealie",
"note": "Default Credentials: Username: changeme@email.com Password: MyPassword. Documentation is Available \u003ca href='https://hay-kot.github.io/mealie/documentation/getting-started/install/'\u003ehere\u003c/a\u003e.",
"platform": "linux",
"ports": [
"9925:80/tcp"
],
"restart_policy": "unless-stopped",
"title": "Mealie",
"type": 1,
"volumes": [
{
"bind": "/portainer/Files/AppData/Config/mealie",
"container": "/app/data"
}
],
"env": [
{
"default": "1000",
"label": "PUID",
"name": "PUID"
},
{
"default": "1000",
"label": "PGID",
"name": "PGID"
},
{
"default": "Europe/Berlin",
"label": "TZ",
"name": "TZ"
},
{
"default": "2",
"label": "WEB_CONCURRENCY",
"name": "WEB_CONCURRENCY"
},
{
"default": "8",
"label": "MAX_WORKERS",
"name": "MAX_WORKERS"
},
{
"default": true,
"label": "RECIPE_PUBLIC",
"name": "RECIPE_PUBLIC"
},
{
"default": true,
"label": "RECIPE_SHOW_NUTRITION",
"name": "RECIPE_SHOW_NUTRITION"
},
{
"default": true,
"label": "RECIPE_SHOW_ASSETS",
"name": "RECIPE_SHOW_ASSETS"
},
{
"default": true,
"label": "RECIPE_LANDSCAPE_VIEW",
"name": "RECIPE_LANDSCAPE_VIEW"
},
{
"default": false,
"label": "RECIPE_DISABLE_COMMENTS",
"name": "RECIPE_DISABLE_COMMENTS"
},
{
"default": false,
"label": "RECIPE_DISABLE_AMOUNT",
"name": "RECIPE_DISABLE_AMOUNT"
}
]
}
]
}

View File

@@ -26,4 +26,4 @@ sudo wget -O /portainer/Files/AppData/Config/prometheus/config/prometheus.yml ht
sudo touch /portainer/Files/AppData/Config/grafana/grafana.ini || error "Failed to touch grafana.ini file!"
echo "Setting permissions..."
sudo chown -R 472:472 /portainer/Files/AppData/Config/grafana/data || error "Failed to set permissions for Grafana data!"
echo "Done"
echo "Done You are ready to goto next step in the install document"