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

Collapse All | Expand All

(-)net-mgmt/victorops-nagios.new/Makefile (-6 / +5 lines)
Lines 2-17 Link Here
2
# $FreeBSD: head/net-mgmt/victorops-nagios/Makefile 389943 2015-06-17 17:11:04Z antoine $
2
# $FreeBSD: head/net-mgmt/victorops-nagios/Makefile 389943 2015-06-17 17:11:04Z antoine $
3
3
4
PORTNAME=	victorops-nagios
4
PORTNAME=	victorops-nagios
5
PORTVERSION=	1.1.8
5
PORTVERSION=	1.3.16
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
15
NO_WRKSUBDIR=	YES
12
NO_WRKSUBDIR=	YES
16
NO_BUILD=	YES
13
NO_BUILD=	YES
17
14
Lines 21-27 Link Here
21
OPTIONS_DEFAULT=
18
OPTIONS_DEFAULT=
22
QPAGE_DESC=	Integrate qpage for victorops server problems
19
QPAGE_DESC=	Integrate qpage for victorops server problems
23
20
24
RUN_DEPENDS+=	bash:${PORTSDIR}/shells/bash
21
RUN_DEPENDS+=	bash:${PORTSDIR}/shells/bash \
22
		gtimeout:${PORTSDIR}/sysutils/coreutils \
23
		ca_root_nss>=0:${PORTSDIR}/security/ca_root_nss
25
24
26
.include <bsd.port.options.mk>
25
.include <bsd.port.options.mk>
27
.if ${PORT_OPTIONS:MQPAGE}
26
.if ${PORT_OPTIONS:MQPAGE}
Lines 37-43 Link Here
37
	${MKDIR} ${STAGEDIR}${PREFIX}/etc/periodic/daily
36
	${MKDIR} ${STAGEDIR}${PREFIX}/etc/periodic/daily
38
	${INSTALL_DATA} ${WRKSRC}/etc/cron.daily/victorops ${STAGEDIR}${PREFIX}/etc/periodic/daily/400.victorops
37
	${INSTALL_DATA} ${WRKSRC}/etc/cron.daily/victorops ${STAGEDIR}${PREFIX}/etc/periodic/daily/400.victorops
39
	${MKDIR} ${STAGEDIR}${PREFIX}/etc/nagios
38
	${MKDIR} ${STAGEDIR}${PREFIX}/etc/nagios
40
.for i in victorops victorops_email vo_test_svc vo_test_svc_cmd
39
.for i in victorops victorops_email vo_test_svc
41
	${INSTALL_DATA} ${WRKSRC}/opt/victorops/nagios_plugin/nagios_conf/${i}.cfg ${STAGEDIR}${PREFIX}/etc/nagios/${i}.cfg-sample
40
	${INSTALL_DATA} ${WRKSRC}/opt/victorops/nagios_plugin/nagios_conf/${i}.cfg ${STAGEDIR}${PREFIX}/etc/nagios/${i}.cfg-sample
42
.endfor
41
.endfor
43
	${MKDIR} ${STAGEDIR}${PREFIX}/libexec/victorops
42
	${MKDIR} ${STAGEDIR}${PREFIX}/libexec/victorops
(-)net-mgmt/victorops-nagios.new/distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (victorops-nagios_1.1.8.tar.gz) = 796e146552e27b45d0339c9c74883ba8048125887461f9e69a1e36cbd752e1a2
1
SHA256 (victorops-nagios-1.3.16.tar.gz) = f1f6459b68a104c4136b60bf6728c0727f9d436f7c74ca0391d604fcc03a7fe0
2
SIZE (victorops-nagios_1.1.8.tar.gz) = 12838
2
SIZE (victorops-nagios-1.3.16.tar.gz) = 20936
(-)net-mgmt/victorops-nagios.new/files/patch-check_victorops_cmds (-5 / +5 lines)
Lines 1-11 Link Here
1
--- opt/victorops/nagios_plugin/bin/check_victorops_cmds.orig	2014-06-11 10:22:45.587219788 -0500
1
--- opt/victorops/nagios_plugin/bin/check_victorops_cmds.orig	2015-06-19 17:10:20 UTC
2
+++ opt/victorops/nagios_plugin/bin/check_victorops_cmds	2014-06-11 12:37:39.711662512 -0500
2
+++ opt/victorops/nagios_plugin/bin/check_victorops_cmds
3
@@ -46,7 +46,7 @@
3
@@ -52,7 +52,7 @@ getAndExecuteCmds() {
4
     TMP_FILE=$(mktemp)
4
     TMP_FILE=$(mktemp)
5
 
5
 
6
     # Get the commands from VictorOps
6
     # Get the commands from VictorOps
7
-    wget -T $TIMEOUT -t $TRIES --no-verbose -O $TMP_FILE "$URL"
7
-    timeout $(( $TIMEOUT + 5 )) wget -T $TIMEOUT -t $TRIES -O $TMP_FILE "$URL" 2>$WGET_RESULT
8
+    $WGET -T $TIMEOUT -t $TRIES --no-verbose -O $TMP_FILE "$URL"
8
+    gtimeout $(( $TIMEOUT + 5 )) wget -T $TIMEOUT -t $TRIES -O $TMP_FILE "$URL" 2>$WGET_RESULT
9
 
9
 
10
     # Check the result, and if OK, send them to the command file
10
     # Check the result, and if OK, send them to the command file
11
     grep $RESULT_OK $TMP_FILE
11
     grep $RESULT_OK $TMP_FILE
(-)net-mgmt/victorops-nagios.new/files/patch-check_victorops_forwarder (-25 / +10 lines)
Lines 1-32 Link Here
1
--- opt/victorops/nagios_plugin/bin/check_victorops_forwarder.orig	2014-04-02 15:36:08.000000000 -0500
1
--- opt/victorops/nagios_plugin/bin/check_victorops_forwarder.orig	2015-06-19 17:10:54 UTC
2
+++ opt/victorops/nagios_plugin/bin/check_victorops_forwarder	2014-06-15 16:34:11.635114340 -0500
2
+++ opt/victorops/nagios_plugin/bin/check_victorops_forwarder
3
@@ -1,4 +1,4 @@
3
@@ -1,4 +1,4 @@
4
-#!/bin/bash
4
-#!/bin/bash
5
+#!/usr/local/bin/bash
5
+#!/usr/local/bin/bash
6
 
6
 #//==========================================================================//
7
 if [ -x /usr/bin/dirname ]; then
7
 #//         Copyright 2013-2015 VictorOps, Inc. All Rights Reserved          //
8
     . $(/usr/bin/dirname $0)/utils
8
 #//                                                                          //
9
@@ -10,7 +10,7 @@
9
@@ -32,7 +32,7 @@ shift $((OPTIND-1))
10
 
10
 FORWARDER=$(dirname $BASH_SOURCE)/forward_alerts
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
11
 PID_FILE=/tmp/victorops_forward_alerts.pid
21
 
12
 
22
-FORWARDER_COUNT=$($PS -eaf | $GREP -v grep | $GREP "$FORWARDER" | $WC -l 2>/dev/null)
13
-FORWARDER_COUNT=$(ps -eaww -o command | grep "$FORWARDER" | grep -v grep | wc -l 2>/dev/null)
23
+if [ ! -e $PID_FILE ]; then
14
+FORWARDER_COUNT=$(ps -aww -o command | grep "$FORWARDER" | grep -v grep | wc -l 2>/dev/null)
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
15
 if (( $FORWARDER_COUNT == 0 )); then
31
     echo "$($DATE) Starting $FORWARDER" >> "$LOG"
16
     echo "$(date) Starting $FORWARDER" >> "$LOG"
32
     $FORWARDER "$QUEUE" >> "$LOG" 2>&1 &
17
     $FORWARDER "$QUEUE" >> "$LOG" 2>&1 &
(-)net-mgmt/victorops-nagios.new/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
(-)net-mgmt/victorops-nagios.new/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
(-)net-mgmt/victorops-nagios.new/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
(-)net-mgmt/victorops-nagios.new/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
(-)net-mgmt/victorops-nagios.new/files/patch-utils (-13 / +13 lines)
Lines 1-21 Link Here
1
--- opt/victorops/nagios_plugin/bin/utils.orig	2014-06-11 11:25:07.834962605 -0500
1
--- opt/victorops/nagios_plugin/bin/utils.orig	2015-06-19 17:14:07 UTC
2
+++ opt/victorops/nagios_plugin/bin/utils	2014-06-11 11:26:48.367951852 -0500
2
+++ opt/victorops/nagios_plugin/bin/utils
3
@@ -46,7 +46,8 @@
3
@@ -10,7 +10,7 @@
4
 #//==========================================================================//
5
 
6
 VO_PLUGIN_VERSION=1.3.16
7
-DEFAULT_QUEUE_DIR=/var/nagios
8
+DEFAULT_QUEUE_DIR=/var/spool/nagios/victorops/alerts
9
 DEFAULT_LOG_DIR=/var/log/victorops
10
 
11
 #-------------------------------------------------------------------
12
@@ -57,7 +57,8 @@ function urlencode {
4
 function findStatusFile {
13
 function findStatusFile {
5
     local f="$1"
14
     local f="$1"
6
     if [ -z "$f" ]; then
15
     if [ -z "$f" ]; then
7
-        echo "STATUSDATAFILE is empty" >> $DEBUG_FILE
16
-        echo "STATUSDATAFILE is empty" >> $DEBUG_FILE
8
+        echo "STATUSDATAFILE($f) is empty" >> $DEBUG_FILE
17
+        echo "STATUSDATAFILE($f) is empty" >> $DEBUG_FILE
9
+	echo "Looking for STATUS file in $2" >> $DEBUG_FILE
18
+	echo "Looking for STATUS file in $2" >> $DEBUG_FILE
10
         f=$($GREP "^status_file=" $2 | $SED 's/.*=//')
19
         f=$(grep "^status_file=" $2 | sed 's/.*=//')
11
     fi
20
     fi
12
     if [ -z "$f" ]; then
21
     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
(-)net-mgmt/victorops-nagios.new/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
(-)net-mgmt/victorops-nagios.new/files/qpage-patch (-19 / +8 lines)
Lines 1-6 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	2015-06-19 12:21:08.586694297 -0500
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	2015-06-19 12:26:00.535948567 -0500
3
@@ -31,6 +31,7 @@
3
@@ -34,6 +34,7 @@
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)"
Lines 8-38 Link Here
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=/tmp/victorops_forward_wget.out
10
 STDERR_LOG=/tmp/victorops_forward_wget.err
10
 STDERR_LOG=/tmp/victorops_forward_wget.err
11
@@ -42,10 +43,16 @@
11
@@ -45,10 +46,16 @@
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
(-)net-mgmt/victorops-nagios.new/pkg-plist (-1 lines)
Lines 1-7 Link Here
1
etc/nagios/victorops.cfg-sample
1
etc/nagios/victorops.cfg-sample
2
etc/nagios/victorops_email.cfg-sample
2
etc/nagios/victorops_email.cfg-sample
3
etc/nagios/vo_test_svc.cfg-sample
3
etc/nagios/vo_test_svc.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

Return to bug 200955