URI: 
       Use Gotify with NUT Server
       
       Published on : 2025-07-08 13:43
       
       We setup Nut Server and Gotify in our home lab:
       
   DIR Installing and configuring NUT (Network UPS Tools) for your home lab
       
   DIR Gotify - Get notifications about everything on your phone
       
       
       It's time to mix them together and get notified by Gotify whenever 
       something happens with the UPS. This tutorial applies if you 
       followed the tutorials linked above. If you have another NUT setup 
       make sure to adapt to it.
       
       Sending Gotify notifications from NUT server is a very simple 
       process. All you have to do is to edit /bin/upssched-cmd.
       
       Let's create the function to send notifications via Gotify. 
       Add to /bin/upssched-cmd:
       
          CURL="/usr/bin/curl \
          --retry 3 \
          --retry-delay 5 \
          --retry-max-time 20"
          GOTIFY_URL="https://your.gotify.url/message?token=<apptoken>"
          HOSTNAME="$(hostname)"
          send_gotify() {
             if [ -n "$title" ] && [ -n "$message" ]; then
                $CURL -fsS \
                -F "title=$title" \
                -F "message=$message" \
                "$GOTIFY_URL"
             fi
       
       At the bottom of the file make sure to call the function.
       
          send_gotify
       
        - What this does
       If the title and message parameters are present the function will e
       
          onbatt)
             logger -t upssched-cmd "UPS running on battery."
             title="$HOSTNAME - UPS on Battery"
             message="UPS is now running on battery."
          ;;
       
       
       /bin/upssched-cmd will trigger the gotify notification if the UPS i
       You can also find the full config for NUT server and client on my 
       GitHub repository:
       
  HTML Nut Config on GitHub/SavaAlexandruStefan
       
   DIR  Back to my phlog