[packages/nagios-notify] rel 4; more information about service/host downtime
arekm
arekm at pld-linux.org
Tue May 4 09:22:37 CEST 2021
commit c4f82a351aa8ada46f42a2474b4e369a02d52c0e
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Tue May 4 09:22:28 2021 +0200
rel 4; more information about service/host downtime
duration.patch | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++----
nagios-notify.spec | 2 +-
2 files changed, 78 insertions(+), 7 deletions(-)
---
diff --git a/nagios-notify.spec b/nagios-notify.spec
index e7f7d1b..15c5755 100644
--- a/nagios-notify.spec
+++ b/nagios-notify.spec
@@ -2,7 +2,7 @@ Summary: Nagios Notify Script
Summary(pl.UTF-8): Skrypt powiadamiający dla Nagiosa
Name: nagios-notify
Version: 0.14
-Release: 3
+Release: 4
License: GPL v2
Group: Applications
Source0: %{name}-%{version}.tar.bz2
diff --git a/duration.patch b/duration.patch
index bc5a452..891ed54 100644
--- a/duration.patch
+++ b/duration.patch
@@ -1,20 +1,91 @@
+diff -urN nagios-notify-0.14.org/nagios-notify nagios-notify-0.14/nagios-notify
+--- nagios-notify-0.14.org/nagios-notify 2012-12-14 12:52:19.000000000 +0100
++++ nagios-notify-0.14/nagios-notify 2021-05-04 09:12:22.586849116 +0200
+@@ -53,6 +53,10 @@
+ return "=?" charset "?b?" base64_string(data) "?="
+ }
+
++ function timestamp_date(tstamp) {
++ return strftime("%Y-%m-%d %H:%M:%S", tstamp);
++ }
++
+ # urlencode
+ function urlencode(data, hextab, i, n, res, c, lo, hi) {
+ split("1 2 3 4 5 6 7 8 9 a b c d e f", hextab, " ")
+@@ -276,6 +280,16 @@
+ data = substr(params, index(params, ",") + 1)
+ $0 = left encode_mime_header(charset, data) right;
+ }
++
++ # $(timestamp_date:data)
++ while (match($0, /\$\(timestamp_date:([^)]+)\)/)) {
++ pos = length("$(timestamp_date:")
++ data = substr($0, RSTART + pos, RLENGTH - pos - 1);
++ left = substr($0, 0, RSTART);
++ right = substr($0, RSTART + RLENGTH);
++ $0 = left timestamp_date(data) right;
++ }
++
+ # $(urlencode:data)
+ while (match($0, /\$\(urlencode:([^)]+)\)/)) {
+ pos = length("$(urlencode:")
diff -urN nagios-notify-0.14.org/templates/notify-host-by-email.tmpl nagios-notify-0.14/templates/notify-host-by-email.tmpl
--- nagios-notify-0.14.org/templates/notify-host-by-email.tmpl 2018-02-21 20:49:01.969994349 +0100
-+++ nagios-notify-0.14/templates/notify-host-by-email.tmpl 2018-02-21 20:55:06.047582770 +0100
-@@ -14,4 +14,5 @@
++++ nagios-notify-0.14/templates/notify-host-by-email.tmpl 2021-05-04 09:14:10.686925437 +0200
+@@ -14,4 +14,6 @@
Address: $HOSTADDRESS$
Info: $HOSTOUTPUT$
-+Duration: $SERVICEDURATION$
++Current state since: $SERVICEDURATION$
++Last service OK: $(timestamp_date:$LASTSERVICEOK$)
Date/Time: $LONGDATETIME$
+diff -urN nagios-notify-0.14.org/templates/notify-host-by-jabber.tmpl nagios-notify-0.14/templates/notify-host-by-jabber.tmpl
+--- nagios-notify-0.14.org/templates/notify-host-by-jabber.tmpl 2012-12-14 11:48:27.000000000 +0100
++++ nagios-notify-0.14/templates/notify-host-by-jabber.tmpl 2021-05-04 09:14:37.994452535 +0200
+@@ -1,2 +1,2 @@
+-$HOSTNAME$ $NOTIFICATIONTYPE$: $HOSTSTATE$
++$HOSTNAME$ $NOTIFICATIONTYPE$: $HOSTSTATE$ (Current state since: $HOSTDURATION$; Last host UP: $(timestamp_date:$LASTHOSTUP$))
+ $HOSTOUTPUT$
+diff -urN nagios-notify-0.14.org/templates/notify-host-by-sms.tmpl nagios-notify-0.14/templates/notify-host-by-sms.tmpl
+--- nagios-notify-0.14.org/templates/notify-host-by-sms.tmpl 2012-12-14 11:48:27.000000000 +0100
++++ nagios-notify-0.14/templates/notify-host-by-sms.tmpl 2021-05-04 09:14:57.541734913 +0200
+@@ -4,4 +4,7 @@
+ From: $HOSTNAME$@nagios.0
+ Subject: $HOSTSTATE$
+
++Current state since: $HOSTDURATION$
++Last Host UP: $(timestamp_date:$LASTHOSTUP$)
++
+ $HOSTOUTPUT$
diff -urN nagios-notify-0.14.org/templates/notify-service-by-email.tmpl nagios-notify-0.14/templates/notify-service-by-email.tmpl
--- nagios-notify-0.14.org/templates/notify-service-by-email.tmpl 2018-02-21 20:49:19.157176605 +0100
-+++ nagios-notify-0.14/templates/notify-service-by-email.tmpl 2018-02-21 20:55:16.601232698 +0100
-@@ -15,6 +15,7 @@
++++ nagios-notify-0.14/templates/notify-service-by-email.tmpl 2021-05-04 09:15:31.462803004 +0200
+@@ -15,6 +15,8 @@
Address: $HOSTADDRESS$
State: $SERVICESTATE$
-+Duration: $SERVICEDURATION$
++Current state since: $SERVICEDURATION$
++Last service OK: $(timestamp_date:$LASTSERVICEOK$)
Date/Time: $LONGDATETIME$
Additional Info:
+diff -urN nagios-notify-0.14.org/templates/notify-service-by-jabber.tmpl nagios-notify-0.14/templates/notify-service-by-jabber.tmpl
+--- nagios-notify-0.14.org/templates/notify-service-by-jabber.tmpl 2012-12-14 11:48:27.000000000 +0100
++++ nagios-notify-0.14/templates/notify-service-by-jabber.tmpl 2021-05-04 09:15:48.273332157 +0200
+@@ -1,2 +1,2 @@
+-$SERVICEDESC$/$HOSTNAME$ $NOTIFICATIONTYPE$: $SERVICESTATE$
++$SERVICEDESC$/$HOSTNAME$ $NOTIFICATIONTYPE$: $SERVICESTATE$ (Current state since: $SERVICEDURATION$; Last service OK: $(timestamp_date:$LASTSERVICEOK$))
+ $SERVICEOUTPUT$
+diff -urN nagios-notify-0.14.org/templates/notify-service-by-sms.tmpl nagios-notify-0.14/templates/notify-service-by-sms.tmpl
+--- nagios-notify-0.14.org/templates/notify-service-by-sms.tmpl 2012-12-14 11:48:27.000000000 +0100
++++ nagios-notify-0.14/templates/notify-service-by-sms.tmpl 2021-05-04 09:16:17.924265238 +0200
+@@ -4,6 +4,9 @@
+ From: $SERVICEDESC$@$HOSTNAME$.0
+ Subject: $SERVICESTATE$
+
++Current state since: $SERVICEDURATION$
++Last service OK: $(timestamp_date:$LASTSERVICEOK$)
++
+ #if "$NOTIFICATIONTYPE$" == "ACKNOWLEDGEMENT"
+ Acknowledged by $SERVICEACKAUTHOR$: $SERVICEACKCOMMENT$
+ #else
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/nagios-notify.git/commitdiff/c4f82a351aa8ada46f42a2474b4e369a02d52c0e
More information about the pld-cvs-commit
mailing list