View | Details | Raw Unified | Return to bug 206350 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (-11 / +9 lines)
Lines 2-19 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	victorops-nagios
4
PORTNAME=	victorops-nagios
5
PORTVERSION=	1.1.8
5
PORTVERSION=	1.4.20
6
CATEGORIES=	net-mgmt
6
CATEGORIES=	net-mgmt
7
MASTER_SITES=	http://software.victorops.com/
7
MASTER_SITES=	http://software.victorops.com/
8
DISTNAME=	${PORTNAME}_${DISTVERSIONPREFIX}${DISTVERSION}${DISTVERSIONSUFFIX}
9
8
10
MAINTAINER=	rand@iteris.com
9
MAINTAINER=	rand@iteris.com
11
COMMENT=	Nagios integration for VictorOps incident notification service
10
COMMENT=	Nagios integration for VictorOps incident notification service
12
11
13
BROKEN=		Unfetchable
14
DEPRECATED=	Broken for more than 6 months
15
EXPIRATION_DATE=	2016-02-29
16
17
NO_WRKSUBDIR=	YES
12
NO_WRKSUBDIR=	YES
18
NO_BUILD=	YES
13
NO_BUILD=	YES
19
14
Lines 23-29 Link Here
23
OPTIONS_DEFAULT=
18
OPTIONS_DEFAULT=
24
QPAGE_DESC=	Integrate qpage for victorops server problems
19
QPAGE_DESC=	Integrate qpage for victorops server problems
25
20
26
RUN_DEPENDS+=	bash:${PORTSDIR}/shells/bash
21
RUN_DEPENDS+=	bash:${PORTSDIR}/shells/bash \
22
		curl:${PORTSDIR}/ftp/curl
27
23
28
.include <bsd.port.options.mk>
24
.include <bsd.port.options.mk>
29
.if ${PORT_OPTIONS:MQPAGE}
25
.if ${PORT_OPTIONS:MQPAGE}
Lines 39-51 Link Here
39
	${MKDIR} ${STAGEDIR}${PREFIX}/etc/periodic/daily
35
	${MKDIR} ${STAGEDIR}${PREFIX}/etc/periodic/daily
40
	${INSTALL_DATA} ${WRKSRC}/etc/cron.daily/victorops ${STAGEDIR}${PREFIX}/etc/periodic/daily/400.victorops
36
	${INSTALL_DATA} ${WRKSRC}/etc/cron.daily/victorops ${STAGEDIR}${PREFIX}/etc/periodic/daily/400.victorops
41
	${MKDIR} ${STAGEDIR}${PREFIX}/etc/nagios
37
	${MKDIR} ${STAGEDIR}${PREFIX}/etc/nagios
42
.for i in victorops victorops_email vo_test_svc vo_test_svc_cmd
43
	${INSTALL_DATA} ${WRKSRC}/opt/victorops/nagios_plugin/nagios_conf/${i}.cfg ${STAGEDIR}${PREFIX}/etc/nagios/${i}.cfg-sample
44
.endfor
45
	${MKDIR} ${STAGEDIR}${PREFIX}/libexec/victorops
38
	${MKDIR} ${STAGEDIR}${PREFIX}/libexec/victorops
39
	${MKDIR} ${STAGEDIR}${PREFIX}/etc/victorops
40
	${MKDIR} ${STAGEDIR}/var/log/victorops
41
	${INSTALL_DATA} ${WRKSRC}/opt/victorops/nagios_plugin/nagios_conf/victorops.cfg ${STAGEDIR}${PREFIX}/etc/nagios/victorops.cfg-sample
42
	${INSTALL_DATA} ${WRKSRC}/opt/victorops/nagios_plugin/conf/env.sh.sample ${STAGEDIR}${PREFIX}/etc/victorops
43
	${INSTALL_DATA} ${WRKSRC}/opt/victorops/nagios_plugin/conf/proxy.sh.sample ${STAGEDIR}${PREFIX}/etc/victorops
46
.for i in check_test_svc check_victorops_cmds check_victorops_forwarder \
44
.for i in check_test_svc check_victorops_cmds check_victorops_forwarder \
47
	do_victorops_heartbeat enqueue_alert forward_alert_file forward_alerts \
45
	do_victorops_heartbeat enqueue_alert forward_alert_file forward_alerts \
48
	send_email_alert send_status stop_forwarder support_collect.sh \
46
	send_email_alert send_status stop_forwarder \
49
	url_encode.sed utils
47
	url_encode.sed utils
50
	${INSTALL_SCRIPT} ${WRKSRC}/opt/victorops/nagios_plugin/bin/${i} ${STAGEDIR}${PREFIX}/libexec/victorops/${i}
48
	${INSTALL_SCRIPT} ${WRKSRC}/opt/victorops/nagios_plugin/bin/${i} ${STAGEDIR}${PREFIX}/libexec/victorops/${i}
51
.endfor
49
.endfor
(-)distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (victorops-nagios_1.1.8.tar.gz) = 796e146552e27b45d0339c9c74883ba8048125887461f9e69a1e36cbd752e1a2
1
SHA256 (victorops-nagios-1.4.20.tar.gz) = 87d8c87182e8945357cb9b602d19452754a4decb4809a8594a2495a04f3d9664
2
SIZE (victorops-nagios_1.1.8.tar.gz) = 12838
2
SIZE (victorops-nagios-1.4.20.tar.gz) = 1678731
(-)files/patch-check_victorops_cmds (-11 lines)
Lines 1-11 Link Here
1
--- opt/victorops/nagios_plugin/bin/check_victorops_cmds.orig	2014-06-11 10:22:45.587219788 -0500
2
+++ opt/victorops/nagios_plugin/bin/check_victorops_cmds	2014-06-11 12:37:39.711662512 -0500
3
@@ -46,7 +46,7 @@
4
     TMP_FILE=$(mktemp)
5
 
6
     # Get the commands from VictorOps
7
-    wget -T $TIMEOUT -t $TRIES --no-verbose -O $TMP_FILE "$URL"
8
+    $WGET -T $TIMEOUT -t $TRIES --no-verbose -O $TMP_FILE "$URL"
9
 
10
     # Check the result, and if OK, send them to the command file
11
     grep $RESULT_OK $TMP_FILE
(-)files/patch-check_victorops_forwarder (-32 lines)
Lines 1-32 Link Here
1
--- opt/victorops/nagios_plugin/bin/check_victorops_forwarder.orig	2014-04-02 15:36:08.000000000 -0500
2
+++ opt/victorops/nagios_plugin/bin/check_victorops_forwarder	2014-06-15 16:34:11.635114340 -0500
3
@@ -1,4 +1,4 @@
4
-#!/bin/bash
5
+#!/usr/local/bin/bash
6
 
7
 if [ -x /usr/bin/dirname ]; then
8
     . $(/usr/bin/dirname $0)/utils
9
@@ -10,7 +10,7 @@
10
 
11
 verifyEnvironment
12
 
13
-QUEUE=/var/nagios
14
+QUEUE=/var/spool/nagios/victorops/alerts
15
 LOG=/var/log/victorops/forward_alerts.log
16
 DEBUG_FILE=/dev/null
17
 while getopts  "l:q:" flag
18
@@ -27,7 +27,13 @@
19
 FORWARDER=$($DIRNAME $BASH_SOURCE)/forward_alerts
20
 PID_FILE=/tmp/victorops_forward_alerts.pid
21
 
22
-FORWARDER_COUNT=$($PS -eaf | $GREP -v grep | $GREP "$FORWARDER" | $WC -l 2>/dev/null)
23
+if [ ! -e $PID_FILE ]; then
24
+    PID=9999999999
25
+else
26
+    PID=$($CAT $PID_FILE)
27
+fi
28
+
29
+FORWARDER_COUNT=$($PS -ww -p $PID | $GREP "$FORWARDER" | $WC -l 2>/dev/null)
30
 if (( $FORWARDER_COUNT == 0 )); then
31
     echo "$($DATE) Starting $FORWARDER" >> "$LOG"
32
     $FORWARDER "$QUEUE" >> "$LOG" 2>&1 &
(-)files/patch-do_victorops_heartbeat (-11 lines)
Lines 1-11 Link Here
1
--- opt/victorops/nagios_plugin/bin/do_victorops_heartbeat.orig	2014-06-11 10:25:17.252208492 -0500
2
+++ opt/victorops/nagios_plugin/bin/do_victorops_heartbeat	2014-06-11 10:29:51.392206330 -0500
3
@@ -44,7 +44,7 @@
4
 fi
5
 
6
 # guess Distro
7
-DISTRO=$(/usr/bin/lsb_release -d 2>/dev/null | $SED 's/.*:[[:space:]]*//')
8
+DISTRO=$(/usr/bin/uname -or 2>/dev/null | $SED 's/.*:[[:space:]]*//')
9
 if [ "$DISTRO" = "" ]; then
10
     DISTRO=$($CAT /etc/*release | $HEAD -1)
11
 fi
(-)files/patch-enqueue_alert (-14 lines)
Lines 1-14 Link Here
1
--- opt/victorops/nagios_plugin/bin/enqueue_alert.orig	2014-06-11 10:34:56.607169001 -0500
2
+++ opt/victorops/nagios_plugin/bin/enqueue_alert	2014-06-11 10:35:58.757671279 -0500
3
@@ -15,9 +15,9 @@
4
 # Get the queue dir from the alert info in the environment vars.
5
 # If it's empty, use a default.
6
 # The queue dir can also be given on the command line.
7
-QUEUE_DIR="$(getVal _CONTACTVO_QUEUE_DIR /var/nagios)"
8
+QUEUE_DIR="$(getVal _CONTACTVO_QUEUE_DIR /var/spool/nagios/victorops/alerts)"
9
 if [ -z "$QUEUE_DIR" ]; then
10
-    QUEUE_DIR=/var/nagios
11
+    QUEUE_DIR=/var/spool/nagios/victorops/alerts
12
 fi
13
 if [ ! -z "$1" ]; then
14
   QUEUE_DIR=$1
(-)files/patch-forward_alerts (-11 lines)
Lines 1-11 Link Here
1
--- opt/victorops/nagios_plugin/bin/forward_alerts.orig	2014-06-11 10:38:17.374154833 -0500
2
+++ opt/victorops/nagios_plugin/bin/forward_alerts	2014-06-11 10:38:59.844409788 -0500
3
@@ -18,7 +18,7 @@
4
   QUEUE_DIR=$1
5
 fi
6
 if [ -z "$QUEUE_DIR" ]; then
7
-    QUEUE_DIR=/var/nagios
8
+    QUEUE_DIR=/var/spool/nagios/victorops/alerts
9
 fi
10
 DONE_DIR=$QUEUE_DIR/forwarded
11
 EMAILED_DIR=$QUEUE_DIR/emailed
(-)files/patch-support_collect.sh (-13 lines)
Lines 1-13 Link Here
1
--- opt/victorops/nagios_plugin/bin/support_collect.sh.orig	2014-06-11 11:24:28.858964094 -0500
2
+++ opt/victorops/nagios_plugin/bin/support_collect.sh	2014-06-11 11:25:03.784958472 -0500
3
@@ -11,8 +11,8 @@
4
 TARBALL=$($DATE +%Y%m%d-%H%M)-victorops.tgz
5
 SUPPORT=support@victorops.com
6
 
7
-echo $TAR -cz -f $TARBALL /var/log/victorops /var/nagios
8
-$TAR -cz -f $TARBALL /var/log/victorops /var/nagios
9
+echo $TAR -cz -f $TARBALL /var/log/victorops /var/spool/nagios/victorops/alerts
10
+$TAR -cz -f $TARBALL /var/log/victorops /var/spool/nagios/victorops/alerts
11
 
12
 if [ -e "$MUTT" ]; then
13
     echo
(-)files/patch-utils (-21 lines)
Lines 1-21 Link Here
1
--- opt/victorops/nagios_plugin/bin/utils.orig	2014-06-11 11:25:07.834962605 -0500
2
+++ opt/victorops/nagios_plugin/bin/utils	2014-06-11 11:26:48.367951852 -0500
3
@@ -46,7 +46,8 @@
4
 function findStatusFile {
5
     local f="$1"
6
     if [ -z "$f" ]; then
7
-        echo "STATUSDATAFILE is empty" >> $DEBUG_FILE
8
+        echo "STATUSDATAFILE($f) is empty" >> $DEBUG_FILE
9
+	echo "Looking for STATUS file in $2" >> $DEBUG_FILE
10
         f=$($GREP "^status_file=" $2 | $SED 's/.*=//')
11
     fi
12
     if [ -z "$f" ]; then
13
@@ -82,6 +83,8 @@
14
     APP=/bin/$1
15
   elif [ -x /usr/bin/$1 ]; then
16
     APP=/usr/bin/$1
17
+  elif [ -x /usr/local/bin/$1 ]; then
18
+    APP=/usr/local/bin/$1
19
   else
20
     APP=$1
21
   fi
(-)files/patch-victorops.cron (-10 lines)
Lines 1-10 Link Here
1
--- etc/cron.daily/victorops.orig	2014-06-11 12:49:42.035618811 -0500
2
+++ etc/cron.daily/victorops	2014-06-11 12:50:57.241605821 -0500
3
@@ -1,5 +1,5 @@
4
 #!/bin/sh
5
 
6
 # Clean up old alerts
7
-/usr/bin/find /var/nagios/emailed/ -mtime +7 -type f -delete
8
-/usr/bin/find /var/nagios/forwarded/ -mtime +7 -type f -delete
9
+/usr/bin/find /var/spool/nagios/victorops/alerts/emailed/ -mtime +7 -type f -delete
10
+/usr/bin/find /var/spool/nagios/victorops/alerts/forwarded/ -mtime +7 -type f -delete
(-)files/qpage-patch (-21 / +10 lines)
Lines 1-38 Link Here
1
--- opt/victorops/nagios_plugin/bin/send_email_alert.orig	2014-06-11 10:39:13.918151547 -0500
1
--- opt/victorops/nagios_plugin/bin/send_email_alert.orig	2016-01-16 21:20:46 UTC
2
+++ opt/victorops/nagios_plugin/bin/send_email_alert	2014-06-11 11:20:43.930977406 -0500
2
+++ opt/victorops/nagios_plugin/bin/send_email_alert
3
@@ -31,6 +31,7 @@
3
@@ -34,6 +34,7 @@ fi
4
 # Build the contact email list
4
 # Build the contact email list
5
 ORG_SLUG="$(getVal _CONTACTVO_ORGANIZATION_ID unkonwn_org)"
5
 ORG_SLUG="$(getVal _CONTACTVO_ORGANIZATION_ID unkonwn_org)"
6
 CONTACTEMAIL="$(getVal _CONTACTVO_CONTACTEMAIL)"
6
 CONTACTEMAIL="$(getVal _CONTACTVO_CONTACTEMAIL)"
7
+CONTACTPAGER="$(getVal CONTACTPAGER)"
7
+CONTACTPAGER="$(getVal CONTACTPAGER)"
8
 VO_CONTACT="failsafe+$ORG_SLUG@victorops.net"
8
 VO_CONTACT="failsafe+$ORG_SLUG@victorops.net"
9
 WGET_LOG=/tmp/victorops_forward_wget.out
9
 WGET_LOG=$LOG_DIR/victorops_forward_wget.out
10
 STDERR_LOG=/tmp/victorops_forward_wget.err
10
 STDERR_LOG=$LOG_DIR/victorops_forward_wget.err
11
@@ -42,10 +43,16 @@
11
@@ -45,10 +46,16 @@ if (( $IS_SERVICE )); then
12
     if [ "$CONTACTEMAIL" != "" ]; then
12
     if [ "$CONTACTEMAIL" != "" ]; then
13
         $PRINTF "%b" "***** Alert *****\n\nNotification Type: $(getVal NOTIFICATIONTYPE)\n\nService: $(getVal SERVICEDESC)\nHost: $(getVal HOSTALIAS)\nAddress: $(getVal HOSTADDRESS)\nState: $(getVal SERVICESTATE)\n\nDate/Time: $(getVal LONGDATETIME)\n\nAdditional Info:\n\n$(getVal SERVICEOUTPUT)\n\n" | $MAIL -s "** $(getVal NOTIFICATIONTYPE) Service Alert: $(getVal HOSTALIAS)/$(getVal SERVICEDESC) is $(getVal SERVICESTATE) **" $CONTACTEMAIL
13
         printf "%b" "***** Alert *****\n\nNotification Type: $(getVal NOTIFICATIONTYPE)\n\nService: $(getVal SERVICEDESC)\nHost: $(getVal HOSTALIAS)\nAddress: $(getVal HOSTADDRESS)\nState: $(getVal SERVICESTATE)\n\nDate/Time: $(getVal LONGDATETIME)\n\nAdditional Info:\n\n$(getVal SERVICEOUTPUT)\n\n" | mail -s "** $(getVal NOTIFICATIONTYPE) Service Alert: $(getVal HOSTALIAS)/$(getVal SERVICEDESC) is $(getVal SERVICESTATE) **" $CONTACTEMAIL
14
     fi
14
     fi
15
+    if [ "$CONTACTPAGER" != "" ]; then
15
+    if [ "$CONTACTPAGER" != "" ]; then
16
+        $PRINTF "%b" "$(getVal SERVICEDESC) $(getVal NOTIFICATIONTYPE) for $(getVal HOSTNAME) is $(getVal SERVICESTATE) at $(getVal TIME) $(getVal SERVICEOUTPUT)" | $QPAGE -f icinga $CONTACTPAGER
16
+        printf "%b" "$(getVal SERVICEDESC) $(getVal NOTIFICATIONTYPE) for $(getVal HOSTNAME) is $(getVal SERVICESTATE) at $(getVal TIME) $(getVal SERVICEOUTPUT)" | qpage -f icinga $CONTACTPAGER
17
+    fi
17
+    fi
18
 else
18
 else
19
     if [ "$CONTACTEMAIL" != "" ]; then
19
     if [ "$CONTACTEMAIL" != "" ]; then
20
         $PRINTF "%b" "***** Alert *****\n\nNotification Type: $(getVal NOTIFICATIONTYPE)\nHost: $(getVal HOSTNAME)\nState: $(getVal HOSTSTATE)\nAddress: $(getVal HOSTADDRESS)\nInfo: $(getVal HOSTOUTPUT)\n\nDate/Time: $(getVal LONGDATETIME)\n" | $MAIL -s "** $(getVal NOTIFICATIONTYPE) Host Alert: $(getVal HOSTNAME) is $(getVal HOSTSTATE) **" $CONTACTEMAIL
20
         printf "%b" "***** Alert *****\n\nNotification Type: $(getVal NOTIFICATIONTYPE)\nHost: $(getVal HOSTNAME)\nState: $(getVal HOSTSTATE)\nAddress: $(getVal HOSTADDRESS)\nInfo: $(getVal HOSTOUTPUT)\n\nDate/Time: $(getVal LONGDATETIME)\n" | mail -s "** $(getVal NOTIFICATIONTYPE) Host Alert: $(getVal HOSTNAME) is $(getVal HOSTSTATE) **" $CONTACTEMAIL
21
     fi
21
     fi
22
+    if [ "$CONTACTPAGER" != "" ]; then
22
+    if [ "$CONTACTPAGER" != "" ]; then
23
+        $PRINTF "%b" "$(getVal HOSTNAME) is $(getVal HOSTSTATE) at $(getVal TIME) -- $(getVal HOSTOUTPUT)" | $QPAGE -f icinga $CONTACTPAGER
23
+        printf "%b" "$(getVal HOSTNAME) is $(getVal HOSTSTATE) at $(getVal TIME) -- $(getVal HOSTOUTPUT)" | qpage -f icinga $CONTACTPAGER
24
+    fi
24
+    fi
25
 fi
25
 fi
26
 # ***
26
 # ***
27
 # *** Make sure the mail command is the last thing in this file so the including file can check the exit code
27
 # *** Make sure the mail command is the last thing in this file so the including file can check the exit code
28
--- opt/victorops/nagios_plugin/bin/utils.orig   2014-06-16 20:12:16.713013963 -0500
29
+++ opt/victorops/nagios_plugin/bin/utils        2014-06-16 20:12:58.533005832 -0500
30
@@ -110,6 +110,7 @@
31
 MV=$(findApp mv)
32
 PRINTF=$(findApp printf)
33
 PS=$(findApp ps)
34
+QPAGE=$(findApp qpage)
35
 SED=$(findApp sed)
36
 SLEEP=$(findApp sleep)
37
 TAR=$(findApp tar)
38
(-)pkg-plist (-5 / +5 lines)
Lines 1-7 Link Here
1
etc/nagios/victorops.cfg-sample
1
@sample etc/victorops/env.sh.sample
2
etc/nagios/victorops_email.cfg-sample
2
@sample etc/victorops/proxy.sh.sample
3
etc/nagios/vo_test_svc.cfg-sample
3
@sample etc/nagios/victorops.cfg-sample
4
etc/nagios/vo_test_svc_cmd.cfg-sample
5
etc/periodic/daily/400.victorops
4
etc/periodic/daily/400.victorops
6
libexec/victorops/check_test_svc
5
libexec/victorops/check_test_svc
7
libexec/victorops/check_victorops_cmds
6
libexec/victorops/check_victorops_cmds
Lines 13-18 Link Here
13
libexec/victorops/send_email_alert
12
libexec/victorops/send_email_alert
14
libexec/victorops/send_status
13
libexec/victorops/send_status
15
libexec/victorops/stop_forwarder
14
libexec/victorops/stop_forwarder
16
libexec/victorops/support_collect.sh
17
libexec/victorops/url_encode.sed
15
libexec/victorops/url_encode.sed
18
libexec/victorops/utils
16
libexec/victorops/utils
17
@dir etc/victorops
18
@dir /var/log/victorops

Return to bug 206350