/docker-qnap-pushover

Pushover notifications for QNAP NAS system events 🔔

Primary LanguagePythonMIT LicenseMIT

Update (February 2, 2022)

Hi folks—I am not running QTS on my QNAP NAS anymore, and thus unfortunately am no longer able to test/maintain this project.

I am archiving this repository, but please feel free to fork and continue improving on it!

qnap-pushover 🔔

Image Size Last Commit Build Status
Python Code Quality Become a GitHub Sponsor

Pushover notifications for QNAP NAS system events

Usage

Docker images are available from both GitHub Container Registry (GHCR) and Docker Hub.

If you would prefer to pull from GHCR, simply replace thecatlady/qnap-pushover with ghcr.io/thecatlady/qnap-pushover in the examples below.

Docker Compose (recommended)

Add the following volume and service definitions to a docker-compose.yml file:

volumes:
  qnap-pushover:
services:
  qnap-pushover:
    image: thecatlady/qnap-pushover
    container_name: qnap-pushover
    environment:
      - TZ=America/New_York #optional
      - LOG_LEVEL=WARN #optional
      - NOTIFY_LEVEL=WARN #optional
      - NOTIFY_ONLY= #optional
      - POLL_INTERVAL=10 #optional
      - INCLUDE= #optional
      - EXCLUDE= #optional
      - TESTING_MODE=false #optional
      - PUSHOVER_TOKEN=<Pushover application API token>
      - PUSHOVER_RECIPIENT=<Pushover user and/or group key(s)>
    volumes:
      - qnap-pushover:/data
      - /etc/logs/event.log:/event.log:ro
    restart: always

Then, run the following command from the directory containing your docker-compose.yml file:

docker-compose up -d

Docker CLI

Run the following command to create the required named volume:

docker volume create qnap-pushover

Then, run the following command to create the container:

docker run -d \
  --name=qnap-pushover \
  -e TZ=America/New_York `#optional` \
  -e LOG_LEVEL=WARN `#optional` \
  -e NOTIFY_LEVEL=WARN `#optional` \
  -e NOTIFY_ONLY= `#optional` \
  -e POLL_INTERVAL=10 `#optional` \
  -e INCLUDE= `#optional` \
  -e EXCLUDE= `#optional` \
  -e TESTING_MODE=false `#optional` \
  -e PUSHOVER_TOKEN=<Pushover application API token> \
  -e PUSHOVER_RECIPIENT=<Pushover user and/or group key(s)> \
  -v qnap-pushover:/data \
  -v /etc/logs/event.log:/event.log:ro \
  --restart always \
  thecatlady/qnap-pushover

Updating

The process to update the container when a new image is available is dependent on how you set it up initially.

Docker Compose

Run the following commands from the directory containing your docker-compose.yml file:

docker-compose pull qnap-pushover
docker-compose up -d
docker image prune

Docker CLI

Run the commands below, followed by your original docker run command:

docker stop qnap-pushover
docker rm qnap-pushover
docker pull thecatlady/qnap-pushover
docker image prune

Parameters

The container image is configured using the following parameters passed at runtime:

Parameter Function Default Value Required?
-e TZ= TZ database name of system time zone; e.g., America/New_York Etc/UTC no
-e LOG_LEVEL= Container logging level; DEBUG < INFO < WARNING < ERROR < CRITICAL WARNING no
-e NOTIFY_LEVEL= Minimum system event type to generate a notification; INFO < WARNING < ERROR WARNING no
-e NOTIFY_ONLY= Set of system event types for which to generate a notification (comma-delimited), e.g. INFO,ERROR
(Value is ignored if NOTIFY_LEVEL is also set)
no
-e POLL_INTERVAL= Poll interval in seconds 10 no
-e INCLUDE= List of keywords which must be present in the event description to trigger a notification (comma-delimited) no
-e EXCLUDE= List of keywords which must not be present in the event description to trigger a notification (comma-delimited) no
-e TESTING_MODE= Testing mode (true or false); if set to true, will re-queue the last 10 system log events at every container start and result in duplicate notifications false no
-e PUSHOVER_TOKEN= Pushover application API token; e.g., azGDORePK8gMaC0QOYAMyEEuzJnyUi yes
-e PUSHOVER_RECIPIENT= Pushover user and/or group key(s); e.g., uQiRzpo4DXghDmr9QzzfQu27cmVRsG or gznej3rKEVAvPUxu9vvNnqpmZpokzF (up to 50, comma-delimited) yes
-v qnap-pushover:/data Container data volume yes
-v /etc/logs/event.log:/event.log:ro QNAP event logs (mounted as read-only) yes
--restart Container restart policy (always or unless-stopped recommended) no no

Building Locally

If you would like to make modifications to the code, you can build the Docker image yourself instead of pulling the pre-built image available from GitHub Container Registry (GHCR) and Docker Hub.

git clone https://github.com/TheCatLady/docker-qnap-pushover.git
cd docker-qnap-pushover
docker build --no-cache --pull -t thecatlady/qnap-pushover .

Once the image has been built, follow the directions in the "Usage" section above to start the container.

How to Contribute

Show your support by starring this project! 🌟 Pull requests, bug reports, and feature requests are also welcome!

You can also support me by becoming a GitHub sponsor or making a one-time donation 💖