mirror of
https://github.com/mag37/dockcheck.git
synced 2026-02-14 23:38:15 +01:00
Cleanups + info to readme
This commit is contained in:
parent
f31a886424
commit
a79de24bcc
11 changed files with 8 additions and 12 deletions
53
notify_templates/notify_DSM.sh
Normal file
53
notify_templates/notify_DSM.sh
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||
# INFO: ssmtp is depcerated - consider to use msmtp instead.
|
||||
#
|
||||
# Copy/rename this file to notify.sh to enable the notification snipppet.
|
||||
# mSMTP/sSMTP has to be installed and configured manually.
|
||||
# The existing DSM Notification Email configuration will be used automatically.
|
||||
# Modify to your liking - changing SendMailTo and Subject and content.
|
||||
|
||||
MSMTP=$(which msmtp)
|
||||
SSMTP=$(which ssmtp)
|
||||
|
||||
if [ -n $MSMPT ] ; then
|
||||
MAIL=$MSMTP
|
||||
elif [ -n $SSMTP ] && [ -z $MAIL ] ; then
|
||||
MAIL=$SSMTP
|
||||
else
|
||||
echo "No msmtp or ssmtp binary found in PATH: $PATH" ; exit 1
|
||||
fi
|
||||
|
||||
send_notification() {
|
||||
Updates=("$@")
|
||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||
FromHost=$(hostname)
|
||||
CfgFile="/usr/syno/etc/synosmtp.conf"
|
||||
|
||||
# User variables:
|
||||
# Automatically sends to your usual destination for synology DSM notification emails.
|
||||
# You can also manually override by assigning something else to SendMailTo below.
|
||||
SendMailTo=$(grep 'eventmail1' $CfgFile | sed -n 's/.*"\([^"]*\)".*/\1/p')
|
||||
#SendMailTo="me@mydomain.com"
|
||||
|
||||
SubjectTag=$(grep 'eventsubjectprefix' $CfgFile | sed -n 's/.*"\([^"]*\)".*/\1/p')
|
||||
SenderName=$(grep 'smtp_from_name' $CfgFile | sed -n 's/.*"\([^"]*\)".*/\1/p')
|
||||
SenderMail=$(grep 'smtp_from_mail' $CfgFile | sed -n 's/.*"\([^"]*\)".*/\1/p')
|
||||
SenderMail=${SenderMail:-$(grep 'eventmail1' $CfgFile | sed -n 's/.*"\([^"]*\)".*/\1/p')}
|
||||
|
||||
printf "\nSending email notification.\n"
|
||||
|
||||
$MAIL $SendMailTo << __EOF
|
||||
From: "$SenderName" <$SenderMail>
|
||||
date:$(date -R)
|
||||
To: <$SendMailTo>
|
||||
Subject: $SubjectTag Updates available on $FromHost
|
||||
Content-Type: text/plain; charset=UTF-8; format=flowed
|
||||
Content-Transfer-Encoding: 7bit
|
||||
|
||||
The following containers on $FromHost have updates available:
|
||||
|
||||
$UpdToString
|
||||
|
||||
From $SenderName
|
||||
__EOF
|
||||
}
|
||||
35
notify_templates/notify_apprise.sh
Normal file
35
notify_templates/notify_apprise.sh
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||
#
|
||||
# Copy/rename this file to notify.sh to enable the notification snippet.
|
||||
# Required receiving services must already be set up.
|
||||
# Modify to fit your setup - if API, set AppriseURL to your Apprise ip/domain.
|
||||
|
||||
send_notification() {
|
||||
Updates=("$@")
|
||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||
FromHost=$(hostname)
|
||||
|
||||
printf "\nSending Apprise notification\n"
|
||||
|
||||
MessageTitle="$FromHost - updates available."
|
||||
# Setting the MessageBody variable here.
|
||||
read -d '\n' MessageBody << __EOF
|
||||
Containers on $FromHost with updates available:
|
||||
|
||||
$UpdToString
|
||||
|
||||
__EOF
|
||||
|
||||
# Modify to fit your setup:
|
||||
apprise -vv -t "$MessageTitle" -b "$MessageBody" \
|
||||
mailto://myemail:mypass@gmail.com \
|
||||
mastodons://{token}@{host} \
|
||||
pbul://o.gn5kj6nfhv736I7jC3cj3QLRiyhgl98b \
|
||||
tgram://{bot_token}/{chat_id}/
|
||||
|
||||
### If you use the Apprise-API - Comment out the apprise command above.
|
||||
### Uncomment the AppriseURL and the curl-line below:
|
||||
# AppriseURL="http://apprise.mydomain.tld:1234/notify/apprise"
|
||||
# curl -X POST -F "title=$MessageTitle" -F "body=$MessageBody" -F "tags=all" $AppriseURL
|
||||
|
||||
}
|
||||
14
notify_templates/notify_generic.sh
Normal file
14
notify_templates/notify_generic.sh
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||
#
|
||||
# Copy/rename this file to notify.sh to enable the notification snippet.
|
||||
# generic sample, the "Hello World" of notification addons
|
||||
|
||||
send_notification() {
|
||||
Updates=("$@")
|
||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||
FromHost=$(hostname)
|
||||
|
||||
# platform specific notification code would go here
|
||||
printf "\n%bGeneric notification addon:%b" "$c_green" "$c_reset"
|
||||
printf "\nThe following docker containers on %s need to be updated:\n%s\n" "$FromHost" "$UpdToString"
|
||||
}
|
||||
29
notify_templates/notify_gotify.sh
Normal file
29
notify_templates/notify_gotify.sh
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||
#
|
||||
# Copy/rename this file to notify.sh to enable the notification snippet.
|
||||
# Required receiving services must already be set up.
|
||||
# Modify to fit your setup - set GotifyUrl and GotifyToken.
|
||||
|
||||
send_notification() {
|
||||
Updates=("$@")
|
||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||
FromHost=$(hostname)
|
||||
|
||||
# platform specific notification code would go here
|
||||
printf "\nSending Gotify notification\n"
|
||||
|
||||
# Setting the MessageTitle and MessageBody variable here.
|
||||
MessageTitle="${FromHost} - updates available."
|
||||
MessageBody="Containers on ${FromHost} with updates available: ${UpdToString}"
|
||||
|
||||
# Modify to fit your setup:
|
||||
GotifyToken="Your Gotify token here"
|
||||
GotifyUrl="https://api.gotify/message?token=${GotifyToken}"
|
||||
|
||||
curl \
|
||||
-F "title=${MessageTitle}" \
|
||||
-F "message=${MessageBody}" \
|
||||
-F "priority=5" \
|
||||
-X POST "${GotifyUrl}" &> /dev/null
|
||||
|
||||
}
|
||||
28
notify_templates/notify_matrix.sh
Normal file
28
notify_templates/notify_matrix.sh
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||
#
|
||||
# Copy/rename this file to notify.sh to enable the notification snippet.
|
||||
# Required receiving services must already be set up.
|
||||
# Modify to fit your setup - set MatrixServer, Room_id and AccessToken
|
||||
|
||||
send_notification() {
|
||||
Updates=("$@")
|
||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||
FromHost=$(hostname)
|
||||
|
||||
# platform specific notification code would go here
|
||||
printf "\nSending Matrix notification\n"
|
||||
|
||||
# Setting the MessageBody variable here.
|
||||
MessageBody="🐋 Containers on $FromHost with updates available: \n$UpdToString"
|
||||
|
||||
# Modify to fit your setup:
|
||||
AccessToken="Your Matrix token here"
|
||||
Room_id="Enter Room_id here"
|
||||
MatrixServer="Enter Your HomeServer URL"
|
||||
MsgBody="{\"msgtype\":\"m.text\",\"body\":\"$MessageBody\"}"
|
||||
|
||||
# URL Example: https://matrix.org/_matrix/client/r0/rooms/!xxxxxx:example.com/send/m.room.message?access_token=xxxxxxxx
|
||||
|
||||
curl -sS -o /dev/null --fail -X POST "$MatrixServer/_matrix/client/r0/rooms/$Room_id/send/m.room.message?access_token=$AccessToken" -H 'Content-Type: application/json' -d "$MsgBody"
|
||||
|
||||
}
|
||||
31
notify_templates/notify_ntfy-sh.sh
Normal file
31
notify_templates/notify_ntfy-sh.sh
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||
#
|
||||
# Copy/rename this file to notify.sh to enable the notification snippet.
|
||||
# Setup app and subscription at https://ntfy.sh
|
||||
# Use your unique Topic Name in the URL below.
|
||||
|
||||
send_notification() {
|
||||
Updates=("$@")
|
||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||
FromHost=$(hostname)
|
||||
|
||||
printf "\nSending ntfy.sh notification\n"
|
||||
|
||||
MessageTitle="$FromHost - updates available."
|
||||
# Setting the MessageBody variable here.
|
||||
read -d '\n' MessageBody << __EOF
|
||||
Containers on $FromHost with updates available:
|
||||
|
||||
$UpdToString
|
||||
|
||||
__EOF
|
||||
|
||||
# Modify to fit your setup:
|
||||
NtfyUrl="ntfy.sh/YourUniqueTopicName"
|
||||
|
||||
curl -sS -o /dev/null --show-error --fail \
|
||||
-H "Title: $MessageTitle" \
|
||||
-d "$MessageBody" \
|
||||
$NtfyUrl
|
||||
|
||||
}
|
||||
27
notify_templates/notify_pushbullet.sh
Normal file
27
notify_templates/notify_pushbullet.sh
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||
#
|
||||
# Copy/rename this file to notify.sh to enable the notification snippet.
|
||||
# Required receiving services must already be set up.
|
||||
# Requires jq installed and in PATH.
|
||||
# Modify to fit your setup - set Url and Token.
|
||||
|
||||
send_notification() {
|
||||
Updates=("$@")
|
||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||
FromHost=$(hostname)
|
||||
|
||||
# platform specific notification code would go here
|
||||
printf "\nSending pushbullet notification\n"
|
||||
|
||||
MessageTitle="$FromHost - updates available."
|
||||
# Setting the MessageBody variable here.
|
||||
MessageBody="Containers on $FromHost with updates available: $UpdToString"
|
||||
|
||||
# Modify to fit your setup:
|
||||
PushUrl="https://api.pushbullet.com/v2/pushes"
|
||||
PushToken="Your Pushbullet token here"
|
||||
|
||||
# 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 @-
|
||||
|
||||
}
|
||||
32
notify_templates/notify_pushover.sh
Normal file
32
notify_templates/notify_pushover.sh
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||
#
|
||||
# Copy/rename this file to notify.sh to enable the notification snippet.
|
||||
# Required receiving services must already be set up.
|
||||
# Requires jq installed and in PATH.
|
||||
# Modify to fit your setup - set Url and Token.
|
||||
|
||||
send_notification() {
|
||||
Updates=("$@")
|
||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||
FromHost=$(hostname)
|
||||
|
||||
# platform specific notification code would go here
|
||||
printf "\nSending pushover notification\n"
|
||||
|
||||
MessageTitle="$FromHost - updates available."
|
||||
# Setting the MessageBody variable here.
|
||||
MessageBody="Containers on $FromHost with updates available: $UpdToString"
|
||||
|
||||
# Modify to fit your setup:
|
||||
PushoverUrl="https://api.pushover.net/1/messages.json"
|
||||
PushoverUserKey="Your Pushover User Key Here"
|
||||
PushoverToken="Your Pushover API Token Here"
|
||||
|
||||
# Sending the notification via Pushover
|
||||
curl -sS -o /dev/null --show-error --fail -X POST \
|
||||
-F "token=$PushoverToken" \
|
||||
-F "user=$PushoverUserKey" \
|
||||
-F "title=$MessageTitle" \
|
||||
-F "message=$MessageBody" \
|
||||
$PushoverUrl
|
||||
}
|
||||
44
notify_templates/notify_smtp.sh
Normal file
44
notify_templates/notify_smtp.sh
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||
# INFO: ssmtp is depcerated - consider to use msmtp instead.
|
||||
#
|
||||
# Copy/rename this file to notify.sh to enable the notification snipppet.
|
||||
# mSMTP/sSMTP has to be installed and configured manually.
|
||||
# Modify to fit your setup - changing SendMailFrom, SendMailTo, SubjectTag
|
||||
|
||||
MSMTP=$(which msmtp)
|
||||
SSMTP=$(which ssmtp)
|
||||
|
||||
if [ -n $MSMPT ] ; then
|
||||
MAIL=$MSMTP
|
||||
elif [ -n $SSMTP ] && [ -z $MAIL ] ; then
|
||||
MAIL=$SSMTP
|
||||
else
|
||||
echo "No msmtp or ssmtp binary found in PATH: $PATH" ; exit 1
|
||||
fi
|
||||
|
||||
send_notification() {
|
||||
Updates=("$@")
|
||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||
FromHost=$(hostname)
|
||||
|
||||
# User variables:
|
||||
SendMailFrom="me@mydomain.tld"
|
||||
SendMailTo="me@mydomain.tld"
|
||||
SubjectTag="dockcheck"
|
||||
|
||||
printf "\nSending email notification.\n"
|
||||
|
||||
$MAIL $SendMailTo << __EOF
|
||||
From: "$FromHost" <$SendMailFrom>
|
||||
date:$(date -R)
|
||||
To: <$SendMailTo>
|
||||
Subject: [$SubjectTag] Updates available on $FromHost
|
||||
Content-Type: text/plain; charset=UTF-8; format=flowed
|
||||
Content-Transfer-Encoding: 7bit
|
||||
|
||||
The following containers on $FromHost have updates available:
|
||||
|
||||
$UpdToString
|
||||
|
||||
__EOF
|
||||
}
|
||||
27
notify_templates/notify_telegram.sh
Normal file
27
notify_templates/notify_telegram.sh
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||
#
|
||||
# Copy/rename this file to notify.sh to enable the notification snippet.
|
||||
# Required receiving services must already be set up.
|
||||
# Modify to fit your setup - set TelegramChatId and TelegramToken.
|
||||
|
||||
send_notification() {
|
||||
Updates=("$@")
|
||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||
FromHost=$(hostname)
|
||||
|
||||
# platform specific notification code would go here
|
||||
printf "\nSending Telegram notification\n"
|
||||
|
||||
# Setting the MessageBody variable here.
|
||||
MessageBody="🐋 Containers on $FromHost with updates available: \n$UpdToString"
|
||||
|
||||
# Modify to fit your setup:
|
||||
TelegramToken="Your Telegram token here"
|
||||
TelegramChatId="Your Telegram ChatId here"
|
||||
TelegramUrl="https://api.telegram.org/bot$TelegramToken"
|
||||
TelegramTopicID=12345678 ## Set to 0 if not using specific topic within chat
|
||||
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"
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue