X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=src%2Fawk%2Fexe%2Factuate_alert_to_notify_send.awk;h=3cfbca0fb8dd269d4285f96d34be176754ea8fa7;hb=03b7d2469c4f96d304ee710aec18d3941d7deae9;hp=eae5cb5f3e3776081877bcc213e54246db40c399;hpb=03c229bffd594c1facb72e0d042a88c0505c8dbc;p=khatus.git diff --git a/src/awk/exe/actuate_alert_to_notify_send.awk b/src/awk/exe/actuate_alert_to_notify_send.awk old mode 100755 new mode 100644 index eae5cb5..3cfbca0 --- a/src/awk/exe/actuate_alert_to_notify_send.awk +++ b/src/awk/exe/actuate_alert_to_notify_send.awk @@ -6,26 +6,23 @@ BEGIN { Display = Display ? Display : ":0" } -$1 == "OK" && \ -$2 == "alert" { - priority = $3 - subject = $4 - - # Not just using $5 for body - because body might contain a character - # identical to FS - len_line = length($0) - len_head = length($1 FS $2 FS $3 FS $4 FS $5 FS) - len_body = len_line - len_head - body = substr($0, len_head + 1, len_body) +{ + delete msg + msg_parse(msg, $0) +} - urgency = priority +msg["type"] == "alert" { + body = msg["body"] + sep = body ? "\n" : "" + body = body sep "--" msg["node"] ":" msg["module"] + urgency = msg["priority"] sub("hi" , "critical", urgency) sub("med", "normal" , urgency) cmd = \ sprintf(\ "DISPLAY=%s notify-send -u %s %s \" %s\"", - Display, urgency, subject, body \ + Display, urgency, msg["subject"], body \ ) system(cmd) next