mirror of
https://github.com/mempool/mempool.git
synced 2024-11-19 01:41:01 +01:00
[ops] slack alerts from syslog errs
This commit is contained in:
parent
3b4eda432f
commit
5e8e1f3dee
@ -1089,6 +1089,7 @@ case $OS in
|
||||
echo "[*] Installing syslog configuration"
|
||||
osSudo "${ROOT_USER}" mkdir -p /usr/local/etc/syslog.d
|
||||
osSudo "${ROOT_USER}" install -c -m 755 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/mempool-logger" /usr/local/bin/mempool-logger
|
||||
osSudo "${ROOT_USER}" install -c -m 755 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/mempool-slacker" /usr/local/bin/mempool-slacker
|
||||
osSudo "${ROOT_USER}" install -c -m 644 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/syslog.conf" /usr/local/etc/syslog.d/mempool.conf
|
||||
|
||||
echo "[*] Installing redis configuration"
|
||||
|
19
production/mempool-slacker
Executable file
19
production/mempool-slacker
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -z "$SLACK_SYSLOG_WEBHOOK_URL" ]; then
|
||||
echo "Error: SLACK_SYSLOG_WEBHOOK_URL environment variable is not set" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
trap "" PIPE
|
||||
while read input; do
|
||||
if [ ! -z "${input}" ]; then
|
||||
escaped_input=$(echo "$input" | sed 's/"/\\"/g')
|
||||
curl -X POST \
|
||||
-H 'Content-type: application/json' \
|
||||
--data "{\"text\":\"\`\`\`${escaped_input}\`\`\`\"}" \
|
||||
-s \
|
||||
"$SLACK_SYSLOG_WEBHOOK_URL" \
|
||||
>/dev/null 2>&1 &
|
||||
fi
|
||||
done
|
@ -1,4 +1,4 @@
|
||||
local7.>=err |/usr/local/bin/sudo -u mempool /usr/local/bin/mempool-logger mempool.ops alerts
|
||||
local7.>=err |/usr/local/bin/sudo -u mempool /usr/local/bin/mempool-slacker
|
||||
local7.>=info |/usr/local/bin/sudo -u mempool /usr/local/bin/mempool-logger mempool.ops node100
|
||||
local7.>=info /var/log/mempool
|
||||
local7.* /var/log/mempool.debug
|
||||
|
Loading…
Reference in New Issue
Block a user