Sign inSign up

stefanhaechler/netwatch-web

By stefanhaechler

•Updated 2 days ago

Network SNMP monitoring solution like a simpler zabbix or free paessler - Map, Dashboard, Alerts...

Image
Networking
0

2.6K

stefanhaechler/netwatch-web repository overview

Network SNMP Monitor

like a simpler zabbix or paessler just easier and free.

# netWatch demo stack: runs the published images from Docker Hub, no source
# checkout or build needed. Copy this file to the device and run
#
#   docker compose up -d
#   open http://<device>:8080      (login: [email protected] / netwatch-demo)
#
# Everything works out of the box with the demo defaults below. For anything
# beyond a quick look, put a .env next to this file and override at least
# NETWATCH_SECRET_KEY, NETWATCH_ADMIN_PASSWORD and POSTGRES_PASSWORD, e.g.
#
#   NETWATCH_SECRET_KEY=<output of: sh gen-secret-key.sh>
#   NETWATCH_ADMIN_PASSWORD=<min. 8 chars>
#   POSTGRES_PASSWORD=<anything>
#   NETWATCH_HTTP_PORT=8080
#   NETWATCH_TRAP_HOST_PORT=162
#   NETWATCH_TAG=latest              # or a version such as 0.1.0
#   NETWATCH_DB_DATA=/mnt/nvme/netwatch/db   # database on a host path (mkdir it first)
#
# The secret key encrypts SNMP community strings in the database: pick your
# own before adding real devices, and keep it with the database backup.
# Images are multi-platform (linux/amd64, linux/arm64), so this also runs on
# a Raspberry Pi or another ARM box. Update with: docker compose pull && docker compose up -d

x-netwatch-env: &netwatch-env
  NETWATCH_DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-netwatch}:${POSTGRES_PASSWORD:-netwatch}@db:5432/${POSTGRES_DB:-netwatch}
  # DEMO ONLY: replace before storing real SNMP credentials.
  NETWATCH_SECRET_KEY: ${NETWATCH_SECRET_KEY:-1SDxxeFIYT8lMI0ZsSdETNLHW_yAuz-2CNEJSfNK9C4=}
  NETWATCH_ADMIN_EMAIL: ${NETWATCH_ADMIN_EMAIL:[email protected]}
  NETWATCH_ADMIN_PASSWORD: ${NETWATCH_ADMIN_PASSWORD:-netwatch-demo}
  NETWATCH_LOG_LEVEL: ${NETWATCH_LOG_LEVEL:-INFO}
  NETWATCH_COOKIE_SECURE: ${NETWATCH_COOKIE_SECURE:-false}
  NETWATCH_CSRF_PROTECTION: ${NETWATCH_CSRF_PROTECTION:-true}
  NETWATCH_TRAP_ENABLED: ${NETWATCH_TRAP_ENABLED:-true}
  NETWATCH_TRAP_PORT: 1162

services:
  db:
    image: timescale/timescaledb:latest-pg16
    restart: unless-stopped
    environment:
      POSTGRES_USER: ${POSTGRES_USER:-netwatch}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-netwatch}
      POSTGRES_DB: ${POSTGRES_DB:-netwatch}
    volumes:
      # Database files. Default: a Docker-managed named volume. Set
      # NETWATCH_DB_DATA to an absolute host path to keep them elsewhere,
      # e.g. on an NVMe drive instead of the SD card of a Raspberry Pi.
      - ${NETWATCH_DB_DATA:-db-data}:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-netwatch} -d ${POSTGRES_DB:-netwatch}"]
      interval: 5s
      timeout: 3s
      retries: 20

  api:
    image: ${NETWATCH_IMAGE_PREFIX:-stefanhaechler/netwatch}-api:${NETWATCH_TAG:-latest}
    restart: unless-stopped
    # Runs the database migrations, then serves the API behind the web container.
    command: sh -c "alembic upgrade head && uvicorn netwatch.main:app --host 0.0.0.0 --port 8000 --proxy-headers --forwarded-allow-ips='*'"
    env_file:
      - path: .env
        required: false
    environment:
      <<: *netwatch-env
    depends_on:
      db:
        condition: service_healthy

  poller:
    image: ${NETWATCH_IMAGE_PREFIX:-stefanhaechler/netwatch}-api:${NETWATCH_TAG:-latest}
    restart: unless-stopped
    command: python -m netwatch.poller.main
    env_file:
      - path: .env
        required: false
    environment:
      <<: *netwatch-env
    ports:
      # SNMP trap listener. Point your switches' trap receiver at this host.
      - "${NETWATCH_TRAP_HOST_PORT:-162}:1162/udp"
    cap_add:
      - NET_RAW   # ICMP ping
    depends_on:
      db:
        condition: service_healthy
      api:
        condition: service_started

  web:
    image: ${NETWATCH_IMAGE_PREFIX:-stefanhaechler/netwatch}-web:${NETWATCH_TAG:-latest}
    restart: unless-stopped
    ports:
      - "${NETWATCH_HTTP_PORT:-8080}:80"
    depends_on:
      - api

volumes:
  db-data:

Tag summary

Content type

Image

Digest

sha256:6501e843e…

Size

21.1 MB

Last updated

2 days ago

docker pull stefanhaechler/netwatch-web