Brandawg93 / PeaNUT

A tiny dashboard for Network UPS Tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request]: Run script/s on event type

AliMickey opened this issue · comments

Enhancement of issue

Be able to run a script based on UPS status change.

Solution

  • Mount the script via volume
  • Specify in environment which status changes should trigger the script (ONLINE, ONBATT, LOWBATT).
  • When the status change is detected, the script is executed and the status passed in as an argument.

This is similar to how nut-upsd handles it with upsmon, but it would be nice to have it integrated here instead of needing to interact with nut-upsd.

https://networkupstools.org/docs/man/upsmon.conf.html

Alternatives

No response

Additional Context

Example docker compose:

nut-ui:
    container_name: nut-ui
    image: brandawg93/peanut:latest
    restart: unless-stopped
    networks:
      - syd3.management
    expose:
      - 8080
    environment:
      - NUT_HOST=nut-upsd
      - NUT_PORT=3493
      - WEB_PORT=8080
      - PASSWORD=-----
      - STATUS_EXEC=ONLINE,ONBATT,LOWBATT
     volumes:
       - ./nut/script.sh:/mnt/script.sh
    depends_on:
      - nut-upsd
      
  nut-upsd:
    container_name: nut-upsd
    image: instantlinux/nut-upsd:latest
    restart: unless-stopped
    networks:
      - syd3.management
    expose:
      - 3493
    environment:
      - API_USER=upsmon
      - API_PASSWORD=-----
    devices:
      - /dev/bus/usb