- netdata слал в бандл server, удалённый при переименовании в backups, и все health-алерты уходили в 404 - бандлы теперь рендерятся циклом: backups для отчётов backup-all.py, alerts для netdata
46 lines
1.3 KiB
Plaintext
46 lines
1.3 KiB
Plaintext
# Override stock health_alarm_notify.conf — route every alert to apprise.
|
|
# Stock conf is sourced first; this only sets what differs.
|
|
|
|
SEND_EMAIL="NO"
|
|
SEND_CUSTOM="YES"
|
|
DEFAULT_RECIPIENT_CUSTOM="alerts"
|
|
|
|
role_recipients_custom[sysadmin]="alerts"
|
|
role_recipients_custom[domainadmin]="alerts"
|
|
role_recipients_custom[dba]="alerts"
|
|
role_recipients_custom[webmaster]="alerts"
|
|
role_recipients_custom[proxyadmin]="alerts"
|
|
role_recipients_custom[silent]=""
|
|
|
|
custom_sender() {
|
|
local apprise_url="http://apprise:8000/notify/${1}/"
|
|
|
|
local notif_type="info"
|
|
case "${status}" in
|
|
CRITICAL) notif_type="failure" ;;
|
|
WARNING) notif_type="warning" ;;
|
|
CLEAR) notif_type="success" ;;
|
|
esac
|
|
|
|
local title="[${status}] ${name} on ${host}"
|
|
local body="${status_message}: ${alarm}
|
|
Chart: ${chart}
|
|
Value: ${value} ${units}
|
|
Info: ${info}
|
|
Raised for: ${raised_for}"
|
|
|
|
local httpcode
|
|
httpcode=$(docurl -X POST \
|
|
--data-urlencode "title=${title}" \
|
|
--data-urlencode "body=${body}" \
|
|
--data-urlencode "type=${notif_type}" \
|
|
"${apprise_url}")
|
|
|
|
if [ "${httpcode}" = "200" ]; then
|
|
info "sent custom notification for ${name} on ${host}"
|
|
return 0
|
|
fi
|
|
error "failed to send notification for ${name} on ${host} (HTTP ${httpcode})"
|
|
return 1
|
|
}
|