aboutsummaryrefslogtreecommitdiffstats
path: root/net-mgmt
diff options
context:
space:
mode:
authorpi <pi@FreeBSD.org>2014-08-09 17:49:49 +0800
committerpi <pi@FreeBSD.org>2014-08-09 17:49:49 +0800
commit9156bccd10ba2c06df74740f32af8690d12f41bd (patch)
treeec296707694411ec9ef23c07eb9da1c206e0698a /net-mgmt
parentf2148a073dcc19e8edb6de2d4ba0f65f0398edea (diff)
downloadfreebsd-ports-gnome-9156bccd10ba2c06df74740f32af8690d12f41bd.tar.gz
freebsd-ports-gnome-9156bccd10ba2c06df74740f32af8690d12f41bd.tar.zst
freebsd-ports-gnome-9156bccd10ba2c06df74740f32af8690d12f41bd.zip
New port: net-mgmt/victorops-nagios
VictorOps is an on-call management and incident notification service. This is the Nagios/Icinga integration package for VictorOps. WWW: http://www.victorops.com PR: 191383 Submitted by: rand@iteris.com
Diffstat (limited to 'net-mgmt')
-rw-r--r--net-mgmt/Makefile1
-rw-r--r--net-mgmt/victorops-nagios/Makefile49
-rw-r--r--net-mgmt/victorops-nagios/distinfo2
-rw-r--r--net-mgmt/victorops-nagios/files/patch-check_victorops_cmds11
-rw-r--r--net-mgmt/victorops-nagios/files/patch-check_victorops_forwarder32
-rw-r--r--net-mgmt/victorops-nagios/files/patch-do_victorops_heartbeat11
-rw-r--r--net-mgmt/victorops-nagios/files/patch-enqueue_alert14
-rw-r--r--net-mgmt/victorops-nagios/files/patch-forward_alerts11
-rw-r--r--net-mgmt/victorops-nagios/files/patch-support_collect.sh13
-rw-r--r--net-mgmt/victorops-nagios/files/patch-utils21
-rw-r--r--net-mgmt/victorops-nagios/files/patch-victorops.cron10
-rw-r--r--net-mgmt/victorops-nagios/files/qpage-patch38
-rw-r--r--net-mgmt/victorops-nagios/pkg-descr4
-rw-r--r--net-mgmt/victorops-nagios/pkg-message11
-rw-r--r--net-mgmt/victorops-nagios/pkg-plist22
15 files changed, 250 insertions, 0 deletions
diff --git a/net-mgmt/Makefile b/net-mgmt/Makefile
index 8321e4d66584..9a14ab2b1aaf 100644
--- a/net-mgmt/Makefile
+++ b/net-mgmt/Makefile
@@ -323,6 +323,7 @@
SUBDIR += torrus
SUBDIR += unifi2
SUBDIR += unifi3
+ SUBDIR += victorops-nagios
SUBDIR += vidalia
SUBDIR += virt-viewer
SUBDIR += virtinst
diff --git a/net-mgmt/victorops-nagios/Makefile b/net-mgmt/victorops-nagios/Makefile
new file mode 100644
index 000000000000..c80a09ceb93a
--- /dev/null
+++ b/net-mgmt/victorops-nagios/Makefile
@@ -0,0 +1,49 @@
+# Created by: Douglas K. Rand <rand@iteris.com>
+# $FreeBSD$
+
+PORTNAME= victorops-nagios
+PORTVERSION= 1.1.8
+CATEGORIES= net-mgmt
+MASTER_SITES= http://software.victorops.com/
+DISTNAME= ${PORTNAME}_${DISTVERSIONPREFIX}${DISTVERSION}${DISTVERSIONSUFFIX}
+
+MAINTAINER= rand@iteris.com
+COMMENT= Nagios integration for VictorOps incident notification service
+
+NO_WRKSUBDIR= YES
+NO_BUILD= YES
+
+RESTRICTED= Redistribution of software prohibited by VictorOps
+
+OPTIONS_DEFINE= QPAGE
+OPTIONS_DEFAULT=
+QPAGE_DESC= Integrate qpage for victorops server problems
+
+RUN_DEPENDS+= bash:${PORTSDIR}/shells/bash
+
+.include <bsd.port.options.mk>
+.if ${PORT_OPTIONS:MQPAGE}
+RUN_DEPENDS+= qpage:${PORTSDIR}/comms/qpage
+EXTRA_PATCHES+= ${FILESDIR}/qpage-patch
+.endif
+
+post-patch:
+ @${FIND} ${WRKSRC} -type f | ${XARGS} ${REINPLACE_CMD} \
+ -e '1s|#!/bin/bash|#!/usr/local/bin/bash|'
+
+do-install:
+ ${MKDIR} ${STAGEDIR}${PREFIX}/etc/periodic/daily
+ ${INSTALL_DATA} ${WRKSRC}/etc/cron.daily/victorops ${STAGEDIR}${PREFIX}/etc/periodic/daily/400.victorops
+ ${MKDIR} ${STAGEDIR}${PREFIX}/etc/nagios
+.for i in victorops victorops_email vo_test_svc vo_test_svc_cmd
+ ${INSTALL_DATA} ${WRKSRC}/opt/victorops/nagios_plugin/nagios_conf/${i}.cfg ${STAGEDIR}${PREFIX}/etc/nagios/${i}.cfg-sample
+.endfor
+ ${MKDIR} ${STAGEDIR}${PREFIX}/libexec/victorops
+.for i in check_test_svc check_victorops_cmds check_victorops_forwarder \
+ do_victorops_heartbeat enqueue_alert forward_alert_file forward_alerts \
+ send_email_alert send_status stop_forwarder support_collect.sh \
+ url_encode.sed utils
+ ${INSTALL_SCRIPT} ${WRKSRC}/opt/victorops/nagios_plugin/bin/${i} ${STAGEDIR}${PREFIX}/libexec/victorops/${i}
+.endfor
+
+.include <bsd.port.mk>
diff --git a/net-mgmt/victorops-nagios/distinfo b/net-mgmt/victorops-nagios/distinfo
new file mode 100644
index 000000000000..017a138744ba
--- /dev/null
+++ b/net-mgmt/victorops-nagios/distinfo
@@ -0,0 +1,2 @@
+SHA256 (victorops-nagios_1.1.8.tar.gz) = 796e146552e27b45d0339c9c74883ba8048125887461f9e69a1e36cbd752e1a2
+SIZE (victorops-nagios_1.1.8.tar.gz) = 12838
diff --git a/net-mgmt/victorops-nagios/files/patch-check_victorops_cmds b/net-mgmt/victorops-nagios/files/patch-check_victorops_cmds
new file mode 100644
index 000000000000..d37c775bdf38
--- /dev/null
+++ b/net-mgmt/victorops-nagios/files/patch-check_victorops_cmds
@@ -0,0 +1,11 @@
+--- opt/victorops/nagios_plugin/bin/check_victorops_cmds.orig 2014-06-11 10:22:45.587219788 -0500
++++ opt/victorops/nagios_plugin/bin/check_victorops_cmds 2014-06-11 12:37:39.711662512 -0500
+@@ -46,7 +46,7 @@
+ TMP_FILE=$(mktemp)
+
+ # Get the commands from VictorOps
+- wget -T $TIMEOUT -t $TRIES --no-verbose -O $TMP_FILE "$URL"
++ $WGET -T $TIMEOUT -t $TRIES --no-verbose -O $TMP_FILE "$URL"
+
+ # Check the result, and if OK, send them to the command file
+ grep $RESULT_OK $TMP_FILE
diff --git a/net-mgmt/victorops-nagios/files/patch-check_victorops_forwarder b/net-mgmt/victorops-nagios/files/patch-check_victorops_forwarder
new file mode 100644
index 000000000000..6604334435de
--- /dev/null
+++ b/net-mgmt/victorops-nagios/files/patch-check_victorops_forwarder
@@ -0,0 +1,32 @@
+--- opt/victorops/nagios_plugin/bin/check_victorops_forwarder.orig 2014-04-02 15:36:08.000000000 -0500
++++ opt/victorops/nagios_plugin/bin/check_victorops_forwarder 2014-06-15 16:34:11.635114340 -0500
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/usr/local/bin/bash
+
+ if [ -x /usr/bin/dirname ]; then
+ . $(/usr/bin/dirname $0)/utils
+@@ -10,7 +10,7 @@
+
+ verifyEnvironment
+
+-QUEUE=/var/nagios
++QUEUE=/var/spool/nagios/victorops/alerts
+ LOG=/var/log/victorops/forward_alerts.log
+ DEBUG_FILE=/dev/null
+ while getopts "l:q:" flag
+@@ -27,7 +27,13 @@
+ FORWARDER=$($DIRNAME $BASH_SOURCE)/forward_alerts
+ PID_FILE=/tmp/victorops_forward_alerts.pid
+
+-FORWARDER_COUNT=$($PS -eaf | $GREP -v grep | $GREP "$FORWARDER" | $WC -l 2>/dev/null)
++if [ ! -e $PID_FILE ]; then
++ PID=9999999999
++else
++ PID=$($CAT $PID_FILE)
++fi
++
++FORWARDER_COUNT=$($PS -ww -p $PID | $GREP "$FORWARDER" | $WC -l 2>/dev/null)
+ if (( $FORWARDER_COUNT == 0 )); then
+ echo "$($DATE) Starting $FORWARDER" >> "$LOG"
+ $FORWARDER "$QUEUE" >> "$LOG" 2>&1 &
diff --git a/net-mgmt/victorops-nagios/files/patch-do_victorops_heartbeat b/net-mgmt/victorops-nagios/files/patch-do_victorops_heartbeat
new file mode 100644
index 000000000000..71544e88af7e
--- /dev/null
+++ b/net-mgmt/victorops-nagios/files/patch-do_victorops_heartbeat
@@ -0,0 +1,11 @@
+--- opt/victorops/nagios_plugin/bin/do_victorops_heartbeat.orig 2014-06-11 10:25:17.252208492 -0500
++++ opt/victorops/nagios_plugin/bin/do_victorops_heartbeat 2014-06-11 10:29:51.392206330 -0500
+@@ -44,7 +44,7 @@
+ fi
+
+ # guess Distro
+-DISTRO=$(/usr/bin/lsb_release -d 2>/dev/null | $SED 's/.*:[[:space:]]*//')
++DISTRO=$(/usr/bin/uname -or 2>/dev/null | $SED 's/.*:[[:space:]]*//')
+ if [ "$DISTRO" = "" ]; then
+ DISTRO=$($CAT /etc/*release | $HEAD -1)
+ fi
diff --git a/net-mgmt/victorops-nagios/files/patch-enqueue_alert b/net-mgmt/victorops-nagios/files/patch-enqueue_alert
new file mode 100644
index 000000000000..f453e9ad21fa
--- /dev/null
+++ b/net-mgmt/victorops-nagios/files/patch-enqueue_alert
@@ -0,0 +1,14 @@
+--- opt/victorops/nagios_plugin/bin/enqueue_alert.orig 2014-06-11 10:34:56.607169001 -0500
++++ opt/victorops/nagios_plugin/bin/enqueue_alert 2014-06-11 10:35:58.757671279 -0500
+@@ -15,9 +15,9 @@
+ # Get the queue dir from the alert info in the environment vars.
+ # If it's empty, use a default.
+ # The queue dir can also be given on the command line.
+-QUEUE_DIR="$(getVal _CONTACTVO_QUEUE_DIR /var/nagios)"
++QUEUE_DIR="$(getVal _CONTACTVO_QUEUE_DIR /var/spool/nagios/victorops/alerts)"
+ if [ -z "$QUEUE_DIR" ]; then
+- QUEUE_DIR=/var/nagios
++ QUEUE_DIR=/var/spool/nagios/victorops/alerts
+ fi
+ if [ ! -z "$1" ]; then
+ QUEUE_DIR=$1
diff --git a/net-mgmt/victorops-nagios/files/patch-forward_alerts b/net-mgmt/victorops-nagios/files/patch-forward_alerts
new file mode 100644
index 000000000000..16214264c3be
--- /dev/null
+++ b/net-mgmt/victorops-nagios/files/patch-forward_alerts
@@ -0,0 +1,11 @@
+--- opt/victorops/nagios_plugin/bin/forward_alerts.orig 2014-06-11 10:38:17.374154833 -0500
++++ opt/victorops/nagios_plugin/bin/forward_alerts 2014-06-11 10:38:59.844409788 -0500
+@@ -18,7 +18,7 @@
+ QUEUE_DIR=$1
+ fi
+ if [ -z "$QUEUE_DIR" ]; then
+- QUEUE_DIR=/var/nagios
++ QUEUE_DIR=/var/spool/nagios/victorops/alerts
+ fi
+ DONE_DIR=$QUEUE_DIR/forwarded
+ EMAILED_DIR=$QUEUE_DIR/emailed
diff --git a/net-mgmt/victorops-nagios/files/patch-support_collect.sh b/net-mgmt/victorops-nagios/files/patch-support_collect.sh
new file mode 100644
index 000000000000..985b2a661080
--- /dev/null
+++ b/net-mgmt/victorops-nagios/files/patch-support_collect.sh
@@ -0,0 +1,13 @@
+--- opt/victorops/nagios_plugin/bin/support_collect.sh.orig 2014-06-11 11:24:28.858964094 -0500
++++ opt/victorops/nagios_plugin/bin/support_collect.sh 2014-06-11 11:25:03.784958472 -0500
+@@ -11,8 +11,8 @@
+ TARBALL=$($DATE +%Y%m%d-%H%M)-victorops.tgz
+ SUPPORT=support@victorops.com
+
+-echo $TAR -cz -f $TARBALL /var/log/victorops /var/nagios
+-$TAR -cz -f $TARBALL /var/log/victorops /var/nagios
++echo $TAR -cz -f $TARBALL /var/log/victorops /var/spool/nagios/victorops/alerts
++$TAR -cz -f $TARBALL /var/log/victorops /var/spool/nagios/victorops/alerts
+
+ if [ -e "$MUTT" ]; then
+ echo
diff --git a/net-mgmt/victorops-nagios/files/patch-utils b/net-mgmt/victorops-nagios/files/patch-utils
new file mode 100644
index 000000000000..fe9d3a854984
--- /dev/null
+++ b/net-mgmt/victorops-nagios/files/patch-utils
@@ -0,0 +1,21 @@
+--- opt/victorops/nagios_plugin/bin/utils.orig 2014-06-11 11:25:07.834962605 -0500
++++ opt/victorops/nagios_plugin/bin/utils 2014-06-11 11:26:48.367951852 -0500
+@@ -46,7 +46,8 @@
+ function findStatusFile {
+ local f="$1"
+ if [ -z "$f" ]; then
+- echo "STATUSDATAFILE is empty" >> $DEBUG_FILE
++ echo "STATUSDATAFILE($f) is empty" >> $DEBUG_FILE
++ echo "Looking for STATUS file in $2" >> $DEBUG_FILE
+ f=$($GREP "^status_file=" $2 | $SED 's/.*=//')
+ fi
+ if [ -z "$f" ]; then
+@@ -82,6 +83,8 @@
+ APP=/bin/$1
+ elif [ -x /usr/bin/$1 ]; then
+ APP=/usr/bin/$1
++ elif [ -x /usr/local/bin/$1 ]; then
++ APP=/usr/local/bin/$1
+ else
+ APP=$1
+ fi
diff --git a/net-mgmt/victorops-nagios/files/patch-victorops.cron b/net-mgmt/victorops-nagios/files/patch-victorops.cron
new file mode 100644
index 000000000000..88850703ec07
--- /dev/null
+++ b/net-mgmt/victorops-nagios/files/patch-victorops.cron
@@ -0,0 +1,10 @@
+--- etc/cron.daily/victorops.orig 2014-06-11 12:49:42.035618811 -0500
++++ etc/cron.daily/victorops 2014-06-11 12:50:57.241605821 -0500
+@@ -1,5 +1,5 @@
+ #!/bin/sh
+
+ # Clean up old alerts
+-/usr/bin/find /var/nagios/emailed/ -mtime +7 -type f -delete
+-/usr/bin/find /var/nagios/forwarded/ -mtime +7 -type f -delete
++/usr/bin/find /var/spool/nagios/victorops/alerts/emailed/ -mtime +7 -type f -delete
++/usr/bin/find /var/spool/nagios/victorops/alerts/forwarded/ -mtime +7 -type f -delete
diff --git a/net-mgmt/victorops-nagios/files/qpage-patch b/net-mgmt/victorops-nagios/files/qpage-patch
new file mode 100644
index 000000000000..2055d8af2416
--- /dev/null
+++ b/net-mgmt/victorops-nagios/files/qpage-patch
@@ -0,0 +1,38 @@
+--- opt/victorops/nagios_plugin/bin/send_email_alert.orig 2014-06-11 10:39:13.918151547 -0500
++++ opt/victorops/nagios_plugin/bin/send_email_alert 2014-06-11 11:20:43.930977406 -0500
+@@ -31,6 +31,7 @@
+ # Build the contact email list
+ ORG_SLUG="$(getVal _CONTACTVO_ORGANIZATION_ID unkonwn_org)"
+ CONTACTEMAIL="$(getVal _CONTACTVO_CONTACTEMAIL)"
++CONTACTPAGER="$(getVal CONTACTPAGER)"
+ VO_CONTACT="failsafe+$ORG_SLUG@victorops.net"
+ WGET_LOG=/tmp/victorops_forward_wget.out
+ STDERR_LOG=/tmp/victorops_forward_wget.err
+@@ -42,10 +43,16 @@
+ if [ "$CONTACTEMAIL" != "" ]; then
+ $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
+ fi
++ if [ "$CONTACTPAGER" != "" ]; then
++ $PRINTF "%b" "$(getVal SERVICEDESC) $(getVal NOTIFICATIONTYPE) for $(getVal HOSTNAME) is $(getVal SERVICESTATE) at $(getVal TIME) $(getVal SERVICEOUTPUT)" | $QPAGE -f icinga $CONTACTPAGER
++ fi
+ else
+ if [ "$CONTACTEMAIL" != "" ]; then
+ $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
+ fi
++ if [ "$CONTACTPAGER" != "" ]; then
++ $PRINTF "%b" "$(getVal HOSTNAME) is $(getVal HOSTSTATE) at $(getVal TIME) -- $(getVal HOSTOUTPUT)" | $QPAGE -f icinga $CONTACTPAGER
++ fi
+ fi
+ # ***
+ # *** Make sure the mail command is the last thing in this file so the including file can check the exit code
+--- opt/victorops/nagios_plugin/bin/utils.orig 2014-06-16 20:12:16.713013963 -0500
++++ opt/victorops/nagios_plugin/bin/utils 2014-06-16 20:12:58.533005832 -0500
+@@ -110,6 +110,7 @@
+ MV=$(findApp mv)
+ PRINTF=$(findApp printf)
+ PS=$(findApp ps)
++QPAGE=$(findApp qpage)
+ SED=$(findApp sed)
+ SLEEP=$(findApp sleep)
+ TAR=$(findApp tar)
+
diff --git a/net-mgmt/victorops-nagios/pkg-descr b/net-mgmt/victorops-nagios/pkg-descr
new file mode 100644
index 000000000000..0e51f8f5b0c8
--- /dev/null
+++ b/net-mgmt/victorops-nagios/pkg-descr
@@ -0,0 +1,4 @@
+VictorOps is an on-call management and incident notification service.
+This is the Nagios/Icinga integration package for VictorOps.
+
+WWW: http://www.victorops.com
diff --git a/net-mgmt/victorops-nagios/pkg-message b/net-mgmt/victorops-nagios/pkg-message
new file mode 100644
index 000000000000..0ff13764388e
--- /dev/null
+++ b/net-mgmt/victorops-nagios/pkg-message
@@ -0,0 +1,11 @@
+========================================================================
+
+victorops-nagios requires that ca_root_nss be built with the option
+
+ ETCSYMLINK Add symlink to /etc/ssl/cert.pem
+
+enabled. With out that option, wget will complain that VictorOps'
+GoDaddy SSL certificate is a self-signed certificate, which will
+prevent VictorOps from working.
+
+========================================================================
diff --git a/net-mgmt/victorops-nagios/pkg-plist b/net-mgmt/victorops-nagios/pkg-plist
new file mode 100644
index 000000000000..243882034b80
--- /dev/null
+++ b/net-mgmt/victorops-nagios/pkg-plist
@@ -0,0 +1,22 @@
+etc/nagios/victorops.cfg-sample
+etc/nagios/victorops_email.cfg-sample
+etc/nagios/vo_test_svc.cfg-sample
+etc/nagios/vo_test_svc_cmd.cfg-sample
+etc/periodic/daily/400.victorops
+libexec/victorops/check_test_svc
+libexec/victorops/check_victorops_cmds
+libexec/victorops/check_victorops_forwarder
+libexec/victorops/do_victorops_heartbeat
+libexec/victorops/enqueue_alert
+libexec/victorops/forward_alert_file
+libexec/victorops/forward_alerts
+libexec/victorops/send_email_alert
+libexec/victorops/send_status
+libexec/victorops/stop_forwarder
+libexec/victorops/support_collect.sh
+libexec/victorops/url_encode.sed
+libexec/victorops/utils
+@dirrmtry etc/nagios
+@dirrmtry libexec/victorops
+@dirrmtry etc/periodic/daily
+@dirrmtry etc/periodic