-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
57dafd4
commit bf1d9b9
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# Used by docker-compose | ||
DOCKER_PROJECT_NAME= | ||
ZABBIX_HOST_NAME= | ||
|
||
LDAP_LOG_LEVEL=0 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
ME=$(realpath $(dirname $0)) | ||
|
||
if [ ! -f $ME/.env ]; then | ||
echo "Missing env: $ME/.env" | ||
exit 1 | ||
fi | ||
|
||
# Load up .env | ||
set -o allexport | ||
# Source the file | ||
. $ME/.env | ||
set +o allexport | ||
|
||
CONTAINER_NAME="${DOCKER_PROJECT_NAME}-mailserver-1" | ||
|
||
# See: https://serverfault.com/a/577766/336084 | ||
for q in active bounce corrupt defer deferred flush hold incoming maildrop; do | ||
zabbix_sender -z $ZABBIX_HOST -s $ZABBIX_HOST_NAME -k "email-monitoring.servers.mx" -o "$(printf '{"data":[{"{#MX_HOST}":"%s", "{#QUEUE_NAME}":"%s"}]}' ${OVERRIDE_HOSTNAME} ${q})" 1>/dev/null | ||
done | ||
|
||
# See: https://serverfault.com/a/577766/336084 | ||
for q in active bounce corrupt defer deferred flush hold incoming maildrop; do | ||
count=$(docker exec $CONTAINER_NAME find /var/spool/postfix/$q ! -type d -print | wc -l) | ||
|
||
if [ ! -z "${1:-}" ]; then | ||
echo $q $count | ||
fi | ||
zabbix_sender -z $ZABBIX_HOST -s $ZABBIX_HOST_NAME -k "email-monitoring.servers.mx.queue[${OVERRIDE_HOSTNAME},$q]" -o "$count" 1>/dev/null | ||
done |