define BUILD_AWK_EXE
echo '#! $(PATH_TO_AWK) -f' > $@ && \
+ echo 'BEGIN {Module = "$(notdir $@)"}' >> $@ && \
cat $^ >> $@ && \
chmod +x $@
endef
build \
clean
-
build: $(AWK_EXECUTABLES)
clean:
}
$1 == "OK" && \
-$2 == "alert" {
- priority = $3
- subject = $4
+$3 == "alert" {
+ src = $2
+ priority = $4
+ subject = $5
- # Not just using $5 for body - because body might contain a character
+ # Not just using $6 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)
+ sep = body ? "\n" : ""
+ body = body sep "--" src
urgency = priority
sub("hi" , "critical", urgency)
sub("med", "normal" , urgency)
len_head = length($1 FS $2 FS $3 FS)
len_val = len_line - len_head
val = substr($0, len_head + 1, len_val)
-
system("xsetroot -name \"" val "\"")
next
}
}
function msg_out(status, key, val, channel) {
- print(status, key, val) > channel
+ print(status, Module, key, val) > channel
}