X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;ds=sidebyside;f=v2%2Fsrc%2Fawk%2Fexe%2Factuate_alert_to_notify_send.awk;fp=v2%2Fsrc%2Fawk%2Fexe%2Factuate_alert_to_notify_send.awk;h=3cfbca0fb8dd269d4285f96d34be176754ea8fa7;hb=53d24ad688ea39892dbf3c748c1e40514eeb2763;hp=0000000000000000000000000000000000000000;hpb=0c4f892ec9d0cd7dc87c83c01b52259d0aed1ae3;p=khatus.git diff --git a/v2/src/awk/exe/actuate_alert_to_notify_send.awk b/v2/src/awk/exe/actuate_alert_to_notify_send.awk new file mode 100644 index 0000000..3cfbca0 --- /dev/null +++ b/v2/src/awk/exe/actuate_alert_to_notify_send.awk @@ -0,0 +1,29 @@ +BEGIN { + # Set the correct value as any other AWK variable: + # + # khatus_actuate_alert_to_notify_send -v Display="$CORRECT_DISPLAY" + # + Display = Display ? Display : ":0" +} + +{ + delete msg + msg_parse(msg, $0) +} + +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, msg["subject"], body \ + ) + system(cmd) + next +}