]> git.pld-linux.org Git - packages/nagios-notify.git/blame - duration.patch
rel 4; more information about service/host downtime
[packages/nagios-notify.git] / duration.patch
CommitLineData
c4f82a35
AM
1diff -urN nagios-notify-0.14.org/nagios-notify nagios-notify-0.14/nagios-notify
2--- nagios-notify-0.14.org/nagios-notify 2012-12-14 12:52:19.000000000 +0100
3+++ nagios-notify-0.14/nagios-notify 2021-05-04 09:12:22.586849116 +0200
4@@ -53,6 +53,10 @@
5 return "=?" charset "?b?" base64_string(data) "?="
6 }
7
8+ function timestamp_date(tstamp) {
9+ return strftime("%Y-%m-%d %H:%M:%S", tstamp);
10+ }
11+
12 # urlencode
13 function urlencode(data, hextab, i, n, res, c, lo, hi) {
14 split("1 2 3 4 5 6 7 8 9 a b c d e f", hextab, " ")
15@@ -276,6 +280,16 @@
16 data = substr(params, index(params, ",") + 1)
17 $0 = left encode_mime_header(charset, data) right;
18 }
19+
20+ # $(timestamp_date:data)
21+ while (match($0, /\$\(timestamp_date:([^)]+)\)/)) {
22+ pos = length("$(timestamp_date:")
23+ data = substr($0, RSTART + pos, RLENGTH - pos - 1);
24+ left = substr($0, 0, RSTART);
25+ right = substr($0, RSTART + RLENGTH);
26+ $0 = left timestamp_date(data) right;
27+ }
28+
29 # $(urlencode:data)
30 while (match($0, /\$\(urlencode:([^)]+)\)/)) {
31 pos = length("$(urlencode:")
f84f47ad
AM
32diff -urN nagios-notify-0.14.org/templates/notify-host-by-email.tmpl nagios-notify-0.14/templates/notify-host-by-email.tmpl
33--- nagios-notify-0.14.org/templates/notify-host-by-email.tmpl 2018-02-21 20:49:01.969994349 +0100
c4f82a35
AM
34+++ nagios-notify-0.14/templates/notify-host-by-email.tmpl 2021-05-04 09:14:10.686925437 +0200
35@@ -14,4 +14,6 @@
f84f47ad
AM
36 Address: $HOSTADDRESS$
37 Info: $HOSTOUTPUT$
38
c4f82a35
AM
39+Current state since: $SERVICEDURATION$
40+Last service OK: $(timestamp_date:$LASTSERVICEOK$)
f84f47ad 41 Date/Time: $LONGDATETIME$
c4f82a35
AM
42diff -urN nagios-notify-0.14.org/templates/notify-host-by-jabber.tmpl nagios-notify-0.14/templates/notify-host-by-jabber.tmpl
43--- nagios-notify-0.14.org/templates/notify-host-by-jabber.tmpl 2012-12-14 11:48:27.000000000 +0100
44+++ nagios-notify-0.14/templates/notify-host-by-jabber.tmpl 2021-05-04 09:14:37.994452535 +0200
45@@ -1,2 +1,2 @@
46-$HOSTNAME$ $NOTIFICATIONTYPE$: $HOSTSTATE$
47+$HOSTNAME$ $NOTIFICATIONTYPE$: $HOSTSTATE$ (Current state since: $HOSTDURATION$; Last host UP: $(timestamp_date:$LASTHOSTUP$))
48 $HOSTOUTPUT$
49diff -urN nagios-notify-0.14.org/templates/notify-host-by-sms.tmpl nagios-notify-0.14/templates/notify-host-by-sms.tmpl
50--- nagios-notify-0.14.org/templates/notify-host-by-sms.tmpl 2012-12-14 11:48:27.000000000 +0100
51+++ nagios-notify-0.14/templates/notify-host-by-sms.tmpl 2021-05-04 09:14:57.541734913 +0200
52@@ -4,4 +4,7 @@
53 From: $HOSTNAME$@nagios.0
54 Subject: $HOSTSTATE$
55
56+Current state since: $HOSTDURATION$
57+Last Host UP: $(timestamp_date:$LASTHOSTUP$)
58+
59 $HOSTOUTPUT$
f84f47ad
AM
60diff -urN nagios-notify-0.14.org/templates/notify-service-by-email.tmpl nagios-notify-0.14/templates/notify-service-by-email.tmpl
61--- nagios-notify-0.14.org/templates/notify-service-by-email.tmpl 2018-02-21 20:49:19.157176605 +0100
c4f82a35
AM
62+++ nagios-notify-0.14/templates/notify-service-by-email.tmpl 2021-05-04 09:15:31.462803004 +0200
63@@ -15,6 +15,8 @@
f84f47ad
AM
64 Address: $HOSTADDRESS$
65 State: $SERVICESTATE$
66
c4f82a35
AM
67+Current state since: $SERVICEDURATION$
68+Last service OK: $(timestamp_date:$LASTSERVICEOK$)
f84f47ad
AM
69 Date/Time: $LONGDATETIME$
70
71 Additional Info:
c4f82a35
AM
72diff -urN nagios-notify-0.14.org/templates/notify-service-by-jabber.tmpl nagios-notify-0.14/templates/notify-service-by-jabber.tmpl
73--- nagios-notify-0.14.org/templates/notify-service-by-jabber.tmpl 2012-12-14 11:48:27.000000000 +0100
74+++ nagios-notify-0.14/templates/notify-service-by-jabber.tmpl 2021-05-04 09:15:48.273332157 +0200
75@@ -1,2 +1,2 @@
76-$SERVICEDESC$/$HOSTNAME$ $NOTIFICATIONTYPE$: $SERVICESTATE$
77+$SERVICEDESC$/$HOSTNAME$ $NOTIFICATIONTYPE$: $SERVICESTATE$ (Current state since: $SERVICEDURATION$; Last service OK: $(timestamp_date:$LASTSERVICEOK$))
78 $SERVICEOUTPUT$
79diff -urN nagios-notify-0.14.org/templates/notify-service-by-sms.tmpl nagios-notify-0.14/templates/notify-service-by-sms.tmpl
80--- nagios-notify-0.14.org/templates/notify-service-by-sms.tmpl 2012-12-14 11:48:27.000000000 +0100
81+++ nagios-notify-0.14/templates/notify-service-by-sms.tmpl 2021-05-04 09:16:17.924265238 +0200
82@@ -4,6 +4,9 @@
83 From: $SERVICEDESC$@$HOSTNAME$.0
84 Subject: $SERVICESTATE$
85
86+Current state since: $SERVICEDURATION$
87+Last service OK: $(timestamp_date:$LASTSERVICEOK$)
88+
89 #if "$NOTIFICATIONTYPE$" == "ACKNOWLEDGEMENT"
90 Acknowledged by $SERVICEACKAUTHOR$: $SERVICEACKCOMMENT$
91 #else
This page took 0.092886 seconds and 4 git commands to generate.