### Start Scrutiny Backend Server Source: https://github.com/analogj/scrutiny/blob/master/CONTRIBUTING.md Command to start the Scrutiny web server using Go. Ensure you have the Go runtime installed and the frontend distribution downloaded. ```bash go mod vendor go run webapp/backend/cmd/scrutiny/scrutiny.go start --config ./scrutiny.yaml ``` -------------------------------- ### Start Scrutiny Frontend Angular Application Source: https://github.com/analogj/scrutiny/blob/master/CONTRIBUTING.md Commands to install dependencies and start the Angular frontend development server. This is useful for frontend development with mocked data. ```bash cd webapp/frontend npm install npm run start -- --serve-path="/web/" --port 4200 ``` -------------------------------- ### Start Scrutiny Web Server Source: https://github.com/analogj/scrutiny/blob/master/CONTRIBUTING.md Command to start the Scrutiny web server using Go. Ensure you have the Go runtime installed and run this command from the project root. ```bash go mod vendor go run webapp/backend/cmd/scrutiny/scrutiny.go start --config ./scrutiny.yaml ``` -------------------------------- ### Run Ansible Playbook Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_ANSIBLE.md Execute the Ansible playbook to install Scrutiny. Ensure you have followed the setup directions in the playbook repository. ```bash ansible-playbook site.yml ``` -------------------------------- ### Start Scrutiny Webapp Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_MANUAL.md Starts the Scrutiny webapp using the specified configuration file. The webapp will be accessible at http://0.0.0.0:8080 by default. ```bash /opt/scrutiny/bin/scrutiny-web-linux-amd64 start --config /opt/scrutiny/config/scrutiny.yaml ``` -------------------------------- ### Install smartmontools on pfSense Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_PFSENSE.md Installs the smartmontools package, a dependency for the Scrutiny collector. Ensure smartmontools is v7+. ```bash pkg install smartmontools ``` -------------------------------- ### Install Community Applications Plugin URL Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_UNRAID.md Use this URL to install the Community Applications plugin in UnRAID. Navigate to the plugins tab and select 'Install Plugin'. ```bash https://raw.githubusercontent.com/Squidly271/community.applications/master/plugins/community.applications.plg ``` -------------------------------- ### Start Scrutiny Web Service Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_ROOTLESS_PODMAN.md Use this command to start the Scrutiny web service as a user service. Ensure the service file is correctly configured. ```bash sudo systemctl --user -M scrutiny-svc@ start scrutiny-web.service ``` -------------------------------- ### Start Web Server with Debug and Log File CLI Arguments Source: https://github.com/analogj/scrutiny/blob/master/README.md Start the Scrutiny web server using command-line arguments to enable debug mode and specify a log file. ```bash scrutiny start --debug --log-file /tmp/web.log ``` -------------------------------- ### Install smartmontools via opkg Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_SYNOLOGY_COLLECTOR.md Installs the smartmontools package, which provides utilities for monitoring hard drive health. This is a prerequisite for the Scrutiny collector. ```bash sudo opkg install smartmontools ``` -------------------------------- ### Install smartmontools on CentOS 8 Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_MANUAL.md Installs smartmontools on CentOS 8 by first adding the necessary repository and then installing the package. ```bash dnf install https://extras.getpagespeed.com/release-el8-latest.rpm dnf install smartmontools ``` -------------------------------- ### Upgrade installed packages with opkg Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_SYNOLOGY_COLLECTOR.md Run this command to upgrade all installed packages via Entware. It's recommended to run after updating the package list. ```bash sudo opkg upgrade ``` -------------------------------- ### Install smartmontools on Ubuntu Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_MANUAL.md Installs the smartmontools package, which includes the smartctl utility required by the Scrutiny collector. Use the specific version for Ubuntu 18.04 if needed. ```bash apt-get install -y smartmontools ``` ```bash apt-get install -y smartmontools=7.0-0ubuntu1~ubuntu18.04.1 ``` -------------------------------- ### Create Scrutiny directories Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_SYNOLOGY_COLLECTOR.md Creates the necessary directories for the Scrutiny collector binary and configuration files within the Entware installation path. ```bash mkdir -p /volume1/\@Entware/scrutiny/bin mkdir -p /volume1/\@Entware/scrutiny/conf ``` -------------------------------- ### Install eudev on Alpine Linux Source: https://github.com/analogj/scrutiny/blob/master/docs/TROUBLESHOOTING_UDEV.md Use this command to install the eudev package on Alpine Linux. This provides udev functionality on systems where it is not present by default. ```bash apk add eudev setup-udev ``` -------------------------------- ### Enable and Start Scrutiny Timer Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_MANUAL.md After creating the timer configuration, reload systemd to recognize the changes and then enable and start the Scrutiny collector timer. ```bash # reload changes for systemd services sudo systemctl daemon-reload # now enable the timer sudo systemctl enable --now scrutiny-collector.timer ``` -------------------------------- ### Install Scrutiny Collector Dependencies Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_HUB_SPOKE.md Installs the necessary smartmontools package for the Scrutiny Collector. Ensure you are using a compatible package manager like apt. ```bash apt install smartmontools -y ``` -------------------------------- ### Start InfluxDB Docker Container Source: https://github.com/analogj/scrutiny/blob/master/CONTRIBUTING.md Command to start an InfluxDB Docker container for local development. This container will be removed upon stopping. ```bash docker run -p 8086:8086 --rm influxdb:2.8 ``` -------------------------------- ### Update package list with opkg Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_SYNOLOGY_COLLECTOR.md Run this command to update the package list for Entware. Ensure Entware is installed and configured correctly before running. ```bash sudo opkg update ``` -------------------------------- ### Start Scrutiny Collector Service Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_MANUAL.md Use this command to start the Scrutiny collector service. Check system logs and enable debug logging if issues arise. ```bash sudo systemctl start scrutiny-collector.service ``` -------------------------------- ### Scrutiny collector configuration example Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_SYNOLOGY_COLLECTOR.md An example configuration for the Scrutiny collector. Key sections include `host.id` for server identification, `devices` for specifying disks to monitor, and `api.endpoint` for the Scrutiny API URL. ```yaml host: id: 'Server_Name' devices: # # example for forcing device type detection for a single disk - device: /dev/sda type: 'sat' - device: /dev/sdb type: 'sat' - device: /dev/sdc type: 'sat' - device: /dev/sdd type: 'sat' api: endpoint: 'http://:8080' ``` -------------------------------- ### Scrutiny Backend Configuration Source: https://github.com/analogj/scrutiny/blob/master/CONTRIBUTING.md Example configuration file for the Scrutiny backend development environment. Ensure this is stored as `scrutiny.yaml`. ```yaml version: 1 web: listen: port: 8080 host: 0.0.0.0 database: # can also set absolute path here location: ./scrutiny.db src: frontend: path: ./dist influxdb: retention_policy: false log: file: 'web.log' #absolute or relative paths allowed, eg. web.log level: DEBUG ``` -------------------------------- ### Start InfluxDB Docker Container Source: https://github.com/analogj/scrutiny/blob/master/CONTRIBUTING.md Command to start an InfluxDB Docker container for local development. This container will be removed automatically upon stopping. ```bash docker run -p 8086:8086 --rm influxdb:2.8 ``` -------------------------------- ### Run Angular Development Server Source: https://github.com/analogj/scrutiny/blob/master/webapp/frontend/README.md Use this command to start the development server. It automatically reloads the application when source files are changed. ```bash ng serve ``` -------------------------------- ### Reload Systemd User Services and Start InfluxDB Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_ROOTLESS_PODMAN.md After creating or modifying quadlet files, reload the systemd user manager for the service account. Then, start the network and the InfluxDB service, checking its status. ```bash sudo systemctl --user -M scrutiny-svc@ daemon-reload sudo systemctl --user -M scrutiny-svc@ start scrutiny-net-network.service sudo systemctl --user -M scrutiny-svc@ start influxdb.service sudo systemctl --user -M scrutiny-svc@ status influxdb.service ``` -------------------------------- ### Build Angular Frontend Application Source: https://github.com/analogj/scrutiny/blob/master/CONTRIBUTING.md Steps to install Node.js dependencies and build the Angular frontend in production mode with watch enabled. The `--prod` flag is crucial for using real API data; omitting it will result in mocked data. ```bash cd webapp/frontend npm install npm run build:prod -- --watch --output-path=../../dist ``` -------------------------------- ### URL-Encoded Credentials Example Source: https://github.com/analogj/scrutiny/blob/master/docs/TROUBLESHOOTING_NOTIFICATIONS.md When using special characters in username or password fields for Shoutrrr, they must be URL-encoded. This example shows how to construct the Shoutrrr URL with encoded credentials. ```text smtp://myname%40example%2Ecom:124%4034%241@ms.my.domain.com:587 ``` -------------------------------- ### Get Angular CLI Help Source: https://github.com/analogj/scrutiny/blob/master/webapp/frontend/README.md Access help information for the Angular CLI or specific commands. Refer to the Angular CLI README for more details. ```bash ng help ``` -------------------------------- ### Download and rename collector config Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_SYNOLOGY_COLLECTOR.md Downloads the example collector configuration file and renames it to `collector.yaml`. This file will be used to configure the Scrutiny collector's behavior. ```bash cd /volume1/\@Entware/scrutiny/conf wget https://raw.githubusercontent.com/AnalogJ/scrutiny/master/example.collector.yaml mv example.collector.yaml collector.yaml ``` -------------------------------- ### InfluxDB API Token Response Example Source: https://github.com/analogj/scrutiny/blob/master/docs/TROUBLESHOOTING_INFLUXDB.md This is an example of the JSON response received after successfully creating an InfluxDB API token. The 'token' field is essential and must be copied to your scrutiny.yaml configuration file. ```json { "token": "ksVU2t5SkQwYkvIxxxxxxxYt2xUt0uRKSbSF1Po0UQ==", "status": "active", "description": "scrutiny - restricted scope token", "orgID": "b2495586xxxx", "org": "my-org", "user": "admin", "permissions": [ { "action": "read", "resource": { "type": "orgs" } }, { "action": "read", "resource": { "type": "tasks" } }, { "action": "write", "resource": { "type": "tasks", "id": "09a64exxxxx", "orgID": "b24955860xxxxx", "org": "my-org" } }, ... ] } ``` -------------------------------- ### Scrutiny v0.4.x Upgrade Error Log Source: https://github.com/analogj/scrutiny/blob/master/docs/TROUBLESHOOTING_INFLUXDB.md This log snippet indicates a common panic during the v0.4.x upgrade, specifically requiring a username and password for setup. ```log 2022/05/13 14:38:05 Loading configuration file: /opt/scrutiny/config/scrutiny.yaml time="2022-05-13T14:38:05Z" level=info msg="Trying to connect to scrutiny sqlite db:" time="2022-05-13T14:38:05Z" level=info msg="Successfully connected to scrutiny sqlite db:" panic: a username and password is required for a setup ``` -------------------------------- ### Modify Scrutiny Collector Source: https://github.com/analogj/scrutiny/blob/master/CONTRIBUTING.md Instructions for installing `smartmontools` via Homebrew and running the Scrutiny collector metrics executable in debug mode. ```bash brew install smartmontools go run collector/cmd/collector-metrics/collector-metrics.go run --debug ``` -------------------------------- ### Run Scrutiny Omnibus Docker Container Source: https://github.com/analogj/scrutiny/blob/master/README.md This command starts the Scrutiny omnibus image, which includes both the web UI and the collector. It maps ports, mounts volumes for configuration and data, and grants necessary device access and capabilities. ```bash docker run -p 8080:8080 -p 8086:8086 --restart unless-stopped \ -v `pwd`/scrutiny:/opt/scrutiny/config \ -v `pwd`/influxdb:/opt/scrutiny/influxdb \ -v /run/udev:/run/udev:ro \ --cap-add SYS_RAWIO \ --device=/dev/sda \ --device=/dev/sdb \ --name scrutiny \ ghcr.io/analogj/scrutiny:latest-omnibus ``` -------------------------------- ### Scrutiny Base HREF Setup Source: https://github.com/analogj/scrutiny/blob/master/webapp/frontend/src/index.html This JavaScript code dynamically sets the base HREF for the application, which is crucial for correct asset loading in web applications. It extracts the base path from the current window location. ```javascript document.write(\<^base href="${window.location.pathname.split('/web').slice(0, 1)[0]}/web/"/>"); ``` -------------------------------- ### Trigger udev events Source: https://github.com/analogj/scrutiny/blob/master/docs/TROUBLESHOOTING_UDEV.md Run this command to trigger udev events after installing or setting up a udev implementation. On Alpine Linux, this also creates symlinks to device serial numbers in /dev/disk/by-id. ```bash udevadm trigger ``` -------------------------------- ### Run Scrutiny Hub/Spoke Docker Containers Source: https://github.com/analogj/scrutiny/blob/master/README.md This set of commands deploys Scrutiny in a hub-and-spoke model. It starts an InfluxDB container for data storage, a web container for the UI/API, and a collector container for gathering SMART data from individual servers. ```bash docker run -p 8086:8086 --restart unless-stopped \ -v `pwd`/influxdb2:/var/lib/influxdb2 \ --name scrutiny-influxdb \ influxdb:2.8 docker run -p 8080:8080 --restart unless-stopped \ -v `pwd`/scrutiny:/opt/scrutiny/config \ --name scrutiny-web \ ghcr.io/analogj/scrutiny:latest-web docker run --restart unless-stopped \ -v /run/udev:/run/udev:ro \ --cap-add SYS_RAWIO \ --device=/dev/sda \ --device=/dev/sdb \ -e COLLECTOR_API_ENDPOINT=http://SCRUTINY_WEB_IPADDRESS:8080 \ --name scrutiny-collector \ ghcr.io/analogj/scrutiny:latest-collector ``` -------------------------------- ### Run Docker Compose for Scrutiny Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_MANUAL_WINDOWS.md Use this command to start the InfluxDB database and webapp/API components of Scrutiny using Docker Compose. Ensure you have modified the docker-compose.yml file to exclude the collector section. ```bash docker-compose up -d ``` -------------------------------- ### Setup Environmental Variables for InfluxDB Source: https://github.com/analogj/scrutiny/blob/master/docs/TROUBLESHOOTING_INFLUXDB.md These bash commands set environment variables required for Scrutiny to connect to an existing InfluxDB installation. Ensure these values are replaced with your specific InfluxDB credentials and hostname. ```bash # replace the following values with correct values for your InfluxDB installation export INFLUXDB_ADMIN_TOKEN=pCqRq7xxxxxx-FZgNLfstIs0w== export INFLUXDB_ORG_ID=b2495xxxxx export INFLUXDB_HOSTNAME=http://localhost:8086 # if you want to change the bucket name prefix below, you'll also need to update the setting in the scrutiny.yaml config file. export INFLUXDB_SCRUTINY_BUCKET_BASENAME=metrics ``` -------------------------------- ### Prepare Scrutiny Webapp Filesystem Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_MANUAL.md Makes the Scrutiny webapp binary executable and extracts the frontend files. Ensure the tarball is in the correct directory before extraction. ```bash # Let's make sure the Scrutiny webapp is executable. chmod +x /opt/scrutiny/bin/scrutiny-web-linux-amd64 # Next, lets extract the frontend files. # NOTE: after extraction, there **should not** be a `dist` subdirectory in `/opt/scrutiny/web` directory. cd /opt/scrutiny/web tar xvzf scrutiny-web-frontend.tar.gz --strip-components 1 -C . # Cleanup rm -rf scrutiny-web-frontend.tar.gz ``` -------------------------------- ### Create Systemd User Directory for Quadlets Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_ROOTLESS_PODMAN.md Prepare the directory structure for systemd user services (quadlets) specific to the service account's user ID. ```bash sudo mkdir -p /etc/containers/systemd/users/$(id -u scrutiny-svc) cd /etc/containers/systemd/users/$(id -u scrutiny-svc) ``` -------------------------------- ### Build Angular Project for Production Source: https://github.com/analogj/scrutiny/blob/master/webapp/frontend/README.md Build the project for deployment. Use the `--prod` flag for a production-optimized build. Artifacts are stored in the `dist/` directory. ```bash ng build --prod ``` -------------------------------- ### Create Scrutiny Directory Structure Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_MANUAL.md Creates the necessary directories for Scrutiny configuration, web files, and binaries. Ensure the parent directory exists before running. ```bash mkdir -p /opt/scrutiny/config mkdir -p /opt/scrutiny/web mkdir -p /opt/scrutiny/bin ``` -------------------------------- ### Download and Prepare Scrutiny Collector Binary Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_HUB_SPOKE.md Downloads the Scrutiny Collector binary, makes it executable, and places it in the designated directory. Always verify the release version matches your needs. ```bash mkdir -p /opt/scrutiny/bin && \ curl -L https://github.com/AnalogJ/scrutiny/releases/download/v0.8.1/scrutiny-collector-metrics-linux-amd64 > /opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 && \ chmod +x /opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 && \ ls -lha /opt/scrutiny/bin ``` -------------------------------- ### Move Scrutiny Collector Binary Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_MANUAL.md Moves the downloaded Scrutiny collector binary to its final installation directory. ```sh sudo mv /tmp/scrutiny-collector-metrics /opt/scrutiny/bin/ ``` -------------------------------- ### Enable Debug Logging and Log Files for Web Server via Environment Variables Source: https://github.com/analogj/scrutiny/blob/master/README.md Use environment variables to enable debug logging and specify a log file path for the Scrutiny web server. ```bash DEBUG=true SCRUTINY_LOG_FILE=/tmp/web.log ``` -------------------------------- ### Schedule Scrutiny Collector with Cron Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_MANUAL.md Schedules the Scrutiny collector to run periodically using cron. This example runs the collector every 15 minutes. ```sh # open crontab sudo crontab -e # add a line for Scrutiny */15 * * * * . /etc/profile; /opt/scrutiny/bin/scrutiny-collector-metrics run --api-endpoint "http://localhost:8080" ``` -------------------------------- ### Create Scrutiny Service Directories Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_ROOTLESS_PODMAN.md Set up the necessary directory structure for Scrutiny's configuration and InfluxDB data storage. Ensure the service account owns these directories. ```bash sudo mkdir -p /opt/scrutiny-svc/scrutiny/{config,influxdb} sudo wget -O /opt/scrutiny-svc/scrutiny/config/scrutiny.yaml https://raw.githubusercontent.com/AnalogJ/scrutiny/refs/heads/master/example.scrutiny.yaml sudo chown -R scrutiny-svc:scrutiny-svc /opt/scrutiny-svc ``` -------------------------------- ### Manage Scrutiny Collector Systemd Service Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_MANUAL.md Commands to reload systemd configurations after service file changes and to enable the Scrutiny collector service to start on boot. ```sh # reload changes for systemd services sudo systemctl daemon-reload # enable the service sudo systemctl enable scrutiny-collector.service ``` -------------------------------- ### Scan Devices with Smartctl Locally Source: https://github.com/analogj/scrutiny/blob/master/docs/TROUBLESHOOTING_DEVICE_COLLECTOR.md Run `smartctl --scan` on your host machine to verify that all drives are detected correctly before configuring Scrutiny. This helps isolate issues to either smartmontools or Scrutiny's integration. ```bash smartctl --scan /dev/sda -d scsi # /dev/sda, SCSI device /dev/sdb -d scsi # /dev/sdb, SCSI device /dev/sdc -d scsi # /dev/sdc, SCSI device /dev/sdd -d scsi # /dev/sdd, SCSI device ``` -------------------------------- ### Populate Database with Test Data Source: https://github.com/analogj/scrutiny/blob/master/CONTRIBUTING.md Commands to populate the Scrutiny database with test data using `curl` and a Go helper script. Note that timestamps older than approximately 3 weeks may be ignored due to retention policies. ```bash docker run -p 8086:8086 --rm influxdb:2.8 # curl -X POST -H "Content-Type: application/json" -d @webapp/backend/pkg/web/testdata/register-devices-req.json localhost:8080/api/devices/register # curl -X POST -H "Content-Type: application/json" -d @webapp/backend/pkg/models/testdata/smart-ata.json localhost:8080/api/device/0x5000cca264eb01d7/smart # curl -X POST -H "Content-Type: application/json" -d @webapp/backend/pkg/models/testdata/smart-ata-date.json localhost:8080/api/device/0x5000cca264eb01d7/smart # curl -X POST -H "Content-Type: application/json" -d @webapp/backend/pkg/models/testdata/smart-ata-date2.json localhost:8080/api/device/0x5000cca264eb01d7/smart # curl -X POST -H "Content-Type: application/json" -d @webapp/backend/pkg/models/testdata/smart-fail2.json localhost:8080/api/device/0x5000cca264ec3183/smart # curl -X POST -H "Content-Type: application/json" -d @webapp/backend/pkg/models/testdata/smart-nvme.json localhost:8080/api/device/0x5002538e40a22954/smart # curl -X POST -H "Content-Type: application/json" -d @webapp/backend/pkg/models/testdata/smart-scsi.json localhost:8080/api/device/0x5000cca252c859cc/smart # curl -X POST -H "Content-Type: application/json" -d @webapp/backend/pkg/models/testdata/smart-scsi2.json localhost:8080/api/device/0x5000cca264ebc248/smart go run webapp/backend/pkg/models/testdata/helper.go curl localhost:8080/api/summary ``` -------------------------------- ### Enable Docker User Lingering for Rootless Mode Source: https://github.com/analogj/scrutiny/blob/master/docs/TROUBLESHOOTING_DOCKER.md Run these commands to ensure Docker containers remain active after closing an SSH session when Docker is installed as rootless. ```bash sudo loginctl enable-linger $(whoami) ``` ```bash systemctl --user enable docker ``` -------------------------------- ### Create Placeholder InfluxDB Buckets Source: https://github.com/analogj/scrutiny/blob/master/docs/TROUBLESHOOTING_INFLUXDB.md Use these cURL commands to create the default, weekly, monthly, and yearly placeholder buckets in InfluxDB. Ensure environment variables like INFLUXDB_HOSTNAME, INFLUXDB_ADMIN_TOKEN, INFLUXDB_ORG_ID, and INFLUXDB_SCRUTINY_BUCKET_BASENAME are set. ```bash curl -sS -X POST ${INFLUXDB_HOSTNAME}/api/v2/buckets \ -H "Content-Type: application/json" \ -H "Authorization: Token ${INFLUXDB_ADMIN_TOKEN}" \ --data-binary @- << EOF { "name": "${INFLUXDB_SCRUTINY_BUCKET_BASENAME}", "orgID": "${INFLUXDB_ORG_ID}", "retentionRules": [] } EOF ``` ```bash curl -sS -X POST ${INFLUXDB_HOSTNAME}/api/v2/buckets \ -H "Content-Type: application/json" \ -H "Authorization: Token ${INFLUXDB_ADMIN_TOKEN}" \ --data-binary @- << EOF { "name": "${INFLUXDB_SCRUTINY_BUCKET_BASENAME}_weekly", "orgID": "${INFLUXDB_ORG_ID}", "retentionRules": [] } EOF ``` ```bash curl -sS -X POST ${INFLUXDB_HOSTNAME}/api/v2/buckets \ -H "Content-Type: application/json" \ -H "Authorization: Token ${INFLUXDB_ADMIN_TOKEN}" \ --data-binary @- << EOF { "name": "${INFLUXDB_SCRUTINY_BUCKET_BASENAME}_monthly", "orgID": "${INFLUXDB_ORG_ID}", "retentionRules": [] } EOF ``` ```bash curl -sS -X POST ${INFLUXDB_HOSTNAME}/api/v2/buckets \ -H "Content-Type: application/json" \ -H "Authorization: Token ${INFLUXDB_ADMIN_TOKEN}" \ --data-binary @- << EOF { "name": "${INFLUXDB_SCRUTINY_BUCKET_BASENAME}_yearly", "orgID": "${INFLUXDB_ORG_ID}", "retentionRules": [] } EOF ``` -------------------------------- ### Run Scrutiny Tests with InfluxDB Source: https://github.com/analogj/scrutiny/blob/master/CONTRIBUTING.md Command to run Scrutiny tests. It starts an InfluxDB container in detached mode with specific initialization environment variables and then executes Go tests. ```bash docker run -p 8086:8086 -d --rm \ -e DOCKER_INFLUXDB_INIT_MODE=setup \ -e DOCKER_INFLUXDB_INIT_USERNAME=admin \ -e DOCKER_INFLUXDB_INIT_PASSWORD=password12345 \ -e DOCKER_INFLUXDB_INIT_ORG=scrutiny \ -e DOCKER_INFLUXDB_INIT_BUCKET=metrics \ -e DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=my-super-secret-auth-token \ influxdb:2.8 go test ./... ``` -------------------------------- ### Configure InfluxDB Credentials via YAML Source: https://github.com/analogj/scrutiny/blob/master/docs/TROUBLESHOOTING_INFLUXDB.md Use this YAML configuration to set custom InfluxDB admin username, password, and API token. This is applied during the initial setup of Scrutiny. ```yaml web: influxdb: token: 'my-custom-token' init_username: 'my-custom-username' init_password: 'my-custom-password' ``` -------------------------------- ### Scrutiny v0.4.x InfluxDB Connection Error Log Source: https://github.com/analogj/scrutiny/blob/master/docs/TROUBLESHOOTING_INFLUXDB.md This log snippet shows a panic related to InfluxDB setup status, often caused by a missing protocol scheme in the connection string. ```log Start the scrutiny server time="2022-06-11T10:35:04-04:00" level=info msg="Trying to connect to scrutiny sqlite db: " time="2022-06-11T10:35:04-04:00" level=info msg="Successfully connected to scrutiny sqlite db: " panic: failed to check influxdb setup status - parse "://": missing protocol scheme ``` -------------------------------- ### Synology Task Scheduler - Schedule Settings Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_SYNOLOGY_COLLECTOR.md Defines the schedule for the task, setting it to run daily. Further frequency adjustments can be made in the 'Time' settings. ```bash Run on the following days: Daily ``` -------------------------------- ### Run Scrutiny Docker Container Source: https://github.com/analogj/scrutiny/blob/master/CONTRIBUTING.md Command to run the Scrutiny Docker container with necessary volume mounts, capabilities, and device mappings for development. It also starts the collector metrics process within the container. ```bash docker run -it --rm -p 8080:8080 \ -v /run/udev:/run/udev:ro \ --cap-add SYS_RAWIO \ --device=/dev/sda \ --device=/dev/sdb \ ghcr.io/analogj/scrutiny:master-omnibus /opt/scrutiny/bin/scrutiny-collector-metrics run ``` -------------------------------- ### Download smartd db Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_SYNOLOGY_COLLECTOR.md Downloads the `drivedb.h` file, which contains database information for `smartctl` to interpret drive-specific attributes. This is crucial for accurate SMART data collection. ```bash cd /volume1/\@Entware/scrutiny/bin/ wget https://raw.githubusercontent.com/smartmontools/smartmontools/master/smartmontools/drivedb.h ``` -------------------------------- ### Run smartctl with custom drivedb Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_SYNOLOGY_COLLECTOR.md Executes `smartctl` to gather all information for a specific device, using a custom `drivedb.h` file. This command is useful for testing and ensuring `smartctl` can correctly interpret drive data. ```bash smartctl -d sat --all /dev/sda --drivedb=/volume1/\@Entware/scrutiny/bin/drivedb.h ``` -------------------------------- ### InfluxDB Persistence Error Example Source: https://github.com/analogj/scrutiny/blob/master/docs/TROUBLESHOOTING_INFLUXDB.md This log output indicates an authentication failure, likely due to the InfluxDB data directory not being persisted across container restarts. Ensure your Docker volume configuration is correct. ```log scrutiny | time="2022-05-12T22:54:12Z" level=info msg="Trying to connect to scrutiny sqlite db: /opt/scrutiny/config/scrutiny.db\n" scrutiny | time="2022-05-12T22:54:12Z" level=info msg="Successfully connected to scrutiny sqlite db: /opt/scrutiny/config/scrutiny.db\n" scrutiny | ts=2022-05-12T22:54:12.240791Z lvl=info msg=Unauthorized log_id=0aQcVlOW000 error="authorization not found" scrutiny | panic: unauthorized: unauthorized access ``` -------------------------------- ### Configure SELinux for Scrutiny Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_MANUAL.md Configures SELinux to allow the Scrutiny binaries to execute and updates the file context labels. This is only necessary if SELinux is enforcing. ```sh # tell SELinux to allow these binaries sudo semanage fcontext -a -t bin_t "/opt/scrutiny/bin(/.?)?" # update labels sudo restorecon -Rv /opt/scrutiny/bin ``` -------------------------------- ### Configure Web Server Log Level and File in YAML Source: https://github.com/analogj/scrutiny/blob/master/README.md Configure the log level and log file path for the Scrutiny web server directly within the configuration file. ```yaml log: file: '/tmp/web.log' level: DEBUG ``` -------------------------------- ### InfluxDB Onboarding Conflict Error Example Source: https://github.com/analogj/scrutiny/blob/master/docs/TROUBLESHOOTING_INFLUXDB.md This log indicates that the InfluxDB onboarding process has already been completed, but Scrutiny is attempting to re-run it. This can happen if the InfluxDB API token is not correctly stored or if the database was reset without proper cleanup. ```log scrutiny | time="2022-05-12T22:52:55Z" level=info msg="Successfully connected to scrutiny sqlite db: /opt/scrutiny/config/scrutiny.db\n" scrutiny | ts=2022-05-12T22:52:55.235753Z lvl=error msg="failed to onboard user admin" log_id=0aQcRnc0000 handler=onboard error="onboarding has already been completed" took=0.038ms scrutiny | ts=2022-05-12T22:52:55.235816Z lvl=error msg="api error encountered" log_id=0aQcRnc0000 error="onboarding has already been completed" panic: conflict: onboarding has already been completed ``` -------------------------------- ### Customized Webserver Configuration with Basepath Source: https://github.com/analogj/scrutiny/blob/master/docs/TROUBLESHOOTING_REVERSE_PROXY.md Customizes the Scrutiny web server to serve on a subpath when behind a reverse proxy. Ensure the basepath is prefixed with '/'. ```yaml # customized webserver config web: listen: port: 8080 host: 0.0.0.0 # if you're using a reverse proxy like apache/nginx, you can override this value to serve scrutiny on a subpath. # eg. http://example.com/custombasepath/* vs http://example.com:8080 basepath: '/custombasepath' ``` -------------------------------- ### Run Scrutiny Collector with Smartctl Scan Source: https://github.com/analogj/scrutiny/blob/master/docs/TROUBLESHOOTING_DEVICE_COLLECTOR.md Execute the Scrutiny collector in Docker with the `smartctl --scan` command to confirm it detects the same devices as your local `smartctl` output. Ensure all necessary devices are passed to the container using `--device=` flags. ```bash docker run -it --rm \ -v /run/udev:/run/udev:ro \ --cap-add SYS_RAWIO \ --device=/dev/sda \ --device=/dev/sdb \ ghcr.io/analogj/scrutiny:master-collector smartctl --scan ``` -------------------------------- ### Docker Compose for Scrutiny Hub and InfluxDB Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_HUB_SPOKE.md This docker-compose configuration sets up the Scrutiny Hub (web interface) and an InfluxDB instance for storing SMART data. It includes environment variables for initial setup and connection details. Ensure to replace placeholder values like ${PASSWORD} and SUPER-SECRET-TOKEN. ```yaml networks: monitoring: # A common network for all monitoring services to communicate into notifications: # To Gotify or another Notification service services: influxdb: restart: unless-stopped container_name: influxdb image: influxdb:2.8 ports: - 8086:8086 volumes: - ${DIR_CONFIG}/influxdb2/db:/var/lib/influxdb2 - ${DIR_CONFIG}/influxdb2/config:/etc/influxdb2 environment: - DOCKER_INFLUXDB_INIT_MODE=setup - DOCKER_INFLUXDB_INIT_USERNAME=Admin - DOCKER_INFLUXDB_INIT_PASSWORD=${PASSWORD} - DOCKER_INFLUXDB_INIT_ORG=homelab - DOCKER_INFLUXDB_INIT_BUCKET=scrutiny - DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=SUPER-SECRET-TOKEN - TZ=Europe/Stockholm networks: - monitoring scrutiny: restart: unless-stopped container_name: scrutiny # best practice: pin to a specific release instead of latest image: ghcr.io/analogj/scrutiny:latest-web ports: - 8080:8080 volumes: - ${DIR_CONFIG}/config:/opt/scrutiny/config environment: - SCRUTINY_WEB_INFLUXDB_HOST=influxdb - SCRUTINY_WEB_INFLUXDB_PORT=8086 - SCRUTINY_WEB_INFLUXDB_TOKEN=SUPER-SECRET-TOKEN - SCRUTINY_WEB_INFLUXDB_ORG=homelab - SCRUTINY_WEB_INFLUXDB_BUCKET=scrutiny # Optional but highly recommended to notify you in case of a problem; space-separated list of shoutrrr uri's # https://github.com/AnalogJ/scrutiny/blob/master/docs/TROUBLESHOOTING_NOTIFICATIONS.md - SCRUTINY_NOTIFY_URLS=http://gotify:80/message?token=a-gotify-token ntfy://username:password@host:port/topic - TZ=Europe/Stockholm depends_on: influxdb: condition: service_healthy networks: - notifications - monitoring ``` -------------------------------- ### Verify Downloaded File with SHA256 Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_MANUAL.md Compares the SHA256 checksum of the downloaded file with the one provided in the GitHub release to ensure integrity. Replace SHA_GOES_HERE with the actual checksum. ```sh echo "SHA_GOES_HERE /tmp/scrutiny-collector-metrics" | sha256sum -c ``` ```sh echo "4c163645ce24e5487f4684a25ec73485d77a82a57f084808ff5aad0c11499ad2 /tmp/scrutiny-collector-metrics" | sha256sum -c ``` -------------------------------- ### Add Sub-UIDs and Sub-GIDs for Service Account Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_ROOTLESS_PODMAN.md Configure sub-UID and sub-GID ranges for the service account to manage rootless Podman resources. Adjust the ranges if other rootless Podman accounts are in use. ```bash sudo usermod --add-subuids 500000-565535 scrutiny-svc sudo usermod --add-subgids 500000-565535 scrutiny-svc ``` -------------------------------- ### Synology Task Scheduler - Time Settings Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_SYNOLOGY_COLLECTOR.md Specifies the frequency at which the scheduled task will run. This allows for customization based on monitoring needs. ```bash Frequency: ``` -------------------------------- ### Run Scrutiny with Privileged Mode and Volume Mounts Source: https://github.com/analogj/scrutiny/blob/master/docs/TROUBLESHOOTING_DEVICE_COLLECTOR.md Use this command to run the Scrutiny Docker container with elevated privileges and specific volume mounts, which can help `smartctl` detect disks when other methods fail. This is a workaround and should be used with caution. ```bash docker run -it --rm -p 8080:8080 -p 8086:8086 \ -v `pwd`/scrutiny:/opt/scrutiny/config \ -v `pwd`/influxdb:/opt/scrutiny/influxdb \ -v /run/udev:/run/udev:ro \ --privileged \ -v /dev:/dev \ --name scrutiny \ ghcr.io/analogj/scrutiny:master-omnibus ``` -------------------------------- ### Run Angular Unit Tests Source: https://github.com/analogj/scrutiny/blob/master/webapp/frontend/README.md Execute unit tests using Karma. This command runs the tests defined in your project. ```bash ng test ``` -------------------------------- ### Synology Task Scheduler - General Settings Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_SYNOLOGY_COLLECTOR.md Configuration for a scheduled task in Synology's Task Scheduler. This section defines the task name, user, and enables the task. ```bash Task: Scrutiny_Collector User: root Enabled: yes ``` -------------------------------- ### Download Scrutiny collector binary Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_SYNOLOGY_COLLECTOR.md Downloads the Scrutiny collector binary for ARM64 architecture using wget. Ensure your system architecture matches the downloaded file. ```bash wget https://github.com/AnalogJ/scrutiny/releases/download/v0.4.12/scrutiny-collector-metrics-linux-arm64 ``` -------------------------------- ### Create Scrutiny Collector Directory Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_PFSENSE.md Creates the directory structure required to store the Scrutiny collector binary on the pfSense system. ```bash mkdir -p /opt/scrutiny/bin ``` -------------------------------- ### Configure Sudoers for Smartctl Access Source: https://github.com/analogj/scrutiny/blob/master/docs/INSTALL_MANUAL.md This configuration allows the 'scrutiny-svc' user to execute '/usr/sbin/smartctl' as root without a password. This is a crucial step for the restricted systemd service method. ```sudoers scrutiny-svc ALL=(root) NOPASSWD: /usr/sbin/smartctl * ``` -------------------------------- ### Enable Debug Logging and Log Files for Collector via Environment Variables Source: https://github.com/analogj/scrutiny/blob/master/README.md Use environment variables to enable debug logging and specify a log file path for the Scrutiny collector. ```bash DEBUG=true COLLECTOR_LOG_FILE=/tmp/collector.log ``` -------------------------------- ### Build Scrutiny Docker Image Source: https://github.com/analogj/scrutiny/blob/master/CONTRIBUTING.md Command to build the Scrutiny Docker image using the provided Dockerfile. This command tags the image as `ghcr.io/analogj/scrutiny:master-omnibus`. ```bash docker build -f docker/Dockerfile . -t ghcr.io/analogj/scrutiny:master-omnibus ```