What, you mean NS8 wants configuration to deliver email notifications, but has no mechanism to actually send them?
And personal subscriptions don’t get alerts? We just get pointless alerts about swap being full when there is no swap? Is backup not important for non-business users?
The personal subscription already costs double what it did for NS7, and it seems like it provides less.
I’m not sure I understand the question. An application can obtain SMTP configuration as documented in SMTP smarthost | NS8 dev manual. I’m just wondering if a provided command could help developers avoid writing multiple similar SMTP-client scripts that perform the same function.
This will be fixed during the current milestone, 8.4.
Backup is a fundamental component of the system for every user. Whether a feature is available or not depends on many factors, with complexity being a key one. I don’t want to delve into paid plan tiers, but the point is that Nethesis portals already provide features we haven’t yet implemented in NS8 core—for example, alert logic, email message formatting and queue, and recipient configuration. In my opinion, it’s only a matter of time before NS8 core handles email sending on its own.
I’d think it probably would, I’m just surprised that it isn’t already there. I’d have expected that if there are configuration options for one or more[1] alert services, that there’d already be a function like send_alert($severity,$content) in the system.
more than just email would be great–e.g., Slack, Synapse, Telegram, generic web hook ↩︎
You are right, the monitoring stack has recently undergone a significant change and is now implemented with Prometheus + Alert Manager. Using a widespread monitoring stack should facilitate integration and customization development.
With a Subscription (if monitoring is included), emails are already sent by the Nethesis portal. Without a Subscription, a custom Prometheus configuration is needed, but it is still experimental. Please refer to https://github.com/NethServer/ns8-metrics.
As an alternative to checking /run/backup-monitor.dat, you could also try querying the Prometheus APIs. There’s plenty of documentation available, and it would be a good idea to write a Howto.
Also, if you just want a very simple notification on both success and error, I’ve created a little test script. Put it at /var/lib/nethserver/cluster/events/backup-status-changed/20notify.
#!/bin/bash
# Change the following variables to match your environment
MAIL_FROM="no-reply@nethserver.org"
MAIL_TO="giacomo@nethesis.it"
MAIL_SUBJECT="Backup status changed:"
MAIL_TEMPLATE="The backup status for {BACKUP_NAME} on {MODULE_ID} has changed to {STATUS}. Please check the system for details."
# WARNING - DO NOT EDIT BELOW THIS LINE (unless you know what you're doing)
# Redis command
rdb="redis-cli --raw"
# Read event data from stdin
read -r event_data
if ! echo "$event_data" | jq . >/dev/null 2>&1; then
echo "Failed to parse JSON input" >&2
exit 1
fi
# Extract necessary fields from event_data
module_id=$(echo "$event_data" | jq -r '.module_id')
backup_id=$(echo "$event_data" | jq -r '.backup_id')
leader_id=$($rdb hget cluster/environment NODE_ID)
self_id=$NODE_ID
if [[ "$self_id" != "$leader_id" ]]; then
exit 0 # LEADER ONLY! Do not run this procedure in worker nodes.
fi
backup_name=$($rdb hget "cluster/backup/$backup_id" "name")
errors=$($rdb hget "module/$module_id/backup_status/$backup_id" errors)
if [[ -z "$errors" ]]; then
echo "INFO: Status unknown, exiting." >&2
exit 0
fi
if [[ "$errors" == "0" ]]; then
status="SUCCESS"
else
status="FAIL"
fi
# Send email
subject="$backup_name ($module_id): $status"
msg="$(echo "$MAIL_TEMPLATE" | sed "s/{BACKUP_NAME}/$backup_name/g; s/{STATUS}/$status/g; s/{MODULE_ID}/$module_id/g")"
echo "$msg" | runagent ns8-sendmail -s "$subject" -f "$MAIL_FROM" "$MAIL_TO"
one more addition to the subscription plan, I use Nethserver exclusively at home for my private use.
An additional subscription plan for private use only, which includes monitoring, would be a good alternative. No tickets would have to be included at all, just unlock these additional functions.