health/notifications: enforce Pushover API field length limits (#21882)
Co-authored-by: ilyam8 <22274335+ilyam8@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ilyam8 <ilya@netdata.cloud>
Copilot committed
Mar 4, 2026 at 11:07 UTC
daf58fb35c60f7bcb73235b8c7ffcb7f8289166f
1 file changed
+8
src/health/notifications/alarm-notify.sh.in
+8
@@ -1192,6 +1192,14 @@ send_pushover() {
1192
*) priority=-2 ;; # lowest priority: no notification at all
1193
esac
1194
1195
+ # Pushover API limits: title=250, message=1024, url=512, url_title=100
1196
+ # Use UTF-8 locale for truncation to avoid splitting multibyte characters
1197
+ local _lc="${LC_ALL}"; LC_ALL=C.UTF-8
1198
+ [ ${#title} -gt 250 ] && title="${title:0:247}..."
1199
+ [ ${#message} -gt 1024 ] && message="${message:0:1021}..."
1200
+ [ ${#url} -gt 512 ] && url=""
1201
+ LC_ALL="${_lc}"
1202
+
1203
for user in ${usertokens}; do
1204
httpcode=$(docurl \
1205
--form-string "token=${apptoken}" \