@cryptotaxi247 / netdata / commits / c321fbeaa

SIGNL4 Alert Notification (#20911)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Ilya Mashchenko <ilya@netdata.cloud>

Ron committed Sep 2, 2025 at 21:44 UTC c321fbeaa3c8f4f9f9b542e0c68eb81af65842f0
3 files changed +139 -3
src/health/notifications/alarm-notify.sh.in
+63 -3
@@ -504,6 +504,9 @@ GOTIFY_APP_TOKEN=
504 # opsgenie configs
505 OPSGENIE_API_KEY=
506
507 +# signl4 configs
508 +SIGNL4_WEBHOOK_URL=
509 +
510 # load the stock and user configuration files
511 # these will overwrite the variables above
512
@@ -780,6 +783,9 @@ fi
783 # check ilert
784 [ -z "${ILERT_ALERT_SOURCE_URL}" ] && SEND_ILERT="NO"
785
786 +# check signl4
787 +[ -z "${SIGNL4_WEBHOOK_URL}" ] && SEND_SIGNL4="NO"
788 +
789 # -----------------------------------------------------------------------------
790 # check the availability of targets
791
@@ -811,7 +817,8 @@ check_supported_targets() {
817 [ "${SEND_OPSGENIE}" = "YES" ] ||
818 [ "${SEND_GOTIFY}" = "YES" ] ||
819 [ "${SEND_NTFY}" = "YES" ] ||
814 - [ "${SEND_ILERT}" = "YES" ]; then
820 + [ "${SEND_ILERT}" = "YES" ] ||
821 + [ "${SEND_SIGNL4}" = "YES" ]; then
822 # if we need curl, check for the curl command
823 if [ -z "${curl}" ]; then
824 curl="$(command -v curl 2>/dev/null)"
@@ -843,6 +850,7 @@ check_supported_targets() {
850 SEND_GOTIFY="NO"
851 SEND_NTFY="NO"
852 SEND_ILERT="NO"
853 + SEND_SIGNL4="NO"
854 fi
855 fi
856
@@ -1000,7 +1008,8 @@ for method in "${SEND_EMAIL}" \
1008 "${SEND_OPSGENIE}" \
1009 "${SEND_GOTIFY}" \
1010 "${SEND_NTFY}" \
1003 - "${SEND_ILERT}" ; do
1011 + "${SEND_ILERT}" \
1012 + "${SEND_SIGNL4}" ; do
1013
1014 if [ "${method}" == "YES" ]; then
1015 proceed=1
@@ -2553,6 +2562,51 @@ EOF
2562 return 0
2563 }
2564
2565 +# -----------------------------------------------------------------------------
2566 +# signl4 sender
2567 +
2568 +send_signl4() {
2569 + local payload httpcode signl4_status
2570 + [ "${SEND_SIGNL4}" != "YES" ] && return 1
2571 +
2572 + signl4_status="new"
2573 + if [ "${status}" = "CLEAR" ]; then signl4_status="resolved"; fi
2574 +
2575 + payload=$(cat <<EOF
2576 + {
2577 + "title" : "${name}",
2578 + "message" : "${status_message}",
2579 + "alert_url" : "${goto_url}",
2580 + "alarm_id" : "${alarm_id}",
2581 + "chart" : "${chart}",
2582 + "date" : "${when}",
2583 + "duration" : "${duration_txt}",
2584 + "host" : "${host}",
2585 + "info" : "${info}",
2586 + "severity": "${status}",
2587 + "total_critical" : "${total_critical}",
2588 + "total_warnings" : "${total_warnings}",
2589 + "value" : "${value_string}",
2590 + "image_url": "${image}",
2591 + "src" : "${src}",
2592 + "X-S4-ExternalID" : "${unique_id}",
2593 + "X-S4-Status" : "${signl4_status}",
2594 + "X-S4-SourceSystem" : "Netdata"
2595 + }
2596 +EOF
2597 +)
2598 +
2599 + httpcode=$(docurl -X POST -H "Content-Type: application/json" -d "${payload}" "${SIGNL4_WEBHOOK_URL}")
2600 + if [ "${httpcode}" = "200" ] || [ "${httpcode}" = "201" ] || [ "${httpcode}" = "202" ]; then
2601 + info "sent signl4 event for ${notification_description}"
2602 + else
2603 + error "failed to send signl4 event for ${notification_description}, with HTTP response status code ${httpcode}."
2604 + return 1
2605 + fi
2606 +
2607 + return 0
2608 +}
2609 +
2610 # -----------------------------------------------------------------------------
2611 # prepare the content of the notification
2612
@@ -3740,6 +3794,11 @@ SENT_NTFY=$?
3794 send_ilert
3795 SENT_ILERT=$?
3796
3797 +# -----------------------------------------------------------------------------
3798 +# send messages to signl4
3799 +send_signl4
3800 +SENT_SIGNL4=$?
3801 +
3802 # -----------------------------------------------------------------------------
3803 # let netdata know
3804 for state in "${SENT_EMAIL}" \
@@ -3771,7 +3830,8 @@ for state in "${SENT_EMAIL}" \
3830 "${SENT_OPSGENIE}" \
3831 "${SENT_GOTIFY}" \
3832 "${SENT_NTFY}" \
3774 - "${SENT_ILERT}"; do
3833 + "${SENT_ILERT}" \
3834 + "${SENT_SIGNL4}"; do
3835 if [ "${state}" -eq 0 ]; then
3836 # we sent something
3837 exit 0
src/health/notifications/health_alarm_notify.conf
+21
@@ -885,6 +885,15 @@ ILERT_ALERT_SOURCE_URL=""
885
886 DEFAULT_RECIPIENT_ILERT=""
887
888 +#------------------------------------------------------------------------------
889 +# signl4 global notification options
890 +SEND_SIGNL4="YES"
891 +
892 +# Webhook URL
893 +SIGNL4_WEBHOOK_URL=""
894 +
895 +DEFAULT_RECIPIENT_SIGNL4=""
896 +
897 #------------------------------------------------------------------------------
898 # custom notifications
899 #
@@ -1029,6 +1038,8 @@ custom_sender() {
1038
1039 # role_recipients_ilert[sysadmin]="${DEFAULT_RECIPIENT_ILERT}"
1040
1041 +# role_recipients_signl4[sysadmin]="${DEFAULT_RECIPIENT_SIGNL4}"
1042 +
1043 # -----------------------------------------------------------------------------
1044 # DNS related alarms
1045
@@ -1090,6 +1101,8 @@ custom_sender() {
1101
1102 # role_recipients_ilert[domainadmin]="${DEFAULT_RECIPIENT_ILERT}"
1103
1104 +# role_recipients_signl4[domainadmin]="${DEFAULT_RECIPIENT_SIGNL4}"
1105 +
1106 # -----------------------------------------------------------------------------
1107 # database servers alarms
1108 # mysql, redis, memcached, postgres, etc
@@ -1152,6 +1165,8 @@ custom_sender() {
1165
1166 # role_recipients_ilert[dba]="databases ${DEFAULT_RECIPIENT_ILERT}"
1167
1168 +# role_recipients_signl4[dba]="databases ${DEFAULT_RECIPIENT_SIGNL4}"
1169 +
1170 # -----------------------------------------------------------------------------
1171 # web servers alarms
1172 # apache, nginx, lighttpd, etc
@@ -1214,6 +1229,8 @@ custom_sender() {
1229
1230 # role_recipients_ilert[webmaster]="${DEFAULT_RECIPIENT_ILERT}"
1231
1232 +# role_recipients_signl4[webmaster]="${DEFAULT_RECIPIENT_SIGNL4}"
1233 +
1234 # -----------------------------------------------------------------------------
1235 # proxy servers alarms
1236 # squid, etc
@@ -1276,6 +1293,8 @@ custom_sender() {
1293
1294 # role_recipients_ilert[proxyadmin]="${DEFAULT_RECIPIENT_ILERT}"
1295
1296 +# role_recipients_signl4[proxyadmin]="${DEFAULT_RECIPIENT_SIGNL4}"
1297 +
1298 # -----------------------------------------------------------------------------
1299 # peripheral devices
1300 # UPS, photovoltaics, etc
@@ -1335,3 +1354,5 @@ custom_sender() {
1354 # role_recipients_ntfy[sitemgr]="${DEFAULT_RECIPIENT_NTFY}"
1355
1356 # role_recipients_ilert[sitemgr]="${DEFAULT_RECIPIENT_ILERT}"
1357 +
1358 +# role_recipients_signl4[sitemgr]="${DEFAULT_RECIPIENT_SIGNL4}"
src/health/notifications/signl4/metadata.yaml new
+55
@@ -0,0 +1,55 @@
1 +# yamllint disable rule:line-length
2 +---
3 +- id: "notify-signl4"
4 + meta:
5 + name: "SIGNL4"
6 + link: "https://www.signl4.com/"
7 + categories:
8 + - notify.agent
9 + icon_filename: "signl4.svg"
10 + keywords:
11 + - signl4
12 + overview:
13 + notification_description: |
14 + SIGNL4 offers critical alerting, incident response and service dispatching for operating critical infrastructure. It alerts you persistently via app push, SMS text, voice calls, and email including tracking, escalation, on-call duty scheduling and collaboration.
15 + You can send notifications to SIGNL4 using Netdata's Agent alert notification feature, which supports dozens of endpoints, user roles, and more.
16 + notification_limitations: ""
17 + setup:
18 + prerequisites:
19 + list:
20 + - title: ""
21 + description: |
22 + - An inbound webhook in SIGNL4
23 + - Access to the terminal where Netdata Agent is running
24 + configuration:
25 + file:
26 + name: "health_alarm_notify.conf"
27 + options:
28 + description: "The following options can be defined for this notification"
29 + folding:
30 + title: "Config Options"
31 + enabled: true
32 + list:
33 + - name: "SEND_SIGNL4"
34 + default_value: 'YES'
35 + description: "Set `SEND_SIGNL4` to YES"
36 + required: true
37 + - name: 'SIGNL4_WEBHOOK_URL'
38 + default_value: ''
39 + description: "set `SIGNL4_WEBHOOK_URL` to your SIGNL4 webhook URL."
40 + required: true
41 + examples:
42 + folding:
43 + enabled: true
44 + title: ''
45 + list:
46 + - name: 'Basic Configuration'
47 + folding:
48 + enabled: false
49 + description: ''
50 + config: |
51 + SEND_SIGNL4="YES"
52 + SIGNL4_WEBHOOK_URL="https://connect.signl4.com/webhook/xxxxxxxx"
53 + troubleshooting:
54 + problems:
55 + list: []