Use notifier and clean up independent mail enabled and mail address configs

This commit is contained in:
Alexander Schäferdiek 2023-01-26 00:21:49 +01:00
parent bc01d41f1c
commit ed7a1c639c
41 changed files with 194 additions and 283 deletions

View file

@ -11,24 +11,27 @@ It's part of **system-helpers**.
# DESCRIPTION
**check_updates** checks for available updates using *checkupdates* and sends out a mail. It comes with systemd services.
**check_updates** checks for available updates using *checkupdates* (which can be customized) and notifies. It comes with systemd services.
By default, **check_updates** tries to read from *$HOME/.check_updates.conf* and */etc/check_updates.conf* for configuration. It will exit with a non-zero exit code if it cannot find a proper configuration file.
The following are at least required for the script to work:\
- **CHECK_UPDATES_MAIL_ADDRESS=""** which requires *mail.rc* to be configured and '*mailx*' command has be available.
- **CHECK_UPDATES_UPDATES_CMD** is the command for retrieving which updates are available, by default it's set to */usr/bin/checkupdates* (Arch Linux default).
- **CHECK_UPDATES_UPDATES_AMOUNT_CMD** is the command used to determine the amount of updates, by default it's set to */usr/bin/checkupdates | wc -l* (Arch Linux default).
The following can be modified if defaults don't apply:\
- **CHECK_UPDATES_UPDATES_CMD** is the command for retrieving which updates are available, by default it's set to */usr/bin/checkupdates* (Arch Linux default).\
- **CHECK_UPDATES_UPDATES_AMOUNT_CMD** is the command used to determine the amount of updates, by default it's set to */usr/bin/checkupdates | wc -l* (Arch Linux default).\
You can copy this script to */usr/local/bin* and use create a custom **CONFIG_FILE** as user.
# EXAMPLE
Create a *$HOME/.check_updates.conf* and add *CHECK_UPDATES_MAIL_ADDRESS="alias@domain.tld"*. Notifications will be delivered to alias@domain.tld. Examples can be found in */usr/share/doc/check_updates*.
Create a *$HOME/.check_updates.conf* and add *CHECK_UPDATES_UPDATES_CMD="..."*. Notifications will be delivered via **notifier**. Examples can be found in */usr/share/doc/check_updates*.
# EXIT VALUES
**0**
: Success
**1**
: Error
: Error
# SEE ALSO
**notifier** - used as notification application

View file

@ -3,7 +3,7 @@
% January 2023
# NAME
disk_space_alert - Checks available disk space and sends out notification via mail. Configuration is done in environment files.\
disk_space_alert - Checks available disk space and notifies. Configuration is done in environment files.\
It's part of **system-helpers**.
# SYNOPSIS
@ -11,26 +11,27 @@ It's part of **system-helpers**.
# DESCRIPTION
**disk_space_alert** checks available diskspace for configured **mounts** and sends out a mail if certain limits are reached. It comes with systemd services.
**disk_space_alert** checks available diskspace for configured **mounts** and notifies if certain limits are reached. It comes with systemd services.
By default, **disk_space_alert** tries to read from *$HOME/.disk_space_alert.conf* and */etc/disk_space_alert.conf* for configuration. It will exit with a non-zero exit code if it cannot find a proper configuration file.
The following are at least required for the script to work:\
- **DISK_SPACE_ALERT_MAIL_ADDRESS=""** which requires *mail.rc* to be configured and '*mailx*' command has be available.\
The following are optional or have reasonable defaults:
- **DISK_SPACE_ALERT_THRESHOLD=93** in percentage
- **DISK_SPACE_ALERT_MOUNTPOINTS=("/")** is an array of mountpoints
The following can be customized:\
- **DISK_SPACE_ALERT_THRESHOLD=93** in percentage.\
- **DISK_SPACE_ALERT_MOUNTPOINTS=("/")** is an array of mountpoints.\
You can copy this script to */usr/local/bin* and use create a custom **CONFIG_FILE** as user.
# EXAMPLE
Create a *$HOME/.disk_space_alert.conf* and add *DISK_SPACE_ALERT_MAIL_ADDRESS="alias@domain.tld"*. Notifications will be delivered to alias@domain.tld. Examples can be found in */usr/share/doc/disk_space_alert*.
Create a *$HOME/.disk_space_alert.conf* and add *DISK_SPACE_ALERT_THRESHOLD="95"*. Notifications will be delivered via **notifier**. Examples can be found in */usr/share/doc/disk_space_alert*.
# EXIT VALUES
**0**
: Success
**1**
: Error
: Error
# SEE ALSO
**notifier** - used as notification application

View file

@ -15,21 +15,23 @@ It's part of **system-helpers**.
By default, **docker_check** tries to read from *$HOME/.docker_check.conf* and */etc/docker_check.conf* for configuration. It will exit with a non-zero exit code if it cannot find a proper configuration file.
The following are at least required for the script to work:\
- **DOCKER_CHECK_MAIL_ADDRESS=""** which requires *mail.rc* to be configured and '*mailx*' command has be available.\
The following can be customized:\
- **DOCKER_CHECK_LIST_FILE="$HOME/.docker_check.list"** which lists to be checked docker containers separated by lines. Provide their container name, e.g. output of current running docker containers piped into the file: *docker ps --format '{{.Names}}' >> $HOME/.docker_check.list*).\
- **DOCKER_CHECK_NOTIFY_LEVELS=("UNKNOWN" "WARNING" "CRITICAL")** determines when to notify/output/send mail. Possible: *"UNKNOWN"* *"WARNING"* *"CRITICAL"* *"INFO"*.\
- **DOCKER_CHECK_MAIL_ENABLED=false** enables or disables sending mail notifications.
- **DOCKER_CHECK_NOTIFY_LEVELS=("UNKNOWN" "WARNING" "CRITICAL")** determines when to notify/output. Possible: *"UNKNOWN"* *"WARNING"* *"CRITICAL"* *"INFO"*.\
You can copy this script to */usr/local/bin* and use create a custom **CONFIG_FILE** as user.
# EXAMPLE
Create a *$HOME/.docker_check.conf* and add *DOCKER_CHECK_MAIL_ADDRESS="alias@domain.tld"*. Notifications will be delivered to alias@domain.tld. Examples can be found in */usr/share/doc/docker_check*.
Create a *$HOME/.docker_check.conf* and add *DOCKER_CHECK_NOTIFY_LEVELS="(WARNING)"*. Notifications will be delivered via **notifier**. Examples can be found in */usr/share/doc/docker_check*.
# EXIT VALUES
**0**
: Success
**1**
: Error
: Error
# SEE ALSO
**notifier** - used as notification application

View file

@ -20,7 +20,7 @@ The following are at least required for the script to work:\
- **DOCKER_COMPOSE_UPDATE_IGNORES=("mailcow")** folder names which will be ignored and not be updated, at least () is required.\
- **DOCKER_COMPOSE_UPDATE_COMMANDS[aDirectoryName]="./callFancyScriptInDirectory"** to explicitly define update command for one sub folder *aDirectoryName*. This is a map and defining different instructions for multiple locations is possible. Example: accessor has to match the folder, e.g. *<baseDir>/aDirectoryName* will use command "*./callFancyScriptInDirectory"* when changing directory into it.\
- **DOCKER_COMPOSE_UPDATE_COMMAND="sudo docker-compose down; sudo docker-compose pull; sudo docker-compose up -d;"** determines the default update command executed for each deployment.\
- **DOCKER_COMPOSE_UPDATE_FAIL_ON_UPDATE_ERROR="false"** determines if script fails if at least one update procedure failed
- **DOCKER_COMPOSE_UPDATE_FAIL_ON_UPDATE_ERROR="false"** determines if script fails if at least one update procedure failed.\
You can copy this script to */usr/local/bin* and use create a custom **CONFIG_FILE** as user.

View file

@ -15,9 +15,7 @@ It's part of **system-helpers**.
By default, **dynv6** tries to read from *$HOME/.dynv6.conf* and */etc/dynv6.conf* for configuration. It will exit with a non-zero exit code if it cannot find a proper configuration file.
The following are at least required for the script to work:\
- **DYNV6_MAIL_ENABLED** to enable or disable mail notification.
- **DYNV6_MAIL_ADDRESS** which requires *mail.rc* to be configured and '*mailx*' command has be available.\
The following can be customized:\
- **DYNV6_TOKEN** the dynv6 token.\
- **DYNV6_HOSTNAME** the dynv6 hostname.\
- **DYNV6_IPV4_ENABLED** enable or disable updating IPv4.\
@ -28,11 +26,15 @@ You can copy this script to */usr/local/bin* and use create a custom **CONFIG_FI
# EXAMPLE
Create a *$HOME/.dynv6.conf* and add *DYNV6_MAIL_ADDRESS="alias@domain.tld"*. Notifications will be delivered to alias@domain.tld. Examples can be found in */usr/share/doc/dynv6*.
Create a *$HOME/.dynv6.conf* and add *DYNV6_TOKEN="mySecretToken"*. Notifications will be delivered via **notifier**. Examples can be found in */usr/share/doc/dynv6*.
# EXIT VALUES
**0**
: Success
**1**
: Error
: Error
# SEE ALSO
**notifier** - used as notification application

View file

@ -3,7 +3,7 @@
% January 2023
# NAME
memory_usage_alert - Checks available memory and sends out notification via mail. Configuration is done in environment files.\
memory_usage_alert - Checks available memory and sends out notifications. Configuration is done in environment files.\
It's part of **system-helpers**.
# SYNOPSIS
@ -11,13 +11,10 @@ It's part of **system-helpers**.
# DESCRIPTION
**memory_usage_alert** checks available memory and sends out a mail if certain limits are reached. It comes with systemd services.
**memory_usage_alert** checks available memory and sends notifications if certain limits are reached. It comes with systemd services.
By default, **memory_usage_alert** tries to read from *$HOME/.memory_usage_alert.conf* and */etc/memory_usage_alert.conf* for configuration. It will exit with a non-zero exit code if it cannot find a proper configuration file.
The following are at least required for the script to work:\
- **MEMORY_USAGE_ALERT_MAIL_ADDRESS=""** which requires *mail.rc* to be configured and '*mailx*' command has be available.\
The following are optional or have reasonable defaults:
- **MEMORY_USAGE_ALERT_THRESHOLD=512** threshold to warn about (in *megabytes*)
@ -25,11 +22,15 @@ You can copy this script to */usr/local/bin* and use create a custom **CONFIG_FI
# EXAMPLE
Create a *$HOME/.memory_usage_alert.conf* and add *MEMORY_USAGE_ALERT_MAIL_ADDRESS="alias@domain.tld"*. Notifications will be delivered to alias@domain.tld. Examples can be found in */usr/share/doc/memory_usage_alert*.
Create a *$HOME/.memory_usage_alert.conf* and add *MEMORY_USAGE_ALERT_THRESHOLD="1024"*. Notifications will be delivered via **notifier**. Examples can be found in */usr/share/doc/memory_usage_alert*.
# EXIT VALUES
**0**
: Success
**1**
: Error
: Error
# SEE ALSO
**notifier** - used as notification application

View file

@ -25,7 +25,7 @@ You can copy this script to */usr/local/bin* and use create a custom **CONFIG_FI
# EXAMPLE
Create a *$HOME/.notifier.conf* and add *NOTIFIER_MAIL_ADDRESS="alias@domain.tld"*. Notifications will be delivered to alias@domain.tld. Examples can be found in */usr/share/doc/notifier*.
Create a *$HOME/.notifier.conf* and add *NOTIFIER_MAIL_ADDRESS="alias@domain.tld"*. Notifications will be delivered to alias@domain.tld or via gotify if enabled. Examples can be found in */usr/share/doc/notifier*.
# EXIT VALUES
**0**
@ -36,4 +36,4 @@ Create a *$HOME/.notifier.conf* and add *NOTIFIER_MAIL_ADDRESS="alias@domain.tld
# SEE ALSO
system-helpers
**system-helpers**

View file

@ -11,23 +11,26 @@ It's part of **system-helpers**.
# DESCRIPTION
**smart_tests_long** checks for available updates using *smartctl* and sends out a mail. It comes with systemd services.
**smart_tests_long** checks for available updates using *smartctl* and notifies. It comes with systemd services.
By default, **smart_tests_long** tries to read from *$HOME/.smartctl_tests_long.conf* and */etc/smartctl_tests_long.conf* for configuration. It will exit with a non-zero exit code if it cannot find a proper configuration file.
The following are at least required for the script to work:\
- **SMARTCTL_TESTS_LONG_MAIL_ADDRESS=""** which requires *mail.rc* to be configured and '*mailx*' command has be available.
The following can be customized:\
- **SMARTCTL_TESTS_LONG_DEVICES=(sda)** array of block devices (not partitions!) to check.
You can copy this script to */usr/local/bin* and use create a custom **CONFIG_FILE** as user.
# EXAMPLE
Create a *$HOME/.smartctl_tests_long.conf* and add *SMARTCTL_TESTS_LONG_MAIL_ADDRESS="alias@domain.tld"*. Notifications will be delivered to alias@domain.tld for default block device **sda**. Examples can be found in */usr/share/doc/smart_tests_long*.
Create a *$HOME/.smartctl_tests_long.conf* and add *SMARTCTL_TESTS_LONG_DEVICES="(nvme1 sdc sdf)"*. Notifications will be delivered via **notifier** for default block device **sda**. Examples can be found in */usr/share/doc/smart_tests_long*.
# EXIT VALUES
**0**
: Success
**1**
: Error
: Error
# SEE ALSO
**notifier** - used as notification application

View file

@ -19,8 +19,8 @@ shell scripts for common tasks.
- docker housekeeping for removing unused docker containers, volumes and images
- update check for pacman (ArchLinux specific, see **man check_updates**)
Provided systemd services mostly support mail notifications if they have failed
via **systemd_failure_notify**.
Provided systemd services mostly support notifications if they have failed
via **systemd_failure_notify** which uses **notifier** (see **man notifier**).
See */usr/share/doc/system-helpers* for example configurations which should
be copied inside **$HOME** or **/etc** depending on the helper script.

View file

@ -15,20 +15,22 @@ It's part of **system-helpers**.
By default, **systemd_check** tries to read from *$HOME/.systemd_check.conf* and */etc/systemd_check.conf* for configuration. It will exit with a non-zero exit code if it cannot find a proper configuration file.
The following are at least required for the script to work:\
The following can be customized:\
- **SYSTEMD_CHECK_LIST_FILE="$HOME/.systemd_check.list"** which lists to be checked systemd services, timers or targets separated by lines.\
- **SYSTEMD_CHECK_MAIL_ENABLED=false** enables or disables sending mail notifications.
- **SYSTEMD_CHECK_MAIL_ADDRESS=""** which requires *mail.rc* to be configured and '*mailx*' command has be available.\
You can copy this script to */usr/local/bin* and use create a custom **CONFIG_FILE** as user.
# EXAMPLE
Create a *$HOME/.systemd_check.conf* and add *SYSTEMD_CHECK_MAIL_ADDRESS="alias@domain.tld"*. Notifications will be delivered to alias@domain.tld. Examples can be found in */usr/share/doc/systemd_check*.
Create a *$HOME/.systemd_check.conf* and add *SYSTEMD_CHECK_LIST_FILE="/other/path/to/list"*. Notifications will be delivered via **notifier**. Examples can be found in */usr/share/doc/systemd_check*.
# EXIT VALUES
**0**
: Success
**1**
: Error
: Error
# SEE ALSO
**notifier** - used as notification application

View file

@ -3,7 +3,7 @@
% January 2023
# NAME
systemd_failure_notify - Notifies via mail or gotify when a service has failed. Configuration is done in environment files.\
systemd_failure_notify - Invokes when a systemd service has failed. Configuration is done in environment files.\
It's part of **system-helpers**.
# SYNOPSIS
@ -11,23 +11,15 @@ It's part of **system-helpers**.
# DESCRIPTION
**systemd_failure_notify** executes *mailx* or *gotify* to send out notifications. It comes with systemd services. Use the provided systemd service in the **OnFailure** directive with *OnFailure=systemd_failure_notify@%n.service*.
**systemd_failure_notify** triggered when systemd services fail. It comes with systemd services. Use the provided systemd service in the **OnFailure** directive with *OnFailure=systemd_failure_notify@%n.service*.
By default, **systemd_failure_notify** tries to read from *$HOME/.systemd_failure_notify.conf* and */etc/systemd_failure_notify.conf* for configuration. It will exit with a non-zero exit code if it cannot find a proper configuration file.
The following are at least required for the script to work:\
- **SYSTEMD_FAILURE_NOTIFY_MAIL_ADDRESS=""** which requires *mail.rc* to be configured and '*mailx*' command has be available¸
By default, **SYSTEMD_FAILURE_NOTIFY_MAIL_ENABLED** is set to **true**. Set it to **false** to use *gotify* only.\
The following are optional and integrate gotify-cli to send notifications, it defaults to false:\
- **SYSTEMD_FAILURE_NOTIFY_GOTIFY_ENABLED="true"** uses *gotify* command which has be available and needs to be properly configured by having a cli.json file.
You can copy this script to */usr/local/bin* and use create a custom **CONFIG_FILE** as user.
# EXAMPLE
Create a *$HOME/.systemd_failure_notify.conf* and add *SYSTEMD_FAILURE_NOTIFY_MAIL_ADDRESS="alias@domain.tld"*. Notifications will be delivered to alias@domain.tld. Examples can be found in */usr/share/doc/systemd_failure_notify*.
Create a *$HOME/.systemd_failure_notify.conf*. Notifications will be delivered via **notifier**. Examples can be found in */usr/share/doc/systemd_failure_notify*.
Then, add **systemd_failure_notify@serviceName** in a systemd unit file in the **OnFailure** directive:
@ -39,4 +31,8 @@ OnFailure=systemd_failure_notify@%n.service\
: Success
**1**
: Error
: Error
# SEE ALSO
**notifier** - used as notification application

View file

@ -60,13 +60,8 @@ check_required() {
echo "CHECK_UPDATES_UPDATES_AMOUNT_CMD is required"
exit 1
fi
if [[ -z ${CHECK_UPDATES_MAIL_ADDRESS} ]]; then
echo "CHECK_UPDATES_MAIL_ADDRESS is required"
exit 1
fi
type hostname &> /dev/null || { echo "Requiring 'hostname' but it's not installed"; exit 1; }
type mailx &> /dev/null || { echo "Requiring 'mailx' but it's not installed"; exit 1; }
}
CHECK_UPDATES_UPDATES=$(eval "${CHECK_UPDATES_UPDATES_CMD}")
@ -80,13 +75,12 @@ HOSTNAME=$(hostname)
if [[ "$CHECK_UPDATES_UPDATES_AMOUNT" -gt "0" ]]; then
SUBJECT="[updates ${HOSTNAME}]"
MESSAGE=$(
cat <<EOF
MESSAGE=$(cat <<EOF
There are ${CHECK_UPDATES_UPDATES_AMOUNT} updates available on ${HOSTNAME}.
${CHECK_UPDATES_UPDATES};
EOF
)
)
echo "$MESSAGE" | mailx -Ssendwait -s "$SUBJECT" "$CHECK_UPDATES_MAIL_ADDRESS"
notifier "${SUBJECT}" "${MESSAGE}"
fi

View file

@ -5,7 +5,7 @@ usage() {
USAGE=$(cat <<EOF
Usage: disk_space_alert
Checks available diskspace for configured **mounts** and sends out a mail if certain limits are reached. Please see man disk_space_alert.
Checks available diskspace for configured **mounts** and notifies if certain limits are reached. Please see man disk_space_alert.
EOF
)
echo "$USAGE";
@ -47,12 +47,10 @@ source_config() {
check_required() {
type hostname &> /dev/null || { echo "Requiring 'hostname' but it's not installed"; exit 1; }
type mailx &> /dev/null || { echo "Requiring 'mailx' but it's not installed"; exit 1; }
type df &> /dev/null || { echo "Requiring 'df' but it's not installed"; exit 1; }
}
# apply defaults
DISK_SPACE_ALERT_MAIL_ADDRESS="";
DISK_SPACE_ALERT_THRESHOLD=93
DISK_SPACE_ALERT_MOUNTPOINTS=("/")
@ -69,8 +67,11 @@ do
CURRENT_INODES=$(df -i "$point" | grep "$point" | awk '{ print $5}' | sed 's/%//g')
if [ "$CURRENT" -gt "$DISK_SPACE_ALERT_THRESHOLD" ] ; then
mailx -s "[disk $HOSTNAME] $point" "$DISK_SPACE_ALERT_MAIL_ADDRESS" << EOF
SUBJECT="[disk $HOSTNAME] $point"
MESSAGE=$(cat <<EOF
Your $point partition remaining free space is critically low. Used space: $CURRENT_SPACE%. Used inodes: $CURRENT_INODES%.
EOF
fi
)
notifier "${SUBJECT}" "${MESSAGE}"
fi
done

View file

@ -47,15 +47,12 @@ source_config() {
check_required() {
type hostname &> /dev/null || { echo "Requiring 'hostname' but it's not installed"; exit 1; }
type mailx &> /dev/null || { echo "Requiring 'mailx' but it's not installed"; exit 1; }
type docker &> /dev/null || { echo "Requiring 'docker' but it's not installed"; exit 1; }
}
DOCKER_CHECK_LIST_FILE="$HOME/.docker_check.list"
DOCKER_CHECK_GLOBAL_LIST_FILE="/etc/docker_check.list"
DOCKER_CHECK_NOTIFY_LEVELS=("UNKNOWN" "WARNING" "CRITICAL")
DOCKER_CHECK_MAIL_ENABLED=false
DOCKER_CHECK_MAIL_ADDRESS=""
CONTAINERS=()
source_config "$HOME/.docker_check.conf" "/etc/docker_check.conf"
@ -97,7 +94,7 @@ function shouldLog() {
echo false;
}
# log and send mail if enabled
# log
function log() {
local CONTAINER=$1;
local STATUS=$2;
@ -108,10 +105,7 @@ function log() {
if [ "$SHOULD_LOG" = "true" ]; then
local SUBJECT="[docker $HOSTNAME] $STATUS $CONTAINER";
echo "$SUBJECT: $MESSAGE";
if [ "$DOCKER_CHECK_MAIL_ENABLED" = true ]; then
echo "$MESSAGE"|mailx -Ssendwait -s "$SUBJECT" "$DOCKER_CHECK_MAIL_ADDRESS";
fi
notifier "${SUBJECT}" "${MESSAGE}"
fi
}

View file

@ -45,12 +45,6 @@ source_config() {
}
apply_defaults() {
if [ -z "${DYNV6_MAIL_ENABLED}" ]; then
DYNV6_MAIL_ENABLED=false;
fi
if [ -z "${DYNV6_MAIL_ADDRESS}" ]; then
DYNV6_MAIL_ADDRESS="";
fi
if [ -z "${DYNV6_TOKEN}" ]; then
DYNV6_TOKEN="";
fi
@ -79,7 +73,6 @@ check_required() {
fi
type hostname &> /dev/null || { echo "Requiring 'hostname' but it's not installed"; exit 1; }
type mailx &> /dev/null || { echo "Requiring 'mailx' but it's not installed"; exit 1; }
type ip &> /dev/null || { echo "Requiring 'ip' but it's not installed"; exit 1; }
type grep &> /dev/null || { echo "Requiring 'grep' but it's not installed"; exit 1; }
type curl &> /dev/null || { echo "Requiring 'curl' but it's not installed"; exit 1; }
@ -123,10 +116,10 @@ if [ "${DYNV6_IPV6_ENABLED}" = "true" ]; then
ipv6Changed=false;
fi
if [ "${ipv6Changed}" = "true" ]; then
if [ "${DYNV6_MAIL_ENABLED}" = "true" ]; then
HOSTMACHINE=$(hostname)
echo -e "IPv6 for ${hostname} on host ${HOSTMACHINE} changed to ${ipv6Address}" | mailx -s "[dynv6 IPv6 ${HOSTMACHINE}] IPv6 changed for ${hostname}" "${DYNV6_MAIL_ADDRESS}"
fi
SUBJECT="[dynv6 IPv6 ${HOSTMACHINE}] IPv6 changed for ${hostname}"
MESSAGE="IPv6 for ${hostname} on host ${HOSTMACHINE} changed to ${ipv6Address}"
notifier "${SUBJECT}" "${MESSAGE}"
fi
fi
fi
@ -143,9 +136,9 @@ if [ "${DYNV6_IPV4_ENABLED}" = "true" ]; then
if [ "${ipv4Changed}" = "true" ]; then
echo "IPv4 changed"
if [ "${DYNV6_MAIL_ENABLED}" = "true" ]; then
HOSTMACHINE=$(hostname)
echo -e "IPv4 for ${hostname} on host ${HOSTMACHINE} changed to ${ipv4Address}" | mailx -s "[dynv6 IPv4 ${HOSTMACHINE}] IPv4 changed for ${hostname}" "${DYNV6_MAIL_ADDRESS}"
fi
HOSTMACHINE=$(hostname)
SUBJECT="[dynv6 IPv4 ${HOSTMACHINE}] IPv4 changed for ${hostname}"
MESSAGE="IPv4 for ${hostname} on host ${HOSTMACHINE} changed to ${ipv4Address}"
notifier "${SUBJECT}" "${MESSAGE}"
fi
fi

View file

@ -5,7 +5,7 @@ usage() {
USAGE=$(cat <<EOF
Usage: memory_usage_alert
Checks available memory and sends out notification via mail. Please see man memory_usage_alert.
Checks available memory and notifies. Please see man memory_usage_alert.
EOF
)
echo "$USAGE";
@ -47,11 +47,9 @@ source_config() {
check_required() {
type hostname &> /dev/null || { echo "Requiring 'hostname' but it's not installed"; exit 1; }
type mailx &> /dev/null || { echo "Requiring 'mailx' but it's not installed"; exit 1; }
type free &> /dev/null || { echo "Requiring 'free' but it's not installed"; exit 1; }
}
MEMORY_USAGE_ALERT_MAIL_ADDRESS="";
MEMORY_USAGE_ALERT_THRESHOLD=512;
source_config "$HOME/.memory_usage_alert.conf" "/etc/memory_usage_alert.conf"
@ -67,10 +65,11 @@ used=$(free -mt | grep Total | awk '{print $3}')
free=$(($total-$used))
if [[ "$free" -le $MEMORY_USAGE_ALERT_THRESHOLD ]]; then
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head >/tmp/top_proccesses_consuming_memory.txt
file=/tmp/top_proccesses_consuming_memory.txt
echo -e "Memory on $HOSTNAME is running low ($MEMORY_USAGE_ALERT_THRESHOLD MB is the remaining threshold)!\n\nFree memory: $free MB" | mailx -a "$file" -s "$SUBJECT" "$MEMORY_USAGE_ALERT_MAIL_ADDRESS"
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head >/tmp/top_proccesses_consuming_memory.txt
file=/tmp/top_proccesses_consuming_memory.txt
fileContents=$(cat ${file})
MESSAGE=$(echo -e "Memory on $HOSTNAME is running low ($MEMORY_USAGE_ALERT_THRESHOLD MB is the remaining threshold)!\n\nFree memory: $free MB\n\n${fileContents}")
notifier "${SUBJECT}" "${MESSAGE}"
fi
exit 0

View file

@ -47,11 +47,9 @@ source_config() {
check_required() {
type hostname &> /dev/null || { echo "Requiring 'hostname' but it's not installed"; exit 1; }
type mailx &> /dev/null || { echo "Requiring 'mailx' but it's not installed"; exit 1; }
type smartctl &> /dev/null || { echo "Requiring 'smartctl' but it's not installed"; exit 1; }
}
SMARTCTL_TESTS_LONG_MAIL_ADDRESS="";
SMARTCTL_TESTS_LONG_DEVICES=(sda)
source_config "$HOME/.smartctl_tests_long.conf" "/etc/smartctl_tests_long.conf"
@ -65,8 +63,8 @@ for d in "${SMARTCTL_TESTS_LONG_DEVICES[@]}"; do
DEVICE="/dev/$d";
echo "$DEVICE";
smartctl -t long "$DEVICE";
mailx -s "[smartd $HOSTNAME] queued long test" "$SMARTCTL_TESTS_LONG_MAIL_ADDRESS" << EOF
Queued a smartd long test for $DEVICE.
EOF
SUBJECT="[smartd $HOSTNAME] queued long test"
MESSAGE="Queued a smartd long test for $DEVICE."
notifier "${SUBJECT}" "${MESSAGE}"
done

View file

@ -2,12 +2,14 @@
check_required() {
type hostname &> /dev/null || { echo "Requiring 'hostname' but it's not installed"; exit 1; }
type mailx &> /dev/null || { echo "Requiring 'mailx' but it's not installed"; exit 1; }
type wall &> /dev/null || { echo "Requiring 'wall' but it's not installed"; exit 1; }
}
check_required
HOSTNAME=$(hostname)
echo "$SMARTD_MESSAGE" | mail -s "[smartd $HOSTNAME] $SMARTD_FAILTYPE" "$SMARTD_ADDRESS"
SUBJECT="[smartd $HOSTNAME] $SMARTD_FAILTYPE"
MESSAGE=$(echo -e "$SMARTD_MESSAGE")
notifier "${SUBJECT}" "${MESSAGE}"
wall "$SMARTD_MESSAGE"

View file

@ -48,15 +48,12 @@ source_config() {
check_required() {
type hostname &> /dev/null || { echo "Requiring 'hostname' but it's not installed"; exit 1; }
type mailx &> /dev/null || { echo "Requiring 'mailx' but it's not installed"; exit 1; }
type whoami &> /dev/null || { echo "Requiring 'whoami' but it's not installed"; exit 1; }
type systemctl &> /dev/null || { echo "Requiring 'systemctl' but it's not installed"; exit 1; }
}
SYSTEMD_CHECK_LIST_FILE="$HOME/.systemd_check.list"
SYSTEMD_CHECK_GLOBAL_LIST_FILE="/etc/systemd_check.list"
SYSTEMD_CHECK_MAIL_ENABLED=fase
SYSTEMD_CHECK_MAIL_ADDRESS=""
SYSTEMD_CHECK_SERVICES=()
source_config "$HOME/.systemd_check.conf" "/etc/systemd_check.conf"
@ -110,10 +107,7 @@ function checkService() {
if [ "$RESULT" -gt 0 ]; then
local SUBJECT="[systemd $SYSTEMD_CHECK_HOSTNAME for $SYSTEMD_CHECK_USER] CRITICAL $SERVICE";
echo "-> $SUBJECT: $MESSAGE";
if [ "$SYSTEMD_CHECK_MAIL_ENABLED" = true ]; then
echo "$MESSAGE"|mailx -Ssendwait -s "$SUBJECT" "$SYSTEMD_CHECK_MAIL_ADDRESS";
fi
notifier "${SUBJECT}" "${MESSAGE}";
fi
return;

View file

@ -21,10 +21,6 @@ if [ -z "$SYSTEMD_FAILURE_NOTIFY_SERVICE" ]; then
exit 1;
fi
SYSTEMD_FAILURE_NOTIFY_MAIL_ENABLED="true";
SYSTEMD_FAILURE_NOTIFY_MAIL_ADDRESS="";
SYSTEMD_FAILURE_NOTIFY_GOTIFY_ENABLED="false";
# check for config file
apply_config() {
local config=$1;
@ -43,18 +39,6 @@ apply_config() {
}
check_requirements() {
local mailEnabled=$1;
local gotifyEnabled=$2;
if [[ "${mailEnabled}" == "true" ]]; then
type mailx &> /dev/null || { echo "Requiring 'mailx' but it's not installed"; exit 1; }
fi
if [[ "${gotifyEnabled}" == "true" ]]; then
type gotify &> /dev/null || { echo "Requiring 'gotify' but it's not installed"; exit 1; }
fi
type whoami &> /dev/null || { echo "Requiring 'whoami' but it's not installed"; exit 1; }
}
@ -73,7 +57,7 @@ source_config() {
fi
}
source_config "$HOME/.systemd_failure_notify.conf" "/etc/systemd_failure_notify.conf"
check_requirements "$SYSTEMD_FAILURE_NOTIFY_MAIL_ENABLED" "$SYSTEMD_FAILURE_NOTIFY_GOTIFY_ENABLED"
check_requirements
SYSTEMD_FAILURE_NOTIFY_HOSTNAME=$(hostname)
SYSTEMD_FAILURE_NOTIFY_USER=$(whoami)
@ -81,22 +65,4 @@ SYSTEMD_FAILURE_NOTIFY_USER=$(whoami)
SUBJECT="[systemd $SYSTEMD_FAILURE_NOTIFY_HOSTNAME for $SYSTEMD_FAILURE_NOTIFY_USER] $SYSTEMD_FAILURE_NOTIFY_USER RUN FAILED"
MESSAGE="$SYSTEMD_FAILURE_NOTIFY_SERVICE run failed"
if [[ "${SYSTEMD_FAILURE_NOTIFY_MAIL_ENABLED}" == "true" ]]; then
echo "$MESSAGE"|mailx -Ssendwait -s "$SUBJECT" "$SYSTEMD_FAILURE_NOTIFY_MAIL_ADDRESS";
echo "Sent notifiction via mail"
else
echo "Sending notifictions via mail is disabled"
fi
if [[ "${SYSTEMD_FAILURE_NOTIFY_GOTIFY_ENABLED}" == "true" ]]; then
if [[ ! -f "${HOME}/.config/gotify/cli.json" && ! -f "${HOME}/gotify/cli.json" && ! -f "./cli.json" && ! -f "/etc/gotify/cli.json" ]]; then
echo "Cannot find a valid cli.json, please run 'gotify init' before using this"
exit 1;
fi
echo "$MESSAGE"|gotify push --quiet --title "${SUBJECT}";
echo "Sent message via gotify"
else
echo "Sending notifictions via gotify is disabled"
fi
notifier "${SUBJECT}" "${MESSAGE}"

View file

@ -1,2 +1,3 @@
#!/usr/bin/env bash
CHECKUPDATES_MAIL_ADDRESS="alias@domain.tld"
#CHECK_UPDATES_UPDATES_CMD="/usr/bin/checkupdates"
#CHECK_UPDATES_UPDATES_AMOUNT_CMD="/usr/bin/checkupdates | wc -l"

View file

@ -1,4 +1,3 @@
#!/usr/bin/env bash
DISK_SPACE_ALERT_MAIL_ADDRESS="alias@domain.tld"
DISK_SPACE_ALERT_THRESHOLD=99
DISK_SPACE_ALERT_MOUNTPOINTS=("/", "/home")

View file

@ -1,5 +1,3 @@
#!/usr/bin/env bash
DOCKER_CHECK_LIST_FILE="/root/other/directory/prefix_docker_check.list"
DOCKER_CHECK_NOTIFY_LEVELS=("UNKNOWN" "WARNING" "CRITICAL")
DOCKER_CHECK_MAIL_ENABLED=true
DOCKER_CHECK_MAIL_ADDRESS="alias@domain.tld"
DOCKER_CHECK_NOTIFY_LEVELS=("UNKNOWN" "WARNING" "CRITICAL")

View file

@ -1,6 +1,4 @@
#!/usr/bin/env bash
DYNV6_MAIL_ENABLED="false" # if notify via mail
DYNV6_MAIL_ADDRESS="" # (optional) mail.rc has to be configured
DYNV6_TOKEN="" # the dynv6 token
DYNV6_HOSTNAME="" # the dynv6 hostname
DYNV6_IPV4_ENABLED=true # if should update ipv4

View file

@ -1,3 +1,2 @@
#!/usr/bin/env bash
MEMORY_USAGE_ALERT_MAIL_ADDRESS="alias@domain.tld"
MEMORY_USAGE_ALERT_THRESHOLD=512

View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash
NOTIFIER_MAIL_ADDRESS=test@domain.tld
NOTIFIER_MAIL_ENABLED=true
NOTIFIER_GOTIFY_ENABLED=true
NOTIFIER_GOTIFY_ENABLED=false

View file

@ -12,3 +12,6 @@ echo -e "$STATS\n\n$SNAPSHOTS"
# output for mail
me="$0"
echo -e "$STATS\n\n$SNAPSHOTS" | mailx -Ssendwait -s "[restic - $(hostname)] $me - REPORT" "${RESTIC_REPORT_MAIL}"
# or
# notifier "[restic - $(hostname)] $me - REPORT" "$(echo -e "$STATS\n\n$SNAPSHOTS" )"

View file

@ -1,3 +1,2 @@
#!/usr/bin/env bash
SMARTCTL_TESTS_LONG_MAIL_ADDRESS="alias@domain.tld"
SMARTCTL_TESTS_LONG_DEVICES=(sda sdb)

View file

@ -1,4 +1,2 @@
#!/usr/bin/env bash
SYSTEMD_CHECK_MAIL_ENABLED=true
SYSTEMD_CHECK_MAIL_ADDRESS="alias@domain.tld"
SYSTEMD_CHECK_LIST_FILE="$HOME/.systemd_check.list"

View file

@ -1,2 +1 @@
#!/usr/bin/env bash
SYSTEMD_FAILURE_NOTIFY_MAIL_ADDRESS="alias@domain.tld"
#!/usr/bin/env bash

View file

@ -30,7 +30,7 @@ It\[cq]s part of \f[B]system-helpers\f[R].
.SH DESCRIPTION
.PP
\f[B]check_updates\f[R] checks for available updates using
\f[I]checkupdates\f[R] and sends out a mail.
\f[I]checkupdates\f[R] (which can be customized) and notifies.
It comes with systemd services.
.PP
By default, \f[B]check_updates\f[R] tries to read from
@ -39,27 +39,30 @@ By default, \f[B]check_updates\f[R] tries to read from
It will exit with a non-zero exit code if it cannot find a proper
configuration file.
.PP
The following are at least required for the script to work:
The following can be modified if defaults don\[cq]t apply:
.PD 0
.P
.PD
- \f[B]CHECK_UPDATES_MAIL_ADDRESS=\[lq]\[lq]\f[R] which requires
\f[I]mail.rc\f[R] to be configured and `\f[I]mailx\f[R]' command has be
available.
- \f[B]CHECK_UPDATES_UPDATES_CMD\f[R] is the command for retrieving
which updates are available, by default it\[cq]s set to
\f[I]/usr/bin/checkupdates\f[R] (Arch Linux default).
.PD 0
.P
.PD
- \f[B]CHECK_UPDATES_UPDATES_AMOUNT_CMD\f[R] is the command used to
determine the amount of updates, by default it\[cq]s set to
\f[I]/usr/bin/checkupdates | wc -l\f[R] (Arch Linux default).
.PD 0
.P
.PD
.PP
You can copy this script to \f[I]/usr/local/bin\f[R] and use create a
custom \f[B]CONFIG_FILE\f[R] as user.
.SH EXAMPLE
.PP
Create a \f[I]$HOME/.check_updates.conf\f[R] and add
\f[I]CHECK_UPDATES_MAIL_ADDRESS=\[lq]alias\[at]domain.tld\[rq]\f[R].
Notifications will be delivered to alias\[at]domain.tld.
\f[I]CHECK_UPDATES_UPDATES_CMD=\[lq]\&...\[rq]\f[R].
Notifications will be delivered via \f[B]notifier\f[R].
Examples can be found in \f[I]/usr/share/doc/check_updates\f[R].
.SH EXIT VALUES
.TP
@ -68,5 +71,8 @@ Success
.TP
\f[B]1\f[R]
Error
.SH SEE ALSO
.PP
\f[B]notifier\f[R] - used as notification application
.SH AUTHORS
Alexander Sch\[:a]ferdiek.

View file

@ -18,8 +18,7 @@
.hy
.SH NAME
.PP
disk_space_alert - Checks available disk space and sends out
notification via mail.
disk_space_alert - Checks available disk space and notifies.
Configuration is done in environment files.
.PD 0
.P
@ -31,7 +30,7 @@ It\[cq]s part of \f[B]system-helpers\f[R].
.SH DESCRIPTION
.PP
\f[B]disk_space_alert\f[R] checks available diskspace for configured
\f[B]mounts\f[R] and sends out a mail if certain limits are reached.
\f[B]mounts\f[R] and notifies if certain limits are reached.
It comes with systemd services.
.PP
By default, \f[B]disk_space_alert\f[R] tries to read from
@ -40,29 +39,27 @@ By default, \f[B]disk_space_alert\f[R] tries to read from
It will exit with a non-zero exit code if it cannot find a proper
configuration file.
.PP
The following are at least required for the script to work:
The following can be customized:
.PD 0
.P
.PD
- \f[B]DISK_SPACE_ALERT_MAIL_ADDRESS=\[lq]\[lq]\f[R] which requires
\f[I]mail.rc\f[R] to be configured and `\f[I]mailx\f[R]' command has be
available.
- \f[B]DISK_SPACE_ALERT_THRESHOLD=93\f[R] in percentage.
.PD 0
.P
.PD
- \f[B]DISK_SPACE_ALERT_MOUNTPOINTS=(\[lq]/\[rq])\f[R] is an array of
mountpoints.
.PD 0
.P
.PD
.PP
The following are optional or have reasonable defaults: -
\f[B]DISK_SPACE_ALERT_THRESHOLD=93\f[R] in percentage -
\f[B]DISK_SPACE_ALERT_MOUNTPOINTS=(\[lq]/\[rq])\f[R] is an array of
mountpoints
.PP
You can copy this script to \f[I]/usr/local/bin\f[R] and use create a
custom \f[B]CONFIG_FILE\f[R] as user.
.SH EXAMPLE
.PP
Create a \f[I]$HOME/.disk_space_alert.conf\f[R] and add
\f[I]DISK_SPACE_ALERT_MAIL_ADDRESS=\[lq]alias\[at]domain.tld\[rq]\f[R].
Notifications will be delivered to alias\[at]domain.tld.
\f[I]DISK_SPACE_ALERT_THRESHOLD=\[lq]95\[rq]\f[R].
Notifications will be delivered via \f[B]notifier\f[R].
Examples can be found in \f[I]/usr/share/doc/disk_space_alert\f[R].
.SH EXIT VALUES
.TP
@ -71,5 +68,8 @@ Success
.TP
\f[B]1\f[R]
Error
.SH SEE ALSO
.PP
\f[B]notifier\f[R] - used as notification application
.SH AUTHORS
Alexander Sch\[:a]ferdiek.

View file

@ -40,13 +40,7 @@ for configuration.
It will exit with a non-zero exit code if it cannot find a proper
configuration file.
.PP
The following are at least required for the script to work:
.PD 0
.P
.PD
- \f[B]DOCKER_CHECK_MAIL_ADDRESS=\[lq]\[lq]\f[R] which requires
\f[I]mail.rc\f[R] to be configured and `\f[I]mailx\f[R]' command has be
available.
The following can be customized:
.PD 0
.P
.PD
@ -59,22 +53,20 @@ containers piped into the file: \f[I]docker ps \[en]format `{{.Names}}'
.P
.PD
- \f[B]DOCKER_CHECK_NOTIFY_LEVELS=(\[lq]UNKNOWN\[rq] \[lq]WARNING\[rq]
\[lq]CRITICAL\[rq])\f[R] determines when to notify/output/send mail.
\[lq]CRITICAL\[rq])\f[R] determines when to notify/output.
Possible: \f[I]\[lq]UNKNOWN\[rq]\f[R] \f[I]\[lq]WARNING\[rq]\f[R]
\f[I]\[lq]CRITICAL\[rq]\f[R] \f[I]\[lq]INFO\[rq]\f[R].
.PD 0
.P
.PD
- \f[B]DOCKER_CHECK_MAIL_ENABLED=false\f[R] enables or disables sending
mail notifications.
.PP
You can copy this script to \f[I]/usr/local/bin\f[R] and use create a
custom \f[B]CONFIG_FILE\f[R] as user.
.SH EXAMPLE
.PP
Create a \f[I]$HOME/.docker_check.conf\f[R] and add
\f[I]DOCKER_CHECK_MAIL_ADDRESS=\[lq]alias\[at]domain.tld\[rq]\f[R].
Notifications will be delivered to alias\[at]domain.tld.
\f[I]DOCKER_CHECK_NOTIFY_LEVELS=\[lq](WARNING)\[rq]\f[R].
Notifications will be delivered via \f[B]notifier\f[R].
Examples can be found in \f[I]/usr/share/doc/docker_check\f[R].
.SH EXIT VALUES
.TP
@ -83,5 +75,8 @@ Success
.TP
\f[B]1\f[R]
Error
.SH SEE ALSO
.PP
\f[B]notifier\f[R] - used as notification application
.SH AUTHORS
Alexander Sch\[:a]ferdiek.

View file

@ -77,7 +77,10 @@ default update command executed for each deployment.
.P
.PD
- \f[B]DOCKER_COMPOSE_UPDATE_FAIL_ON_UPDATE_ERROR=\[lq]false\[rq]\f[R]
determines if script fails if at least one update procedure failed
determines if script fails if at least one update procedure failed.
.PD 0
.P
.PD
.PP
You can copy this script to \f[I]/usr/local/bin\f[R] and use create a
custom \f[B]CONFIG_FILE\f[R] as user.

View file

@ -40,13 +40,7 @@ configuration.
It will exit with a non-zero exit code if it cannot find a proper
configuration file.
.PP
The following are at least required for the script to work:
.PD 0
.P
.PD
- \f[B]DYNV6_MAIL_ENABLED\f[R] to enable or disable mail notification.
- \f[B]DYNV6_MAIL_ADDRESS\f[R] which requires \f[I]mail.rc\f[R] to be
configured and `\f[I]mailx\f[R]' command has be available.
The following can be customized:
.PD 0
.P
.PD
@ -77,8 +71,8 @@ custom \f[B]CONFIG_FILE\f[R] as user.
.SH EXAMPLE
.PP
Create a \f[I]$HOME/.dynv6.conf\f[R] and add
\f[I]DYNV6_MAIL_ADDRESS=\[lq]alias\[at]domain.tld\[rq]\f[R].
Notifications will be delivered to alias\[at]domain.tld.
\f[I]DYNV6_TOKEN=\[lq]mySecretToken\[rq]\f[R].
Notifications will be delivered via \f[B]notifier\f[R].
Examples can be found in \f[I]/usr/share/doc/dynv6\f[R].
.SH EXIT VALUES
.TP
@ -87,5 +81,8 @@ Success
.TP
\f[B]1\f[R]
Error
.SH SEE ALSO
.PP
\f[B]notifier\f[R] - used as notification application
.SH AUTHORS
Alexander Sch\[:a]ferdiek.

View file

@ -18,8 +18,8 @@
.hy
.SH NAME
.PP
memory_usage_alert - Checks available memory and sends out notification
via mail.
memory_usage_alert - Checks available memory and sends out
notifications.
Configuration is done in environment files.
.PD 0
.P
@ -30,8 +30,8 @@ It\[cq]s part of \f[B]system-helpers\f[R].
\f[B]memory_usage_alert\f[R]
.SH DESCRIPTION
.PP
\f[B]memory_usage_alert\f[R] checks available memory and sends out a
mail if certain limits are reached.
\f[B]memory_usage_alert\f[R] checks available memory and sends
notifications if certain limits are reached.
It comes with systemd services.
.PP
By default, \f[B]memory_usage_alert\f[R] tries to read from
@ -40,17 +40,6 @@ By default, \f[B]memory_usage_alert\f[R] tries to read from
It will exit with a non-zero exit code if it cannot find a proper
configuration file.
.PP
The following are at least required for the script to work:
.PD 0
.P
.PD
- \f[B]MEMORY_USAGE_ALERT_MAIL_ADDRESS=\[lq]\[lq]\f[R] which requires
\f[I]mail.rc\f[R] to be configured and `\f[I]mailx\f[R]' command has be
available.
.PD 0
.P
.PD
.PP
The following are optional or have reasonable defaults: -
\f[B]MEMORY_USAGE_ALERT_THRESHOLD=512\f[R] threshold to warn about (in
\f[I]megabytes\f[R])
@ -60,8 +49,8 @@ custom \f[B]CONFIG_FILE\f[R] as user.
.SH EXAMPLE
.PP
Create a \f[I]$HOME/.memory_usage_alert.conf\f[R] and add
\f[I]MEMORY_USAGE_ALERT_MAIL_ADDRESS=\[lq]alias\[at]domain.tld\[rq]\f[R].
Notifications will be delivered to alias\[at]domain.tld.
\f[I]MEMORY_USAGE_ALERT_THRESHOLD=\[lq]1024\[rq]\f[R].
Notifications will be delivered via \f[B]notifier\f[R].
Examples can be found in \f[I]/usr/share/doc/memory_usage_alert\f[R].
.SH EXIT VALUES
.TP
@ -70,5 +59,8 @@ Success
.TP
\f[B]1\f[R]
Error
.SH SEE ALSO
.PP
\f[B]notifier\f[R] - used as notification application
.SH AUTHORS
Alexander Sch\[:a]ferdiek.

View file

@ -62,7 +62,8 @@ custom \f[B]CONFIG_FILE\f[R] as user.
.PP
Create a \f[I]$HOME/.notifier.conf\f[R] and add
\f[I]NOTIFIER_MAIL_ADDRESS=\[lq]alias\[at]domain.tld\[rq]\f[R].
Notifications will be delivered to alias\[at]domain.tld.
Notifications will be delivered to alias\[at]domain.tld or via gotify if
enabled.
Examples can be found in \f[I]/usr/share/doc/notifier\f[R].
.SH EXIT VALUES
.TP
@ -73,6 +74,6 @@ Success
Error
.SH SEE ALSO
.PP
system-helpers
\f[B]system-helpers\f[R]
.SH AUTHORS
Alexander Sch\[:a]ferdiek.

View file

@ -30,7 +30,7 @@ It\[cq]s part of \f[B]system-helpers\f[R].
.SH DESCRIPTION
.PP
\f[B]smart_tests_long\f[R] checks for available updates using
\f[I]smartctl\f[R] and sends out a mail.
\f[I]smartctl\f[R] and notifies.
It comes with systemd services.
.PP
By default, \f[B]smart_tests_long\f[R] tries to read from
@ -39,13 +39,10 @@ By default, \f[B]smart_tests_long\f[R] tries to read from
It will exit with a non-zero exit code if it cannot find a proper
configuration file.
.PP
The following are at least required for the script to work:
The following can be customized:
.PD 0
.P
.PD
- \f[B]SMARTCTL_TESTS_LONG_MAIL_ADDRESS=\[lq]\[lq]\f[R] which requires
\f[I]mail.rc\f[R] to be configured and `\f[I]mailx\f[R]' command has be
available.
- \f[B]SMARTCTL_TESTS_LONG_DEVICES=(sda)\f[R] array of block devices
(not partitions!)
to check.
@ -55,9 +52,9 @@ custom \f[B]CONFIG_FILE\f[R] as user.
.SH EXAMPLE
.PP
Create a \f[I]$HOME/.smartctl_tests_long.conf\f[R] and add
\f[I]SMARTCTL_TESTS_LONG_MAIL_ADDRESS=\[lq]alias\[at]domain.tld\[rq]\f[R].
Notifications will be delivered to alias\[at]domain.tld for default
block device \f[B]sda\f[R].
\f[I]SMARTCTL_TESTS_LONG_DEVICES=\[lq](nvme1 sdc sdf)\[rq]\f[R].
Notifications will be delivered via \f[B]notifier\f[R] for default block
device \f[B]sda\f[R].
Examples can be found in \f[I]/usr/share/doc/smart_tests_long\f[R].
.SH EXIT VALUES
.TP
@ -66,5 +63,8 @@ Success
.TP
\f[B]1\f[R]
Error
.SH SEE ALSO
.PP
\f[B]notifier\f[R] - used as notification application
.SH AUTHORS
Alexander Sch\[:a]ferdiek.

View file

@ -50,8 +50,9 @@ images
update check for pacman (ArchLinux specific, see \f[B]man
check_updates\f[R])
.PP
Provided systemd services mostly support mail notifications if they have
failed via \f[B]systemd_failure_notify\f[R].
Provided systemd services mostly support notifications if they have
failed via \f[B]systemd_failure_notify\f[R] which uses
\f[B]notifier\f[R] (see \f[B]man notifier\f[R]).
.PP
See \f[I]/usr/share/doc/system-helpers\f[R] for example configurations
which should be copied inside \f[B]$HOME\f[R] or \f[B]/etc\f[R]

View file

@ -40,7 +40,7 @@ By default, \f[B]systemd_check\f[R] tries to read from
It will exit with a non-zero exit code if it cannot find a proper
configuration file.
.PP
The following are at least required for the script to work:
The following can be customized:
.PD 0
.P
.PD
@ -50,22 +50,14 @@ by lines.
.PD 0
.P
.PD
- \f[B]SYSTEMD_CHECK_MAIL_ENABLED=false\f[R] enables or disables sending
mail notifications.
- \f[B]SYSTEMD_CHECK_MAIL_ADDRESS=\[lq]\[lq]\f[R] which requires
\f[I]mail.rc\f[R] to be configured and `\f[I]mailx\f[R]' command has be
available.
.PD 0
.P
.PD
.PP
You can copy this script to \f[I]/usr/local/bin\f[R] and use create a
custom \f[B]CONFIG_FILE\f[R] as user.
.SH EXAMPLE
.PP
Create a \f[I]$HOME/.systemd_check.conf\f[R] and add
\f[I]SYSTEMD_CHECK_MAIL_ADDRESS=\[lq]alias\[at]domain.tld\[rq]\f[R].
Notifications will be delivered to alias\[at]domain.tld.
\f[I]SYSTEMD_CHECK_LIST_FILE=\[lq]/other/path/to/list\[rq]\f[R].
Notifications will be delivered via \f[B]notifier\f[R].
Examples can be found in \f[I]/usr/share/doc/systemd_check\f[R].
.SH EXIT VALUES
.TP
@ -74,5 +66,8 @@ Success
.TP
\f[B]1\f[R]
Error
.SH SEE ALSO
.PP
\f[B]notifier\f[R] - used as notification application
.SH AUTHORS
Alexander Sch\[:a]ferdiek.

View file

@ -18,8 +18,7 @@
.hy
.SH NAME
.PP
systemd_failure_notify - Notifies via mail or gotify when a service has
failed.
systemd_failure_notify - Invokes when a systemd service has failed.
Configuration is done in environment files.
.PD 0
.P
@ -30,8 +29,7 @@ It\[cq]s part of \f[B]system-helpers\f[R].
\f[B]systemd_failure_notify\f[R] [SERVICE]
.SH DESCRIPTION
.PP
\f[B]systemd_failure_notify\f[R] executes \f[I]mailx\f[R] or
\f[I]gotify\f[R] to send out notifications.
\f[B]systemd_failure_notify\f[R] triggered when systemd services fail.
It comes with systemd services.
Use the provided systemd service in the \f[B]OnFailure\f[R] directive
with \f[I]OnFailure=systemd_failure_notify\[at]%n.service\f[R].
@ -42,37 +40,12 @@ By default, \f[B]systemd_failure_notify\f[R] tries to read from
It will exit with a non-zero exit code if it cannot find a proper
configuration file.
.PP
The following are at least required for the script to work:
.PD 0
.P
.PD
- \f[B]SYSTEMD_FAILURE_NOTIFY_MAIL_ADDRESS=\[lq]\[lq]\f[R] which
requires \f[I]mail.rc\f[R] to be configured and `\f[I]mailx\f[R]'
command has be available\[ac]
.PP
By default, \f[B]SYSTEMD_FAILURE_NOTIFY_MAIL_ENABLED\f[R] is set to
\f[B]true\f[R].
Set it to \f[B]false\f[R] to use \f[I]gotify\f[R] only.
.PD 0
.P
.PD
.PP
The following are optional and integrate gotify-cli to send
notifications, it defaults to false:
.PD 0
.P
.PD
- \f[B]SYSTEMD_FAILURE_NOTIFY_GOTIFY_ENABLED=\[lq]true\[rq]\f[R] uses
\f[I]gotify\f[R] command which has be available and needs to be properly
configured by having a cli.json file.
.PP
You can copy this script to \f[I]/usr/local/bin\f[R] and use create a
custom \f[B]CONFIG_FILE\f[R] as user.
.SH EXAMPLE
.PP
Create a \f[I]$HOME/.systemd_failure_notify.conf\f[R] and add
\f[I]SYSTEMD_FAILURE_NOTIFY_MAIL_ADDRESS=\[lq]alias\[at]domain.tld\[rq]\f[R].
Notifications will be delivered to alias\[at]domain.tld.
Create a \f[I]$HOME/.systemd_failure_notify.conf\f[R].
Notifications will be delivered via \f[B]notifier\f[R].
Examples can be found in
\f[I]/usr/share/doc/systemd_failure_notify\f[R].
.PP
@ -94,5 +67,8 @@ Success
.TP
\f[B]1\f[R]
Error
.SH SEE ALSO
.PP
\f[B]notifier\f[R] - used as notification application
.SH AUTHORS
Alexander Sch\[:a]ferdiek.