Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Oct 2017 18:35:51 +0000 (UTC)
From:      Mark Felder <feld@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r451330 - in head/net-mgmt: . pdagent-integrations pdagent-integrations/files
Message-ID:  <201710051835.v95IZpKf097750@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: feld
Date: Thu Oct  5 18:35:51 2017
New Revision: 451330
URL: https://svnweb.freebsd.org/changeset/ports/451330

Log:
  This project contains integrations for various monitoring tools with
  the PagerDuty Agent.
  
  It currently includes support for:
  
      Nagios
      Sensu
      Zabbix
  
  WWW: https://github.com/PagerDuty/pdagent-integrations

Added:
  head/net-mgmt/pdagent-integrations/
  head/net-mgmt/pdagent-integrations/Makefile   (contents, props changed)
  head/net-mgmt/pdagent-integrations/distinfo   (contents, props changed)
  head/net-mgmt/pdagent-integrations/files/
  head/net-mgmt/pdagent-integrations/files/pagerduty-icinga2.conf.in   (contents, props changed)
  head/net-mgmt/pdagent-integrations/files/patch-bin_pd-nagios   (contents, props changed)
  head/net-mgmt/pdagent-integrations/files/pkg-message.in   (contents, props changed)
  head/net-mgmt/pdagent-integrations/pkg-descr   (contents, props changed)
  head/net-mgmt/pdagent-integrations/pkg-plist   (contents, props changed)
Modified:
  head/net-mgmt/Makefile

Modified: head/net-mgmt/Makefile
==============================================================================
--- head/net-mgmt/Makefile	Thu Oct  5 18:19:09 2017	(r451329)
+++ head/net-mgmt/Makefile	Thu Oct  5 18:35:51 2017	(r451330)
@@ -277,6 +277,7 @@
     SUBDIR += pandorafms_agent
     SUBDIR += pandorafms_console
     SUBDIR += pandorafms_server
+    SUBDIR += pdagent-integrations
     SUBDIR += percona-monitoring-plugins
     SUBDIR += pftabled
     SUBDIR += php56-snmp

Added: head/net-mgmt/pdagent-integrations/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/pdagent-integrations/Makefile	Thu Oct  5 18:35:51 2017	(r451330)
@@ -0,0 +1,40 @@
+# Created by: Mark Felder <feld@FreeBSD.org>
+# $FreeBSD$
+
+PORTNAME=	pdagent-integrations
+PORTVERSION=	1.4
+DISTVERSIONPREFIX=v
+CATEGORIES=	net-mgmt python
+
+MAINTAINER=	feld@FreeBSD.org
+COMMENT=	PagerDuty integrations for monitoring monitoring tools
+
+LICENSE=	BSD3CLAUSE
+
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pdagent>0:net-mgmt/py-pdagent
+
+USES=	python shebangfix
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	PagerDuty
+
+SHEBANG_FILES=	bin/*
+
+SUB_FILES=	pagerduty-icinga2.conf pkg-message
+
+NO_ARCH=	yes
+NO_BUILD=	yes
+
+post-patch:
+	${REINPLACE_CMD} 's|/usr/share/pdagent-integrations/bin|${PREFIX}/bin|g' ${WRKSRC}/pagerduty_nagios.cfg ${WRKSRC}/conf.d/sensu_pagerduty_handler.json
+
+do-install:
+	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
+	${INSTALL_SCRIPT} ${WRKSRC}/bin/pd-nagios ${STAGEDIR}${LOCALBASE}/bin
+	${INSTALL_SCRIPT} ${WRKSRC}/bin/pd-sensu ${STAGEDIR}${LOCALBASE}/bin
+	${INSTALL_SCRIPT} ${WRKSRC}/bin/pd-zabbix ${STAGEDIR}${LOCALBASE}/bin
+	${INSTALL_DATA} ${WRKSRC}/conf.d/sensu_pagerduty_handler.json ${STAGEDIR}${EXAMPLESDIR}
+	${INSTALL_DATA} ${WRKSRC}/pagerduty_nagios.cfg ${STAGEDIR}${EXAMPLESDIR}
+	${INSTALL_DATA} ${WRKDIR}/pagerduty-icinga2.conf ${STAGEDIR}${EXAMPLESDIR}
+
+.include <bsd.port.mk>

Added: head/net-mgmt/pdagent-integrations/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/pdagent-integrations/distinfo	Thu Oct  5 18:35:51 2017	(r451330)
@@ -0,0 +1,3 @@
+TIMESTAMP = 1507219750
+SHA256 (PagerDuty-pdagent-integrations-v1.4_GH0.tar.gz) = f4d18b1759ee0dfdcff4dd10f73c2bd3dd5d1ef0e2629141edd5f07f32c6e4f1
+SIZE (PagerDuty-pdagent-integrations-v1.4_GH0.tar.gz) = 17643

Added: head/net-mgmt/pdagent-integrations/files/pagerduty-icinga2.conf.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/pdagent-integrations/files/pagerduty-icinga2.conf.in	Thu Oct  5 18:35:51 2017	(r451330)
@@ -0,0 +1,91 @@
+object User "pagerduty" {
+  pager = "YOUR-INTEGRATION-KEY-HERE"
+  groups = [ "icingaadmins" ]
+  display_name = "PagerDuty Notification User"
+  states = [ OK, Warning, Critical, Unknown, Up, Down ]
+  types = [ Problem, Acknowledgement, Recovery ]
+}
+
+object NotificationCommand "notify-service-by-pagerduty" {
+  import "plugin-notification-command"
+  command = [ "%%PREFIX%%/bin/pd-nagios" ]
+  arguments = {
+    "-n" = {
+      order = 0
+      value = "service"
+    }
+    "-k" = {
+      order = 1
+      value = "$user.pager$"
+    }
+    "-t" = {
+      order = 2
+      value = "$notification.type$"
+    }
+    "-f" = {
+      order = 3
+      repeat_key = true
+      value = "$f_args$"
+    }
+  }
+  
+  vars.f_args = [
+    "SERVICEDESC=$service.name$",
+    "SERVICEDISPLAYNAME=$service.display_name$",
+    "HOSTNAME=$host.name$",
+    "HOSTSTATE=$host.state$",
+    "HOSTDISPLAYNAME=$host.display_name$",
+    "SERVICESTATE=$service.state$",
+    "SERVICEPROBLEMID=$service.state_id$",
+    "SERVICEOUTPUT=$service.output$" 
+  ]
+}
+
+object NotificationCommand "notify-host-by-pagerduty" {
+  import "plugin-notification-command"
+  command = [ "%%PREFIX%%/bin/pd-nagios" ]
+  arguments = {
+    "-n" = {
+      order = 0
+      value = "host"
+    }
+    "-k" = {
+      order = 1
+      value = "$user.pager$"
+    }
+    "-t" = {
+      order = 2
+      value = "$notification.type$"
+    }
+    "-f" = {
+      order = 3
+      repeat_key = true
+      value = "$f_args$"
+    }
+  }
+
+  vars.f_args = [
+    "HOSTNAME=$host.name$",
+    "HOSTSTATE=$host.state$",
+    "HOSTPROBLEMID=$host.state_id$",
+    "HOSTOUTPUT=$host.output$"
+  ]
+}
+
+apply Notification "pagerduty-service" to Service {
+  command = "notify-service-by-pagerduty"
+  states = [ OK, Warning, Critical, Unknown ]
+  types = [ Problem, Acknowledgement, Recovery ]
+  period = "24x7"
+  users = [ "pagerduty" ]
+  assign where service.vars.enable_pagerduty == true
+}
+
+apply Notification "pagerduty-host" to Host {
+  command = "notify-host-by-pagerduty"
+  states = [ Up, Down ]
+  types = [ Problem, Acknowledgement, Recovery ]
+  period = "24x7" 
+  users = [ "pagerduty" ]
+  assign where host.vars.enable_pagerduty == true
+}

Added: head/net-mgmt/pdagent-integrations/files/patch-bin_pd-nagios
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/pdagent-integrations/files/patch-bin_pd-nagios	Thu Oct  5 18:35:51 2017	(r451330)
@@ -0,0 +1,11 @@
+--- bin/pd-nagios.orig	2017-10-05 18:21:38 UTC
++++ bin/pd-nagios
+@@ -101,7 +101,7 @@ class NagiosEvent:
+         if not NagiosEvent.REQUIRED_FIELDS[self._notification_type].issubset(self._details.keys()):
+             msg = "Missing fields for type '{0}'.  {1} required".format(
+                 self._notification_type,
+-                ", ".join(self._required_fields())
++                ", ".join(NagiosEvent.REQUIRED_FIELDS[self._notification_type])
+                 )
+             raise ValueError(msg)
+ 

Added: head/net-mgmt/pdagent-integrations/files/pkg-message.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/pdagent-integrations/files/pkg-message.in	Thu Oct  5 18:35:51 2017	(r451330)
@@ -0,0 +1,2 @@
+Sample configuration files for Nagios, Icinga and Sensu can be found in the
+%%EXAMPLESDIR%% directory.

Added: head/net-mgmt/pdagent-integrations/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/pdagent-integrations/pkg-descr	Thu Oct  5 18:35:51 2017	(r451330)
@@ -0,0 +1,10 @@
+This project contains integrations for various monitoring tools with
+the PagerDuty Agent.
+
+It currently includes support for:
+
+    Nagios
+    Sensu
+    Zabbix
+
+WWW: https://github.com/PagerDuty/pdagent-integrations

Added: head/net-mgmt/pdagent-integrations/pkg-plist
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/pdagent-integrations/pkg-plist	Thu Oct  5 18:35:51 2017	(r451330)
@@ -0,0 +1,6 @@
+bin/pd-nagios
+bin/pd-sensu
+bin/pd-zabbix
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/pagerduty_nagios.cfg
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/pagerduty-icinga2.conf
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/sensu_pagerduty_handler.json



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710051835.v95IZpKf097750>