AnalogJ / scrutiny

Hard Drive S.M.A.R.T Monitoring, Historical Trends & Real World Failure Thresholds
MIT License
4.98k stars 164 forks source link

[BUG] can't start scrutiny API #378

Closed xsolinsx closed 1 year ago

xsolinsx commented 1 year ago

Describe the bug As I already have an influxdb instance I am using the separate setup, I have edited the docker compose hub/spoke setup to accomodate for my needs. Scrutiny does not load the configuration. No error is given.

Expected behavior Scrutiny does load the configuration and starts correctly (as the collector with the same setup is doing).

Screenshots

Log Files Docker logs:

2022/10/02 09:34:52 Loading configuration file: /opt/scrutiny/config/scrutiny.yaml
2022/10/02 09:34:53 Loading configuration file: /opt/scrutiny/config/scrutiny.yaml
2022/10/02 09:34:54 Loading configuration file: /opt/scrutiny/config/scrutiny.yaml
2022/10/02 09:34:54 Loading configuration file: /opt/scrutiny/config/scrutiny.yaml

docker compose file section of scrutiny

  scrutiny:
    container_name: scrutiny
    image: "ghcr.io/analogj/scrutiny:master-web"
    restart: unless-stopped
    depends_on:
      - influxdb
    volumes:
      - scrutiny_conf:/opt/scrutiny/config:rw
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/api/health"]
      interval: 5s
      timeout: 10s
      retries: 20
      start_period: 10s

No log file is present in the conf volume

docker info output

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.9.1-docker)
  compose: Docker Compose (Docker Inc., v2.10.2)
  scan: Docker Scan (Docker Inc., v0.17.0)

Server:
 Containers: 22
  Running: 21
  Paused: 0
  Stopped: 1
 Images: 23
 Server Version: 20.10.18
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local local-persist
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
 runc version: v1.1.4-0-g5fd4c4d
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.10.0-18-amd64
 Operating System: Debian GNU/Linux 11 (bullseye)
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 22.93GiB
 Name: server
 ID: 26AH:ZM7E:5NXG:R63W:GII2:RH6P:LXTJ:5YML:7KSQ:FGYL:E62P:ZP4J
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Default Address Pools:
   Base: 172.172.0.0/16, Size: 24

scrutiny.yaml


web:
  listen:
    port: 8080
    host: 0.0.0.0
    basepath: ""
  database:
    location: /opt/scrutiny/config/scrutiny.db
  src:
    frontend:
      path: /opt/scrutiny/web
  influxdb:
    scheme: 'http'
    host: influxdb
    port: 8086
      token: 'token'
      org: 'main' #tried with both name and ID
      bucket: 'scrutiny_metrics' #tried with both name and ID
    retention_policy: true
log:
  file: ""
  level: INFO
AnalogJ commented 1 year ago

Hey @xsolinsx have you looked at the Bring your own InfluxDB section of the troubleshooting guide?

https://github.com/AnalogJ/scrutiny/blob/master/docs/TROUBLESHOOTING_INFLUXDB.md#bring-your-own-influxdb

that should provide you with all the buckets & tasks necessary to get Scrutiny working

xsolinsx commented 1 year ago

Yes, I have followed the instructions and created the appropriate tasks/buckets with the curl commands

AnalogJ commented 1 year ago

can you add the DEBUG=true environmental variable to the scrutiny container?

xsolinsx commented 1 year ago

still obtain nothing else but

2022/10/02 16:10:31 Loading configuration file: /opt/scrutiny/config/scrutiny.yaml 2022/10/02 16:10:37 Loading configuration file: /opt/scrutiny/config/scrutiny.yaml 2022/10/02 16:10:51 Loading configuration file: /opt/scrutiny/config/scrutiny.yaml

martadinata666 commented 1 year ago

My influxdb part on scrutiny.yaml, and you can try to manually start collector to check will the API connect influxdb correctly

  influxdb:
    host: db
    port: 8086
    token: 'scrutinytoken'
    org: 'scrutinyorg'
    bucket: 'scrutiny'
xsolinsx commented 1 year ago

Oh god I feel so stupid, I just reviewed my scrutiny.yaml file and there is an additional indentation level for the token, org and bucket fields I'm sorry I didn't notice, now it's working 🤦🏻‍♂️

AnalogJ commented 1 year ago

weird, I wouldn't have expected a silent failure like that though. I'm glad you figured this out, but I'll try to add some extra logging in the future.