commfailure.j2 467 B

12345678910111213141516171819
  1. #!/bin/sh
  2. # {{ ansible_managed }}
  3. #
  4. # This shell script if placed in /etc/apcupsd
  5. # will be called by /etc/apcupsd/apccontrol when apcupsd
  6. # loses contact with the UPS (i.e. the serial connection is not responding).
  7. # We send an ntfy message to notify
  8. #
  9. message=$(/sbin/apcaccess status)
  10. curl \
  11. -H "Title: [$(hostname)] - Communications with UPS lost" \
  12. -H "Priority: urgent" \
  13. -H "Tags: warning" \
  14. -d "$message" \
  15. {{ ntfy_url }}/{{ ntfy_topic }}
  16. exit 0