Commit | Line | Data |
---|---|---|
75b23ff8 SK |
1 | #! /usr/bin/awk -f |
2 | ||
3 | BEGIN { | |
4 | FS = msg_fs ? msg_fs : "|" | |
5 | OFS = msg_fs ? msg_fs : "|" | |
6 | Kfs = key_fs ? key_fs : ":" | |
7 | } | |
8 | ||
9 | /^ERROR/ { | |
10 | src = $2 | |
11 | # Not just using $6 for body - because body might contain a character | |
12 | # identical to FS | |
13 | len_line = length($0) | |
14 | len_head = length($1 FS $2 FS) | |
15 | len_body = len_line - len_head | |
16 | body = substr($0, len_head + 1, len_body) | |
17 | alert("hi", "Error_in_" src, body) | |
18 | } | |
19 | ||
20 | # After peeking, let everything pass through! | |
21 | // | |
22 | ||
23 | function alert(priority, subject, body) { | |
24 | # priority : "low" | "med" | "hi" | |
25 | # subject : no spaces | |
26 | # body : anything | |
27 | print("OK", "khatus_monitor_errors", "alert", priority, subject, body) | |
28 | } |