mirror of
https://github.com/mag37/dockcheck.git
synced 2026-04-18 10:27:54 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
68c057e62d | ||
|
|
57650f1673 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,5 +1,5 @@
|
|||||||
# ignore users custom notify.sh
|
# ignore users custom notify.sh
|
||||||
/notify.sh
|
/notify*.sh
|
||||||
/urls.list
|
/urls.list
|
||||||
# ignore user config
|
# ignore user config
|
||||||
/dockcheck.config
|
/dockcheck.config
|
||||||
|
|||||||
35
README.md
35
README.md
@@ -20,6 +20,13 @@
|
|||||||
___
|
___
|
||||||
## :bell: Changelog
|
## :bell: Changelog
|
||||||
|
|
||||||
|
- **v0.6.6**: Notify_v2 bugfixes
|
||||||
|
- Clearer readme and error messages
|
||||||
|
- Sourcing templates from either project root or subdirectory
|
||||||
|
- Consistent newline handling
|
||||||
|
- Added (when using `-d`) days old message to notification title
|
||||||
|
- Added ntfy.sh self hosted domain option to config
|
||||||
|
- jq fixes to templates (and properly using $jqbin)
|
||||||
- **v0.6.5**: Refactored notification logic. See notify_templates/notify_v2.sh for upgrade steps.
|
- **v0.6.5**: Refactored notification logic. See notify_templates/notify_v2.sh for upgrade steps.
|
||||||
- Added helper functions to simplify sourcing files and executing functions if they exist.
|
- Added helper functions to simplify sourcing files and executing functions if they exist.
|
||||||
- Created notify_v2.sh wrapper script.
|
- Created notify_v2.sh wrapper script.
|
||||||
@@ -37,10 +44,6 @@ ___
|
|||||||
- `-M`, Markdown format url-releasenotes in notification (requires template rework, look at gotify!)
|
- `-M`, Markdown format url-releasenotes in notification (requires template rework, look at gotify!)
|
||||||
- Added [addons/DSM/README.md](./addons/DSM/README.md) for more info Synology DSM info.
|
- Added [addons/DSM/README.md](./addons/DSM/README.md) for more info Synology DSM info.
|
||||||
- Permission checks - graceful exit if no docker permissions + checking if root for pkg-manager.
|
- Permission checks - graceful exit if no docker permissions + checking if root for pkg-manager.
|
||||||
- **v0.6.2**: Style and colour changes, prometheus hotfix, new options:
|
|
||||||
- `-u`, Allow auto self update of dockcheck.sh
|
|
||||||
- `-I`, Print container release URLs in the CLI "choose update" list. (please contribute to `urls.list`)
|
|
||||||
- Extras: `-m`, Monochrome mode now hides the progress bar.
|
|
||||||
___
|
___
|
||||||
|
|
||||||
|
|
||||||
@@ -136,9 +139,31 @@ Run it scheduled with `-ni` to only get notified when there's updates available!
|
|||||||
|
|
||||||
V2 installation and configuration (tag v0.6.5 or later):
|
V2 installation and configuration (tag v0.6.5 or later):
|
||||||
Remove or rename `notify.sh` if previously configured using the legacy method.
|
Remove or rename `notify.sh` if previously configured using the legacy method.
|
||||||
|
Make certain your project directory is laid out as below. You only need the notify_v2.sh file and any notification templates you wish to enable, but there is no harm in having all of them present.
|
||||||
|
```
|
||||||
|
.
|
||||||
|
├── notify_templates/
|
||||||
|
│ ├── notify_DSM.sh
|
||||||
|
│ ├── notify_apprise.sh
|
||||||
|
│ ├── notify_discord.sh
|
||||||
|
│ ├── notify_generic.sh
|
||||||
|
│ ├── notify_gotify.sh
|
||||||
|
│ ├── notify_matrix.sh
|
||||||
|
│ ├── notify_ntfy-sh.sh
|
||||||
|
│ ├── notify_pushbullet.sh
|
||||||
|
│ ├── notify_pushover.sh
|
||||||
|
│ ├── notify_slack.sh
|
||||||
|
│ ├── notify_smtp.sh
|
||||||
|
│ ├── notify_telegram.sh
|
||||||
|
│ └── notify_v2.sh
|
||||||
|
├── dockcheck.config
|
||||||
|
├── dockcheck.sh
|
||||||
|
└── urls.list # optional
|
||||||
|
```
|
||||||
|
If you wish to customize `notify_v2.sh` or the notify templates yourself, you may copy them to your project root directory alongside the main dockcheck.sh script (where they will also be ignored by git).
|
||||||
Uncomment and set the NOTIFY_CHANNELS environment variable in `dockcheck.config` to a space separated string of your desired notification channels to enable.
|
Uncomment and set the NOTIFY_CHANNELS environment variable in `dockcheck.config` to a space separated string of your desired notification channels to enable.
|
||||||
Uncomment and set the environment variables related to the enabled notification channels.
|
Uncomment and set the environment variables related to the enabled notification channels.
|
||||||
It is recommended not to make changes directly to the `notify_X.sh` template files and to use only environment variables defined in `dockcheck.config` using this method.
|
It is recommended not to make changes directly to the `notify_X.sh` template files within the `notify_templates` subdirectory and instead use only environment variables defined in `dockcheck.config` using this method.
|
||||||
|
|
||||||
Legacy installation and configuration:
|
Legacy installation and configuration:
|
||||||
Use a previous version of a `notify_X.sh` template file (tag v0.6.4 or earlier) from the **notify_templates** directory,
|
Use a previous version of a `notify_X.sh` template file (tag v0.6.4 or earlier) from the **notify_templates** directory,
|
||||||
|
|||||||
@@ -54,6 +54,8 @@
|
|||||||
# MATRIX_ROOM_ID="myroom"
|
# MATRIX_ROOM_ID="myroom"
|
||||||
# MATRIX_SERVER_URL="https://matrix.yourdomain.tld"
|
# MATRIX_SERVER_URL="https://matrix.yourdomain.tld"
|
||||||
#
|
#
|
||||||
|
## ntfy.sh or your custom domain with no trailing /
|
||||||
|
# NTFY_DOMAIN="ntfy.sh"
|
||||||
# NTFY_TOPIC_NAME="YourUniqueTopicName"
|
# NTFY_TOPIC_NAME="YourUniqueTopicName"
|
||||||
#
|
#
|
||||||
# PUSHBULLET_URL="https://api.pushbullet.com/v2/pushes"
|
# PUSHBULLET_URL="https://api.pushbullet.com/v2/pushes"
|
||||||
|
|||||||
10
dockcheck.sh
10
dockcheck.sh
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
VERSION="v0.6.5"
|
VERSION="v0.6.6"
|
||||||
# ChangeNotes: Refactored notification logic. See README.md for upgrade steps.
|
# ChangeNotes: notify_v2 bugfixes - clarify readme and error messages, better sourcing templates, tweaks.
|
||||||
Github="https://github.com/mag37/dockcheck"
|
Github="https://github.com/mag37/dockcheck"
|
||||||
RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh"
|
RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh"
|
||||||
|
|
||||||
@@ -332,6 +332,9 @@ dependency_check() {
|
|||||||
${!AppVar} "$VerFlag" &> /dev/null || { printf "%s\n" "$AppName is not working - try to remove it and re-download it, exiting."; exit 1; }
|
${!AppVar} "$VerFlag" &> /dev/null || { printf "%s\n" "$AppName is not working - try to remove it and re-download it, exiting."; exit 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dependency_check "regctl" "regbin" "https://github.com/regclient/regclient/releases/latest/download/regctl-linux-TEMP"
|
||||||
|
dependency_check "jq" "jqbin" "https://github.com/jqlang/jq/releases/latest/download/jq-linux-TEMP"
|
||||||
|
|
||||||
# Numbered List function
|
# Numbered List function
|
||||||
# if urls.list exists add release note url per line
|
# if urls.list exists add release note url per line
|
||||||
list_options() {
|
list_options() {
|
||||||
@@ -357,9 +360,6 @@ fi
|
|||||||
# Version check for notify templates
|
# Version check for notify templates
|
||||||
[[ "$Notify" == true ]] && [[ ! -s "${ScriptWorkDir}/notify.sh" ]] && { exec_if_exists_or_fail notify_update_notification || printf "Could not source notify notification function.\n"; }
|
[[ "$Notify" == true ]] && [[ ! -s "${ScriptWorkDir}/notify.sh" ]] && { exec_if_exists_or_fail notify_update_notification || printf "Could not source notify notification function.\n"; }
|
||||||
|
|
||||||
dependency_check "regctl" "regbin" "https://github.com/regclient/regclient/releases/latest/download/regctl-linux-TEMP"
|
|
||||||
dependency_check "jq" "jqbin" "https://github.com/jqlang/jq/releases/latest/download/jq-linux-TEMP"
|
|
||||||
|
|
||||||
# Check docker compose binary
|
# Check docker compose binary
|
||||||
docker info &>/dev/null || { printf "\n%bYour current user does not have permissions to the docker socket - may require root / docker group. Exiting.%b\n" "$c_red" "$c_reset"; exit 1; }
|
docker info &>/dev/null || { printf "\n%bYour current user does not have permissions to the docker socket - may require root / docker group. Exiting.%b\n" "$c_red" "$c_reset"; exit 1; }
|
||||||
if docker compose version &>/dev/null; then DockerBin="docker compose" ;
|
if docker compose version &>/dev/null; then DockerBin="docker compose" ;
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ NOTIFY_DSM_VERSION="v0.2"
|
|||||||
#
|
#
|
||||||
# mSMTP/sSMTP has to be installed and configured manually.
|
# mSMTP/sSMTP has to be installed and configured manually.
|
||||||
# The existing DSM Notification Email configuration will be used automatically.
|
# The existing DSM Notification Email configuration will be used automatically.
|
||||||
# Do not modify this file directly. Set DSM_SENDMAILTO and DSM_SUBJECTTAG in your dockcheck.config file.
|
# Leave (or place) this file in the "notify_templates" subdirectory within the same directory as the main dockcheck.sh script.
|
||||||
|
# If you instead wish make your own modifications, make a copy in the same directory as the main dockcheck.sh script.
|
||||||
|
# Do not modify this file directly within the "notify_templates" subdirectory. Set DSM_SENDMAILTO and DSM_SUBJECTTAG in your dockcheck.config file.
|
||||||
|
|
||||||
MSMTP=$(which msmtp)
|
MSMTP=$(which msmtp)
|
||||||
SSMTP=$(which ssmtp)
|
SSMTP=$(which ssmtp)
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
NOTIFY_APPRISE_VERSION="v0.2"
|
NOTIFY_APPRISE_VERSION="v0.2"
|
||||||
#
|
#
|
||||||
# Required receiving services must already be set up.
|
# Required receiving services must already be set up.
|
||||||
# Do not modify this file directly. Set APPRISE_PAYLOAD in your dockcheck.config file.
|
# Leave (or place) this file in the "notify_templates" subdirectory within the same directory as the main dockcheck.sh script.
|
||||||
|
# If you instead wish make your own modifications, make a copy in the same directory as the main dockcheck.sh script.
|
||||||
|
# Do not modify this file directly within the "notify_templates" subdirectory. Set APPRISE_PAYLOAD in your dockcheck.config file.
|
||||||
# If API, set APPRISE_URL instead.
|
# If API, set APPRISE_URL instead.
|
||||||
|
|
||||||
if [[ -z "${APPRISE_PAYLOAD:-}" ]] && [[ -z "${APPRISE_URL:-}" ]]; then
|
if [[ -z "${APPRISE_PAYLOAD:-}" ]] && [[ -z "${APPRISE_URL:-}" ]]; then
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||||
NOTIFY_DISCORD_VERSION="v0.2"
|
NOTIFY_DISCORD_VERSION="v0.3"
|
||||||
#
|
#
|
||||||
# Required receiving services must already be set up.
|
# Required receiving services must already be set up.
|
||||||
# Do not modify this file directly. Set DISCORD_WEBHOOK_URL in your dockcheck.config file.
|
# Leave (or place) this file in the "notify_templates" subdirectory within the same directory as the main dockcheck.sh script.
|
||||||
|
# If you instead wish make your own modifications, make a copy in the same directory as the main dockcheck.sh script.
|
||||||
|
# Do not modify this file directly within the "notify_templates" subdirectory. Set DISCORD_WEBHOOK_URL in your dockcheck.config file.
|
||||||
|
|
||||||
if [[ -z "${DISCORD_WEBHOOK_URL:-}" ]]; then
|
if [[ -z "${DISCORD_WEBHOOK_URL:-}" ]]; then
|
||||||
printf "Discord notification channel enabled, but required configuration variables are missing. Discord notifications will not be sent.\n"
|
printf "Discord notification channel enabled, but required configuration variables are missing. Discord notifications will not be sent.\n"
|
||||||
@@ -13,6 +15,10 @@ fi
|
|||||||
trigger_discord_notification() {
|
trigger_discord_notification() {
|
||||||
DiscordWebhookUrl="${DISCORD_WEBHOOK_URL}" # e.g. DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/<token string>
|
DiscordWebhookUrl="${DISCORD_WEBHOOK_URL}" # e.g. DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/<token string>
|
||||||
|
|
||||||
MsgBody="{\"username\":\"$FromHost\",\"content\":\"$MessageBody\"}"
|
JsonData=$( "$jqbin" -n \
|
||||||
curl -sS -o /dev/null --fail -X POST -H "Content-Type: application/json" -d "$MsgBody" "$DiscordWebhookUrl"
|
--arg username "$FromHost" \
|
||||||
|
--arg body "$MessageBody" \
|
||||||
|
'{"username": $username, "content": $body}' )
|
||||||
|
|
||||||
|
curl -sS -o /dev/null --fail -X POST -H "Content-Type: application/json" -d "$JsonData" "$DiscordWebhookUrl"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
NOTIFY_GOTIFY_VERSION="v0.3"
|
NOTIFY_GOTIFY_VERSION="v0.3"
|
||||||
#
|
#
|
||||||
# Required receiving services must already be set up.
|
# Required receiving services must already be set up.
|
||||||
# Do not modify this file directly. Set GOTIFY_TOKEN and GOTIFY_DOMAIN in your dockcheck.config file.
|
# Leave (or place) this file in the "notify_templates" subdirectory within the same directory as the main dockcheck.sh script.
|
||||||
|
# If you instead wish make your own modifications, make a copy in the same directory as the main dockcheck.sh script.
|
||||||
|
# Do not modify this file directly within the "notify_templates" subdirectory. Set GOTIFY_TOKEN and GOTIFY_DOMAIN in your dockcheck.config file.
|
||||||
|
|
||||||
if [[ -z "${GOTIFY_TOKEN:-}" ]] || [[ -z "${GOTIFY_DOMAIN:-}" ]]; then
|
if [[ -z "${GOTIFY_TOKEN:-}" ]] || [[ -z "${GOTIFY_DOMAIN:-}" ]]; then
|
||||||
printf "Gotify notification channel enabled, but required configuration variables are missing. Gotify notifications will not be sent.\n"
|
printf "Gotify notification channel enabled, but required configuration variables are missing. Gotify notifications will not be sent.\n"
|
||||||
@@ -20,7 +22,7 @@ trigger_gotify_notification() {
|
|||||||
ContentType="text/plain"
|
ContentType="text/plain"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
JsonData=$( jq -n \
|
JsonData=$( "$jqbin" -n \
|
||||||
--arg body "$MessageBody" \
|
--arg body "$MessageBody" \
|
||||||
--arg title "$MessageTitle" \
|
--arg title "$MessageTitle" \
|
||||||
--arg type "$ContentType" \
|
--arg type "$ContentType" \
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
NOTIFY_MATRIX_VERSION="v0.2"
|
NOTIFY_MATRIX_VERSION="v0.2"
|
||||||
#
|
#
|
||||||
# Required receiving services must already be set up.
|
# Required receiving services must already be set up.
|
||||||
# Do not modify this file directly. Set MATRIX_ACCESS_TOKEN, MATRIX_ROOM_ID, and MATRIX_SERVER_URL in your dockcheck.config file.
|
# Leave (or place) this file in the "notify_templates" subdirectory within the same directory as the main dockcheck.sh script.
|
||||||
|
# If you instead wish make your own modifications, make a copy in the same directory as the main dockcheck.sh script.
|
||||||
|
# Do not modify this file directly within the "notify_templates" subdirectory. Set MATRIX_ACCESS_TOKEN, MATRIX_ROOM_ID, and MATRIX_SERVER_URL in your dockcheck.config file.
|
||||||
|
|
||||||
if [[ -z "${MATRIX_ACCESS_TOKEN:-}" ]] || [[ -z "${MATRIX_ROOM_ID}:-" ]] || [[ -z "${MATRIX_SERVER_URL}:-" ]]; then
|
if [[ -z "${MATRIX_ACCESS_TOKEN:-}" ]] || [[ -z "${MATRIX_ROOM_ID}:-" ]] || [[ -z "${MATRIX_SERVER_URL}:-" ]]; then
|
||||||
printf "Matrix notification channel enabled, but required configuration variables are missing. Matrix notifications will not be sent.\n"
|
printf "Matrix notification channel enabled, but required configuration variables are missing. Matrix notifications will not be sent.\n"
|
||||||
|
|||||||
@@ -1,17 +1,22 @@
|
|||||||
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||||
NOTIFY_NTFYSH_VERSION="v0.3"
|
NOTIFY_NTFYSH_VERSION="v0.4"
|
||||||
#
|
#
|
||||||
# Setup app and subscription at https://ntfy.sh
|
# Setup app and subscription at https://ntfy.sh
|
||||||
# Do not modify this file directly. Set NTFY_TOPIC_NAME in your dockcheck.config file.
|
# Leave (or place) this file in the "notify_templates" subdirectory within the same directory as the main dockcheck.sh script.
|
||||||
|
# If you instead wish make your own modifications, make a copy in the same directory as the main dockcheck.sh script.
|
||||||
|
# Do not modify this file directly within the "notify_templates" subdirectory. Set NTFY_DOMAIN and NTFY_TOPIC_NAME in your dockcheck.config file.
|
||||||
|
|
||||||
if [[ -z "${NTFY_TOPIC_NAME:-}" ]]; then
|
if [[ -z "${NTFY_DOMAIN:-}" ]] || [[ -z "${NTFY_TOPIC_NAME:-}" ]]; then
|
||||||
printf "Ntfy.sh notification channel enabled, but required configuration variables are missing. Ntfy.sh notifications will not be sent.\n"
|
printf "Ntfy.sh notification channel enabled, but required configuration variables are missing. Ntfy.sh notifications will not be sent.\n"
|
||||||
|
|
||||||
remove_channel ntfy-sh
|
remove_channel ntfy-sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
trigger_ntfy-sh_notification() {
|
trigger_ntfy-sh_notification() {
|
||||||
NtfyUrl="ntfy.sh/${NTFY_TOPIC_NAME}" # e.g. NTFY_TOPIC_NAME=YourUniqueTopicName
|
NtfyUrl="${NTFY_DOMAIN}/${NTFY_TOPIC_NAME}"
|
||||||
|
# e.g.
|
||||||
|
# NTFY_DOMAIN=ntfy.sh
|
||||||
|
# NTFY_TOPIC_NAME=YourUniqueTopicName
|
||||||
|
|
||||||
if [[ "$PrintMarkdownURL" == true ]]; then
|
if [[ "$PrintMarkdownURL" == true ]]; then
|
||||||
ContentType="Markdown: yes"
|
ContentType="Markdown: yes"
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ NOTIFY_PUSHBULLET_VERSION="v0.2"
|
|||||||
#
|
#
|
||||||
# Required receiving services must already be set up.
|
# Required receiving services must already be set up.
|
||||||
# Requires jq installed and in PATH.
|
# Requires jq installed and in PATH.
|
||||||
# Do not modify this file directly. Set PUSHBULLET_TOKEN and PUSHBULLET_URL in your dockcheck.config file.
|
# Leave (or place) this file in the "notify_templates" subdirectory within the same directory as the main dockcheck.sh script.
|
||||||
|
# If you instead wish make your own modifications, make a copy in the same directory as the main dockcheck.sh script.
|
||||||
|
# Do not modify this file directly within the "notify_templates" subdirectory. Set PUSHBULLET_TOKEN and PUSHBULLET_URL in your dockcheck.config file.
|
||||||
|
|
||||||
if [[ -z "${PUSHBULLET_URL:-}" ]] || [[ -z "${PUSHBULLET_TOKEN:-}" ]]; then
|
if [[ -z "${PUSHBULLET_URL:-}" ]] || [[ -z "${PUSHBULLET_TOKEN:-}" ]]; then
|
||||||
printf "Pushbullet notification channel enabled, but required configuration variables are missing. Pushbullet notifications will not be sent.\n"
|
printf "Pushbullet notification channel enabled, but required configuration variables are missing. Pushbullet notifications will not be sent.\n"
|
||||||
@@ -16,5 +18,5 @@ trigger_pushbullet_notification() {
|
|||||||
PushToken="${PUSHBULLET_TOKEN}" # e.g. PUSHBULLET_TOKEN=token-value
|
PushToken="${PUSHBULLET_TOKEN}" # e.g. PUSHBULLET_TOKEN=token-value
|
||||||
|
|
||||||
# Requires jq to process json data
|
# Requires jq to process json data
|
||||||
jq -n --arg title "$MessageTitle" --arg body "$MessageBody" '{body: $body, title: $title, type: "note"}' | curl -sS -o /dev/null --show-error --fail -X POST -H "Access-Token: $PushToken" -H "Content-type: application/json" $PushUrl -d @-
|
"$jqbin" -n --arg title "$MessageTitle" --arg body "$MessageBody" '{body: $body, title: $title, type: "note"}' | curl -sS -o /dev/null --show-error --fail -X POST -H "Access-Token: $PushToken" -H "Content-type: application/json" $PushUrl -d @-
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,9 @@ NOTIFY_PUSHOVER_VERSION="v0.2"
|
|||||||
#
|
#
|
||||||
# Required receiving services must already be set up.
|
# Required receiving services must already be set up.
|
||||||
# Requires jq installed and in PATH.
|
# Requires jq installed and in PATH.
|
||||||
# Do not modify this file directly. Set PUSHOVER_USER_KEY, PUSHOVER_TOKEN, and PUSHOVER_URL in your dockcheck.config file.
|
# Leave (or place) this file in the "notify_templates" subdirectory within the same directory as the main dockcheck.sh script.
|
||||||
|
# If you instead wish make your own modifications, make a copy in the same directory as the main dockcheck.sh script.
|
||||||
|
# Do not modify this file directly within the "notify_templates" subdirectory. Set PUSHOVER_USER_KEY, PUSHOVER_TOKEN, and PUSHOVER_URL in your dockcheck.config file.
|
||||||
|
|
||||||
if [[ -z "${PUSHOVER_URL:-}" ]] || [[ -z "${PUSHOVER_USER_KEY:-}" ]] || [[ -z "${PUSHOVER_TOKEN:-}" ]]; then
|
if [[ -z "${PUSHOVER_URL:-}" ]] || [[ -z "${PUSHOVER_USER_KEY:-}" ]] || [[ -z "${PUSHOVER_TOKEN:-}" ]]; then
|
||||||
printf "Pushover notification channel enabled, but required configuration variables are missing. Pushover notifications will not be sent.\n"
|
printf "Pushover notification channel enabled, but required configuration variables are missing. Pushover notifications will not be sent.\n"
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
NOTIFY_SLACK_VERSION="v0.2"
|
NOTIFY_SLACK_VERSION="v0.2"
|
||||||
#
|
#
|
||||||
# Setup app and token at https://api.slack.com/tutorials/tracks/posting-messages-with-curl
|
# Setup app and token at https://api.slack.com/tutorials/tracks/posting-messages-with-curl
|
||||||
# Do not modify this file directly. Set SLACK_ACCESS_TOKEN, and SLACK_CHANNEL_ID in your dockcheck.config file.
|
# Leave (or place) this file in the "notify_templates" subdirectory within the same directory as the main dockcheck.sh script.
|
||||||
|
# If you instead wish make your own modifications, make a copy in the same directory as the main dockcheck.sh script.
|
||||||
|
# Do not modify this file directly within the "notify_templates" subdirectory. Set SLACK_ACCESS_TOKEN, and SLACK_CHANNEL_ID in your dockcheck.config file.
|
||||||
|
|
||||||
if [[ -z "${SLACK_ACCESS_TOKEN:-}" ]] || [[ -z "${SLACK_CHANNEL_ID:-}" ]]; then
|
if [[ -z "${SLACK_ACCESS_TOKEN:-}" ]] || [[ -z "${SLACK_CHANNEL_ID:-}" ]]; then
|
||||||
printf "Slack notification channel enabled, but required configuration variables are missing. Slack notifications will not be sent.\n"
|
printf "Slack notification channel enabled, but required configuration variables are missing. Slack notifications will not be sent.\n"
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ NOTIFY_SMTP_VERSION="v0.2"
|
|||||||
# INFO: ssmtp is depcerated - consider to use msmtp instead.
|
# INFO: ssmtp is depcerated - consider to use msmtp instead.
|
||||||
#
|
#
|
||||||
# mSMTP/sSMTP has to be installed and configured manually.
|
# mSMTP/sSMTP has to be installed and configured manually.
|
||||||
# Do not modify this file directly. Set SMTP_MAIL_FROM, SMTP_MAIL_TO, and SMTP_SUBJECT_TAG in your dockcheck.config file.
|
# Leave (or place) this file in the "notify_templates" subdirectory within the same directory as the main dockcheck.sh script.
|
||||||
|
# If you instead wish make your own modifications, make a copy in the same directory as the main dockcheck.sh script.
|
||||||
|
# Do not modify this file directly within the "notify_templates" subdirectory. Set SMTP_MAIL_FROM, SMTP_MAIL_TO, and SMTP_SUBJECT_TAG in your dockcheck.config file.
|
||||||
|
|
||||||
if [[ -z "${SMTP_MAIL_FROM:-}" ]] || [[ -z "${SMTP_MAIL_TO:-}" ]] || [[ -z "${SMTP_SUBJECT_TAG:-}" ]]; then
|
if [[ -z "${SMTP_MAIL_FROM:-}" ]] || [[ -z "${SMTP_MAIL_TO:-}" ]] || [[ -z "${SMTP_SUBJECT_TAG:-}" ]]; then
|
||||||
printf "SMTP notification channel enabled, but required configuration variables are missing. SMTP notifications will not be sent.\n"
|
printf "SMTP notification channel enabled, but required configuration variables are missing. SMTP notifications will not be sent.\n"
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||||
NOTIFY_TELEGRAM_VERSION="v0.2"
|
NOTIFY_TELEGRAM_VERSION="v0.3"
|
||||||
#
|
#
|
||||||
# Required receiving services must already be set up.
|
# Required receiving services must already be set up.
|
||||||
# Do not modify this file directly. Set TELEGRAM_CHAT_ID and TELEGRAM_TOKEN in your dockcheck.config file.
|
# Leave (or place) this file in the "notify_templates" subdirectory within the same directory as the main dockcheck.sh script.
|
||||||
|
# If you instead wish make your own modifications, make a copy in the same directory as the main dockcheck.sh script.
|
||||||
|
# Do not modify this file directly within the "notify_templates" subdirectory. Set TELEGRAM_CHAT_ID and TELEGRAM_TOKEN in your dockcheck.config file.
|
||||||
|
|
||||||
if [[ -z "${TELEGRAM_CHAT_ID:-}" ]] || [[ -z "${TELEGRAM_TOKEN:-}" ]]; then
|
if [[ -z "${TELEGRAM_CHAT_ID:-}" ]] || [[ -z "${TELEGRAM_TOKEN:-}" ]]; then
|
||||||
printf "Telegram notification channel enabled, but required configuration variables are missing. Telegram notifications will not be sent.\n"
|
printf "Telegram notification channel enabled, but required configuration variables are missing. Telegram notifications will not be sent.\n"
|
||||||
@@ -21,7 +23,13 @@ trigger_telegram_notification() {
|
|||||||
TelegramChatId="${TELEGRAM_CHAT_ID}" # e.g. TELEGRAM_CHAT_ID=mychatid
|
TelegramChatId="${TELEGRAM_CHAT_ID}" # e.g. TELEGRAM_CHAT_ID=mychatid
|
||||||
TelegramUrl="https://api.telegram.org/bot$TelegramToken"
|
TelegramUrl="https://api.telegram.org/bot$TelegramToken"
|
||||||
TelegramTopicID=${TELEGRAM_TOPIC_ID:="0"}
|
TelegramTopicID=${TELEGRAM_TOPIC_ID:="0"}
|
||||||
TelegramData="{\"chat_id\":\"$TelegramChatId\",\"text\":\"$MessageBody\",\"message_thread_id\":\"$TelegramTopicID\",\"disable_notification\": false}"
|
|
||||||
|
|
||||||
curl -sS -o /dev/null --fail -X POST "$TelegramUrl/sendMessage" -H 'Content-Type: application/json' -d "$TelegramData"
|
JsonData=$( "$jqbin" -n \
|
||||||
|
--arg chatid "$TelegramChatId" \
|
||||||
|
--arg text "$MessageBody" \
|
||||||
|
--arg thread "$TelegramTopicID" \
|
||||||
|
--arg parse_mode "$ParseMode" \
|
||||||
|
'{"chat_id": $chatid, "text": $text, "message_thread_id": $thread, "disable_notification": false, "parse_mode": $parse_mode, "disable_web_page_preview": true}' )
|
||||||
|
|
||||||
|
curl -sS -o /dev/null --fail -X POST "$TelegramUrl/sendMessage" -H 'Content-Type: application/json' -d "$JsonData"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
NOTIFY_V2_VERSION="v0.1"
|
NOTIFY_V2_VERSION="v0.2"
|
||||||
#
|
#
|
||||||
# If migrating from an older notify template, remove your existing notify.sh file.
|
# If migrating from an older notify template, remove your existing notify.sh file.
|
||||||
|
# Leave (or place) this file in the "notify_templates" subdirectory within the same directory as the main dockcheck.sh script.
|
||||||
|
# If you instead wish make your own modifications, make a copy in the same directory as the main dockcheck.sh script.
|
||||||
# Enable and configure all required notification variables in your dockcheck.config file, e.g.:
|
# Enable and configure all required notification variables in your dockcheck.config file, e.g.:
|
||||||
# NOTIFY_CHANNELS=apprise gotify slack
|
# NOTIFY_CHANNELS=apprise gotify slack
|
||||||
# SLACK_TOKEN=xoxb-some-token-value
|
# SLACK_TOKEN=xoxb-some-token-value
|
||||||
@@ -8,7 +10,7 @@ NOTIFY_V2_VERSION="v0.1"
|
|||||||
|
|
||||||
enabled_notify_channels=( ${NOTIFY_CHANNELS:-} )
|
enabled_notify_channels=( ${NOTIFY_CHANNELS:-} )
|
||||||
|
|
||||||
FromHost=$(hostname)
|
FromHost=$(cat /etc/hostname)
|
||||||
|
|
||||||
remove_channel() {
|
remove_channel() {
|
||||||
local temp_array=()
|
local temp_array=()
|
||||||
@@ -19,21 +21,29 @@ remove_channel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for channel in "${enabled_notify_channels[@]}"; do
|
for channel in "${enabled_notify_channels[@]}"; do
|
||||||
source_if_exists "${ScriptWorkDir}/notify_templates/notify_${channel}.sh"
|
source_if_exists_or_fail "${ScriptWorkDir}/notify_${channel}.sh" || \
|
||||||
|
source_if_exists_or_fail "${ScriptWorkDir}/notify_templates/notify_${channel}.sh" || \
|
||||||
|
printf "The notification channel ${channel} is enabled, but notify_${channel}.sh was not found. Check the ${ScriptWorkDir} directory or the notify_templates subdirectory.\n"
|
||||||
done
|
done
|
||||||
|
|
||||||
send_notification() {
|
send_notification() {
|
||||||
[[ -s "$ScriptWorkDir"/urls.list ]] && releasenotes || Updates=("$@")
|
[[ -s "$ScriptWorkDir"/urls.list ]] && releasenotes || Updates=("$@")
|
||||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
||||||
|
UpdToString=${UpdToString%\\n}
|
||||||
|
|
||||||
for channel in "${enabled_notify_channels[@]}"; do
|
for channel in "${enabled_notify_channels[@]}"; do
|
||||||
printf "\nSending ${channel} notification\n"
|
printf "\nSending ${channel} notification\n"
|
||||||
|
|
||||||
MessageTitle="$FromHost - updates available."
|
# To be added in the MessageBody if "-d X" was used
|
||||||
# Setting the MessageBody variable here.
|
# leading space is left intentionally for clean output
|
||||||
printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n$UpdToString\n"
|
[[ -n "$DaysOld" ]] && msgdaysold="with images ${DaysOld}+ days old " || msgdaysold=""
|
||||||
|
|
||||||
exec_if_exists trigger_${channel}_notification "$@"
|
MessageTitle="$FromHost - updates ${msgdaysold}available."
|
||||||
|
# Setting the MessageBody variable here.
|
||||||
|
printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n${UpdToString}\n"
|
||||||
|
|
||||||
|
exec_if_exists_or_fail trigger_${channel}_notification || \
|
||||||
|
printf "Attempted to send notification to channel ${channel}, but the function was not found. Make sure notify_${channel}.sh is available in the ${ScriptWorkDir} directory or notify_templates subdirectory.\n"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +58,8 @@ dockcheck_notification() {
|
|||||||
if [[ ${#enabled_notify_channels[@]} -gt 0 ]]; then printf "\n"; fi
|
if [[ ${#enabled_notify_channels[@]} -gt 0 ]]; then printf "\n"; fi
|
||||||
for channel in "${enabled_notify_channels[@]}"; do
|
for channel in "${enabled_notify_channels[@]}"; do
|
||||||
printf "Sending dockcheck update notification - ${channel}\n"
|
printf "Sending dockcheck update notification - ${channel}\n"
|
||||||
exec_if_exists trigger_${channel}_notification
|
exec_if_exists_or_fail trigger_${channel}_notification || \
|
||||||
|
printf "Attempted to send notification to channel ${channel}, but the function was not found. Make sure notify_${channel}.sh is available in the ${ScriptWorkDir} directory or notify_templates subdirectory.\n"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -62,7 +73,7 @@ notify_update_notification() {
|
|||||||
for notify_script in "${update_channels[@]}"; do
|
for notify_script in "${update_channels[@]}"; do
|
||||||
upper_channel=$(tr '[:lower:]' '[:upper:]' <<< "$notify_script")
|
upper_channel=$(tr '[:lower:]' '[:upper:]' <<< "$notify_script")
|
||||||
VersionVar="NOTIFY_${upper_channel}_VERSION"
|
VersionVar="NOTIFY_${upper_channel}_VERSION"
|
||||||
if [[ -n "${!VersionVar}" ]]; then
|
if [[ -n "${!VersionVar:-}" ]]; then
|
||||||
RawNotifyUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/notify_templates/notify_${notify_script}.sh"
|
RawNotifyUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/notify_templates/notify_${notify_script}.sh"
|
||||||
LatestNotifyRelease="$(curl -s -r 0-150 $RawNotifyUrl | sed -n "/NOTIFY_${upper_channel}_VERSION/s/NOTIFY_${upper_channel}_VERSION=//p" | tr -d '"')"
|
LatestNotifyRelease="$(curl -s -r 0-150 $RawNotifyUrl | sed -n "/NOTIFY_${upper_channel}_VERSION/s/NOTIFY_${upper_channel}_VERSION=//p" | tr -d '"')"
|
||||||
LatestNotifyRelease=${LatestNotifyRelease:-undefined}
|
LatestNotifyRelease=${LatestNotifyRelease:-undefined}
|
||||||
@@ -74,7 +85,8 @@ notify_update_notification() {
|
|||||||
|
|
||||||
for channel in "${enabled_notify_channels[@]}"; do
|
for channel in "${enabled_notify_channels[@]}"; do
|
||||||
printf "Sending notify_${notify_script}.sh update notification - ${channel}\n"
|
printf "Sending notify_${notify_script}.sh update notification - ${channel}\n"
|
||||||
exec_if_exists trigger_${channel}_notification
|
exec_if_exists_or_fail trigger_${channel}_notification || \
|
||||||
|
printf "Attempted to send notification to channel ${channel}, but the function was not found. Make sure notify_${channel}.sh is available in the ${ScriptWorkDir} directory or notify_templates subdirectory.\n"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,49 +1,75 @@
|
|||||||
# This is a list of container names and releasenote urls, separated by space.
|
|
||||||
# Modify, add and (if necessary) remove to fit your needs.
|
|
||||||
# Additions are welcome! Append your list to the git-repo, use generic names and sensible urls.
|
# Additions are welcome! Append your list to the git-repo, use generic names and sensible urls.
|
||||||
|
# Modify, add and (if necessary) remove to fit your needs.
|
||||||
|
# This is a list of container names and releasenote urls, separated by space.
|
||||||
|
|
||||||
apprise-api https://github.com/linuxserver/docker-apprise-api/releases
|
|
||||||
homer https://github.com/bastienwirtz/homer/releases
|
|
||||||
nginx https://github.com/docker-library/official-images/blob/master/library/nginx
|
|
||||||
vaultwarden-server https://github.com/dani-garcia/vaultwarden/releases
|
|
||||||
bruceforce-vaultwarden-backup https://github.com/Bruceforce/vaultwarden-backup/blob/main/CHANGELOG.md
|
|
||||||
actual_server https://actualbudget.org/blog
|
actual_server https://actualbudget.org/blog
|
||||||
gotify https://github.com/gotify/server/releases
|
apprise-api https://github.com/linuxserver/docker-apprise-api/releases
|
||||||
traefik https://github.com/traefik/traefik/releases
|
|
||||||
caddy https://github.com/caddyserver/caddy/releases
|
|
||||||
homarr https://github.com/homarr-labs/homarr/releases
|
|
||||||
dozzle https://github.com/amir20/dozzle/releases
|
|
||||||
beszel https://github.com/henrygd/beszel/releases
|
|
||||||
forgejo https://codeberg.org/forgejo/forgejo/releases
|
|
||||||
dockge https://github.com/louislam/dockge/releases
|
|
||||||
cup https://github.com/sergi0g/cup/releases
|
|
||||||
|
|
||||||
calibre https://github.com/linuxserver/docker-calibre/releases
|
|
||||||
calibre-web https://github.com/linuxserver/docker-calibre-web/releases
|
|
||||||
readarr https://github.com/Readarr/Readarr/releases
|
|
||||||
audiobookshelf https://github.com/advplyr/audiobookshelf/releases
|
audiobookshelf https://github.com/advplyr/audiobookshelf/releases
|
||||||
|
|
||||||
gluetun https://github.com/qdm12/gluetun/releases
|
|
||||||
bazarr https://github.com/morpheus65535/bazarr/releases
|
bazarr https://github.com/morpheus65535/bazarr/releases
|
||||||
bazarr-ls https://github.com/linuxserver/docker-bazarr/releases
|
bazarr-ls https://github.com/linuxserver/docker-bazarr/releases
|
||||||
|
beszel https://github.com/henrygd/beszel/releases
|
||||||
|
bookstack https://github.com/BookStackApp/BookStack/releases
|
||||||
|
bruceforce-vaultwarden-backup https://github.com/Bruceforce/vaultwarden-backup/blob/main/CHANGELOG.md
|
||||||
|
caddy https://github.com/caddyserver/caddy/releases
|
||||||
|
calibre https://github.com/linuxserver/docker-calibre/releases
|
||||||
|
calibre-web https://github.com/linuxserver/docker-calibre-web/releases
|
||||||
|
cleanuperr https://github.com/flmorg/cleanuperr/releases
|
||||||
|
cross-seed https://github.com/cross-seed/cross-seed/releases
|
||||||
|
cup https://github.com/sergi0g/cup/releases
|
||||||
|
dockge https://github.com/louislam/dockge/releases
|
||||||
|
dozzle https://github.com/amir20/dozzle/releases
|
||||||
|
flatnotes https://github.com/dullage/flatnotes/releases
|
||||||
|
forgejo https://codeberg.org/forgejo/forgejo/releases
|
||||||
|
fressrss https://github.com/FreshRSS/FreshRSS/releases
|
||||||
|
gluetun https://github.com/qdm12/gluetun/releases
|
||||||
|
go2rtc https://github.com/AlexxIT/go2rtc/releases
|
||||||
|
gotify https://github.com/gotify/server/releases
|
||||||
|
hbbr https://github.com/rustdesk/rustdesk-server/releases
|
||||||
|
hbbs https://github.com/rustdesk/rustdesk-server/releases
|
||||||
|
homarr https://github.com/homarr-labs/homarr/releases
|
||||||
|
home-assistant https://github.com/home-assistant/core/releases/
|
||||||
|
homer https://github.com/bastienwirtz/homer/releases
|
||||||
|
immich_machine_learning https://github.com/immich-app/immich/releases
|
||||||
|
immich_postgres https://github.com/tensorchord/VectorChord/releases
|
||||||
|
immich_redis https://github.com/valkey-io/valkey/releases
|
||||||
|
immich_server https://github.com/immich-app/immich/releases
|
||||||
|
jellyfin https://github.com/jellyfin/jellyfin/releases
|
||||||
|
jellyseerr https://github.com/Fallenbagel/jellyseerr/releases
|
||||||
|
jellystat https://github.com/CyferShepard/Jellystat/releases
|
||||||
|
librespeed https://github.com/librespeed/speedtest/releases
|
||||||
|
lidarr https://github.com/Lidarr/Lidarr/releases/
|
||||||
|
lidarr-ls https://github.com/linuxserver/docker-lidarr/releases
|
||||||
|
lubelogger https://github.com/hargata/lubelog/releases
|
||||||
|
mattermost https://github.com/mattermost/mattermost/releases
|
||||||
|
mealie https://github.com/mealie-recipes/mealie/releases
|
||||||
|
meilisearch https://github.com/meilisearch/meilisearch/releases
|
||||||
|
monica https://github.com/monicahq/monica/releases
|
||||||
|
mqtt https://github.com/eclipse/mosquitto/tags
|
||||||
|
nextcloud-aio-mastercontainer https://github.com/nextcloud/all-in-one/releases
|
||||||
|
nginx https://github.com/docker-library/official-images/blob/master/library/nginx
|
||||||
|
owncast https://github.com/owncast/owncast/releases
|
||||||
prowlarr https://github.com/Prowlarr/Prowlarr/releases
|
prowlarr https://github.com/Prowlarr/Prowlarr/releases
|
||||||
prowlarr-ls https://github.com/linuxserver/docker-prowlarr/releases
|
prowlarr-ls https://github.com/linuxserver/docker-prowlarr/releases
|
||||||
|
qbittorrent https://www.qbittorrent.org/news
|
||||||
|
qbittorrent-nox https://www.qbittorrent.org/news
|
||||||
|
radarr https://github.com/Radarr/Radarr/releases/
|
||||||
|
radarr-ls https://github.com/linuxserver/docker-radarr/releases
|
||||||
|
readarr https://github.com/Readarr/Readarr/releases
|
||||||
|
readeck https://codeberg.org/readeck/readeck/releases
|
||||||
recyclarr https://github.com/recyclarr/recyclarr/releases
|
recyclarr https://github.com/recyclarr/recyclarr/releases
|
||||||
|
roundcubemail https://github.com/roundcube/roundcubemail/releases
|
||||||
sabnzbd https://github.com/linuxserver/docker-sabnzbd/releases
|
sabnzbd https://github.com/linuxserver/docker-sabnzbd/releases
|
||||||
sonarr https://github.com/linuxserver/docker-sonarr/releases
|
scrutiny https://github.com/AnalogJ/scrutiny/releases
|
||||||
radarr https://github.com/linuxserver/docker-radarr/releases
|
sftpgo https://github.com/drakkan/sftpgo/releases
|
||||||
lidarr https://github.com/linuxserver/docker-lidarr/releases
|
|
||||||
jellyseerr https://github.com/Fallenbagel/jellyseerr/releases
|
|
||||||
jellyfin https://github.com/jellyfin/jellyfin/releases
|
|
||||||
tautulli https://github.com/Tautulli/Tautulli/releases
|
|
||||||
cleanuperr https://github.com/flmorg/cleanuperr/releases
|
|
||||||
slskd https://github.com/slskd/slskd/releases
|
slskd https://github.com/slskd/slskd/releases
|
||||||
|
snappymail https://github.com/the-djmaze/snappymail/releases
|
||||||
home-assistant https://github.com/home-assistant/docker/releases
|
sonarr https://github.com/Sonarr/Sonarr/releases/
|
||||||
|
sonarr-ls https://github.com/linuxserver/docker-sonarr/releases
|
||||||
|
syncthing https://github.com/syncthing/syncthing/releases
|
||||||
|
tautulli https://github.com/Tautulli/Tautulli/releases
|
||||||
|
thelounge https://github.com/thelounge/thelounge/releases
|
||||||
|
traefik https://github.com/traefik/traefik/releases
|
||||||
|
vaultwarden-server https://github.com/dani-garcia/vaultwarden/releases
|
||||||
|
watchtower https://github.com/beatkind/watchtower/releases
|
||||||
|
wud https://github.com/getwud/wud/releases
|
||||||
zigbee2mqtt https://github.com/Koenkk/zigbee2mqtt/releases
|
zigbee2mqtt https://github.com/Koenkk/zigbee2mqtt/releases
|
||||||
mqtt https://github.com/eclipse/mosquitto/tags
|
|
||||||
|
|
||||||
bookstack https://github.com/BookStackApp/BookStack/releases
|
|
||||||
lubelogger https://github.com/hargata/lubelog/releases
|
|
||||||
mealie https://github.com/mealie-recipes/mealie/releases
|
|
||||||
flatnotes https://github.com/dullage/flatnotes/releases
|
|
||||||
|
|||||||
Reference in New Issue
Block a user