Last active
December 27, 2021 19:55
-
-
Save John-Appleseed/565147cb1ded069ab90b40f6fba5ea6a to your computer and use it in GitHub Desktop.
scrutiny_install.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# scrutiny.install: port 7800 | |
# app: https://github.com/AnalogJ/scrutiny | |
# SYS_ADMIN required to add NVMe drives | |
scrutiny.install(){ | |
unset devices disks_all disks_all_list | |
app_path="/data/scrutiny" | |
config_path="$app_path/config" | |
mkdir -p "$app_path/config" | |
cd "$app_path" | |
# Configure custom device types for certain drives. ex. NVMe USB | |
# https://www.smartmontools.org/wiki/USB | |
sudo tee "$app_path/config/collector.yaml" > /dev/null <<'EOF' | |
version: 1 | |
devices: | |
- device: /dev/sdb | |
type: 'sntjmicron' | |
- device: /dev/sdc | |
type: 'scsi' | |
EOF | |
# Automatically add all drives listed from `fdisk -l` to attach to the scrutiny docker container. | |
disks_all="$(sudo fdisk -l | grep -e "^Disk /dev" | grep -v mapper | grep -v loop | awk '{print $2}' | tr ":\n" " ")" | |
disks_all_list=( $disks_all ) | |
for disk in ${disks_all_list[@]}; do | |
devices="$devices | |
- \"$disk\"" | |
done | |
# Create docker-compose.yaml | |
sudo tee "$app_path/docker-compose.yaml" > /dev/null <<EOF | |
version: '3.5' | |
services: | |
scrutiny: | |
container_name: scrutiny | |
image: analogj/scrutiny | |
privileged: false | |
environment: | |
- PUID=1000 | |
- PGID=1000 | |
- TZ=America/Chicago | |
cap_add: | |
- SYS_RAWIO | |
- SYS_ADMIN | |
ports: | |
- "7800:8080" | |
volumes: | |
- /usr/share/zoneinfo:/usr/share/zoneinfo:ro | |
- /run/udev:/run/udev:ro | |
- $config_path:/scrutiny/config | |
devices: $devices | |
EOF | |
cat "$app_path/config/collector.yaml" | |
cat "$app_path/docker-compose.yaml" | |
echo Running Scrutiny docker container in the background. | |
cd "$app_path" | |
echo sudo docker-compose up -d | |
sudo docker-compose up -d | |
echo open http://localhost:7800 | |
} | |
# --- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment