git: dd4201c282f9 - main - Bring back net-mgmt/py-pdagent-integrations & net-mgmt/py-pdagent

Dan Langille dvl at FreeBSD.org
Thu Apr 15 13:07:14 UTC 2021


The branch main has been updated by dvl:

URL: https://cgit.FreeBSD.org/ports/commit/?id=dd4201c282f9e65fd9fbaf28eda305a67fa12e9c

commit dd4201c282f9e65fd9fbaf28eda305a67fa12e9c
Author:     Dan Langille <dvl at FreeBSD.org>
AuthorDate: 2021-04-15 13:00:46 +0000
Commit:     Dan Langille <dvl at FreeBSD.org>
CommitDate: 2021-04-15 13:06:42 +0000

    Bring back net-mgmt/py-pdagent-integrations & net-mgmt/py-pdagent
    
    NOTE: net-mgmt/py-pdagent-integrations was previously
          net-mgmt/pdagent-integrations
    
    The PagerDuty Agent is a program that lets you easily integrate your
    monitoring system with PagerDuty.
    
    WWW: https://github.com/PagerDuty/pdagent
---
 MOVED                                              |  2 -
 net-mgmt/Makefile                                  |  2 +
 net-mgmt/py-pdagent-integrations/Makefile          | 46 +++++++++++
 net-mgmt/py-pdagent-integrations/distinfo          |  3 +
 .../files/pagerduty-icinga2.conf.in                | 91 ++++++++++++++++++++++
 .../py-pdagent-integrations/files/pkg-message.in   |  8 ++
 net-mgmt/py-pdagent-integrations/pkg-descr         | 10 +++
 net-mgmt/py-pdagent-integrations/pkg-plist         |  5 ++
 net-mgmt/py-pdagent/Makefile                       | 39 ++++++++++
 net-mgmt/py-pdagent/distinfo                       |  3 +
 net-mgmt/py-pdagent/files/pdagentd.in              | 46 +++++++++++
 net-mgmt/py-pdagent/pkg-descr                      |  4 +
 net-mgmt/py-pdagent/pkg-message                    |  8 ++
 net-mgmt/py-pdagent/pkg-plist                      | 21 +++++
 14 files changed, 286 insertions(+), 2 deletions(-)

diff --git a/MOVED b/MOVED
index 0fb1a423e971..d42a2407ecbc 100644
--- a/MOVED
+++ b/MOVED
@@ -13856,7 +13856,6 @@ net-im/py-jabber||2020-01-27|Has expired: Unmaintained, uses EOLed python27
 net-im/py-jabberbot||2020-01-27|Has expired: Unmaintained, uses EOLed python27
 net-im/py-libturpial||2020-01-27|Has expired: Unmaintained, uses EOLed python27
 net-im/py-xmpppy-irc||2020-01-27|Has expired: Unmaintained, uses EOLed python27
-net-mgmt/pdagent-integrations||2020-01-27|Has expired: Unmaintained, uses EOLed python27
 net-p2p/tribler||2020-01-27|Has expired: Unmaintained, uses EOLed python27
 news/papercut||2020-01-27|Has expired: Unmaintained, uses EOLed python27
 print/pkipplib||2020-01-27|Has expired: Unmaintained, uses EOLed python27
@@ -14426,7 +14425,6 @@ databases/py-cdb||2020-03-20|Has expired: Unmaintained, uses EOLed python27
 devel/py-mwlib||2020-03-20|Has expired: Unmaintained, uses EOLed python27
 graphics/py-soya3d||2020-03-20|Has expired: Unmaintained, uses EOLed python27
 irc/py-supybot||2020-03-20|Has expired: Unmaintained, uses EOLed python27
-net-mgmt/py-pdagent||2020-03-20|Has expired: Unmaintained, uses EOLed python27
 textproc/pychm||2020-03-20|Has expired: Unmaintained, uses EOLed python27
 x11/rxvt|x11/rxvt-unicode|2020-03-20|Has expired: Abandonware: stable release 2.6.4 / November 1, 2001 and no maintainer
 x11-wm/clementine-wm||2020-03-20|Removed, unmaintained and depends on expired x11/rxvt
diff --git a/net-mgmt/Makefile b/net-mgmt/Makefile
index 7c8a1d35e7cd..38b625291ea7 100644
--- a/net-mgmt/Makefile
+++ b/net-mgmt/Makefile
@@ -306,6 +306,8 @@
     SUBDIR += py-napalm-logs
     SUBDIR += py-ncclient
     SUBDIR += py-nxapi-plumbing
+    SUBDIR += py-pdagent
+    SUBDIR += py-pdagent-integrations
     SUBDIR += py-prometheus-client
     SUBDIR += py-pyIOSXR
     SUBDIR += py-pyang
diff --git a/net-mgmt/py-pdagent-integrations/Makefile b/net-mgmt/py-pdagent-integrations/Makefile
new file mode 100644
index 000000000000..e10ba4fb9c26
--- /dev/null
+++ b/net-mgmt/py-pdagent-integrations/Makefile
@@ -0,0 +1,46 @@
+PORTNAME=	pdagent-integrations
+PORTVERSION=	1.6.2
+DISTVERSIONPREFIX=v
+CATEGORIES=	net-mgmt python
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	ports at FreeBSD.org
+COMMENT=	PagerDuty integrations for monitoring monitoring tools
+
+LICENSE=	BSD3CLAUSE
+LICENSE_FILE=	${WRKSRC}/LICENSE.TXT
+
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pdagent>0:net-mgmt/py-pdagent@${PY_FLAVOR}
+
+USES=		python:3.7+ shebangfix
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	PagerDuty
+
+SHEBANG_FILES=	bin/*
+
+SUB_FILES=	pagerduty-icinga2.conf pkg-message
+
+NO_ARCH=	yes
+NO_BUILD=	yes
+PORTDOCS=	*-testing.txt
+EXAMPLES=	conf.d/sensu_pagerduty_handler.json \
+		pagerduty_nagios.cfg
+
+OPTIONS_DEFINE=	DOCS EXAMPLES
+
+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:
+	(cd ${WRKSRC}/bin ; ${INSTALL_SCRIPT} * ${STAGEDIR}${PREFIX}/bin)
+
+do-install-DOCS-on:
+	@${MKDIR} ${STAGEDIR}${DOCSDIR}
+	${INSTALL_DATA} ${PORTDOCS:S|^|${WRKSRC}/|} ${STAGEDIR}${DOCSDIR}
+
+do-install-EXAMPLES-on:
+	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
+	${INSTALL_DATA} ${EXAMPLES:S|^|${WRKSRC}/|} ${STAGEDIR}${EXAMPLESDIR}
+
+.include <bsd.port.mk>
diff --git a/net-mgmt/py-pdagent-integrations/distinfo b/net-mgmt/py-pdagent-integrations/distinfo
new file mode 100644
index 000000000000..89b551521754
--- /dev/null
+++ b/net-mgmt/py-pdagent-integrations/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1617288052
+SHA256 (PagerDuty-pdagent-integrations-v1.6.2_GH0.tar.gz) = 3df3e777958c1efdb26eb6848b0952b15fbe7a9a9ff878f0a691e26629c877f2
+SIZE (PagerDuty-pdagent-integrations-v1.6.2_GH0.tar.gz) = 16051
diff --git a/net-mgmt/py-pdagent-integrations/files/pagerduty-icinga2.conf.in b/net-mgmt/py-pdagent-integrations/files/pagerduty-icinga2.conf.in
new file mode 100644
index 000000000000..7e755cbe4fd6
--- /dev/null
+++ b/net-mgmt/py-pdagent-integrations/files/pagerduty-icinga2.conf.in
@@ -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
+}
diff --git a/net-mgmt/py-pdagent-integrations/files/pkg-message.in b/net-mgmt/py-pdagent-integrations/files/pkg-message.in
new file mode 100644
index 000000000000..d7b4a7b865a0
--- /dev/null
+++ b/net-mgmt/py-pdagent-integrations/files/pkg-message.in
@@ -0,0 +1,8 @@
+[
+{ type: install
+  message: <<EOM
+Sample configuration files for Nagios, Icinga and Sensu can be found in the
+%%EXAMPLESDIR%% directory.
+EOM
+}
+]
diff --git a/net-mgmt/py-pdagent-integrations/pkg-descr b/net-mgmt/py-pdagent-integrations/pkg-descr
new file mode 100644
index 000000000000..0afa2d75d901
--- /dev/null
+++ b/net-mgmt/py-pdagent-integrations/pkg-descr
@@ -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
diff --git a/net-mgmt/py-pdagent-integrations/pkg-plist b/net-mgmt/py-pdagent-integrations/pkg-plist
new file mode 100644
index 000000000000..f23c28fdffe4
--- /dev/null
+++ b/net-mgmt/py-pdagent-integrations/pkg-plist
@@ -0,0 +1,5 @@
+bin/pd-nagios
+bin/pd-sensu
+bin/pd-zabbix
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/pagerduty_nagios.cfg
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/sensu_pagerduty_handler.json
diff --git a/net-mgmt/py-pdagent/Makefile b/net-mgmt/py-pdagent/Makefile
new file mode 100644
index 000000000000..1a41c873d4a1
--- /dev/null
+++ b/net-mgmt/py-pdagent/Makefile
@@ -0,0 +1,39 @@
+PORTNAME=	pdagent
+PORTVERSION=	1.7.2
+DISTVERSIONPREFIX=v
+CATEGORIES=	net-mgmt python
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	ports at FreeBSD.org
+COMMENT=	PagerDuty Agent software
+
+LICENSE=	BSD3CLAUSE
+LICENSE_FILE=	${WRKSRC}/LICENSE.TXT
+
+USES=		python:3.7+ shebangfix
+USE_PYTHON=	flavors
+USE_RC_SUBR=	pdagentd
+USE_GITHUB=	yes
+
+GH_ACCOUNT=	PagerDuty
+SHEBANG_FILES=	bin/*
+NO_ARCH=	yes
+NO_BUILD=	yes
+
+SUB_LIST+=	PYTHON_CMD="${PYTHON_CMD}"
+BINFILES=	pd-queue pd-send pdagentd.py
+
+USERS=		pdagent
+GROUPS=		pdagent
+
+post-patch:
+	${REINPLACE_CMD} -e 's|/var/lib/pdagent|/var/db/pdagent| ; s|/etc|${ETCDIR}|' \
+		${WRKSRC}/pdagent/confdirs.py
+
+do-install:
+	${MKDIR} ${STAGEDIR}${PYTHON_SITELIBDIR} ${STAGEDIR}/${ETCDIR}
+	(cd ${WRKSRC} && ${COPYTREE_SHARE} pdagent ${STAGEDIR}${PYTHON_SITELIBDIR})
+	(cd ${WRKSRC}/bin ; ${INSTALL_SCRIPT} ${BINFILES} ${STAGEDIR}/${PREFIX}/bin)
+	${INSTALL_DATA} ${WRKSRC}/conf/pdagent.conf ${STAGEDIR}/${ETCDIR}/pdagent.conf.sample
+
+.include <bsd.port.mk>
diff --git a/net-mgmt/py-pdagent/distinfo b/net-mgmt/py-pdagent/distinfo
new file mode 100644
index 000000000000..92f14148de30
--- /dev/null
+++ b/net-mgmt/py-pdagent/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1617288043
+SHA256 (PagerDuty-pdagent-v1.7.2_GH0.tar.gz) = 17b126e662a39540a053e22743b717bfe86e2221587536c20ca67f60365ff63a
+SIZE (PagerDuty-pdagent-v1.7.2_GH0.tar.gz) = 247883
diff --git a/net-mgmt/py-pdagent/files/pdagentd.in b/net-mgmt/py-pdagent/files/pdagentd.in
new file mode 100644
index 000000000000..3705fbfd6275
--- /dev/null
+++ b/net-mgmt/py-pdagent/files/pdagentd.in
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+# Author: Mark Felder <feld at FreeBSD.org>
+#
+# $FreeBSD: head/net-mgmt/py-pdagent/files/pdagentd.in 466572 2018-04-05 17:11:39Z feld $
+#
+
+# PROVIDE: pdagentd
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+
+# Add the following lines to /etc/rc.conf to enable pdagentd:
+# pdagentd_enable="YES"
+
+. /etc/rc.subr
+
+name="pdagentd"
+rcvar=pdagentd_enable
+
+load_rc_config $name
+
+: ${pdagentd_enable="NO"}
+: ${pdagentd_user:="pdagent"}
+: ${pdagentd_group:="pdagent"}
+
+pidfile="/var/run/pdagent/pdagentd.pid"
+command="%%PREFIX%%/bin/pdagentd.py"
+start_precmd=pdagentd_precmd
+procname=%%PYTHON_CMD%%
+
+pdagent_mkdirs="/var/db/pdagent /var/db/pdagent/outqueue /var/db/pdagent/db /var/db/pdagent/outqueue/pdq \
+		/var/db/pdagent/outqueue/tmp /var/db/pdagent/outqueue/suc /var/db/pdagent/outqueue/err"
+
+pdagentd_precmd()
+{
+	for i in ${pdagent_mkdirs}; do
+		install -d -o ${pdagentd_user} -g ${pdagentd_group} -m 770 ${i}
+	done
+
+	chown -R ${pdagentd_user}:${pdagentd_group} /var/db/pdagent
+
+	install -d -o ${pdagentd_user} /var/log/pdagent
+	install -d -o ${pdagentd_user} /var/run/pdagent
+}
+
+run_rc_command "$1"
diff --git a/net-mgmt/py-pdagent/pkg-descr b/net-mgmt/py-pdagent/pkg-descr
new file mode 100644
index 000000000000..b3fb8a966ae0
--- /dev/null
+++ b/net-mgmt/py-pdagent/pkg-descr
@@ -0,0 +1,4 @@
+The PagerDuty Agent is a program that lets you easily integrate your
+monitoring system with PagerDuty.
+
+WWW: https://github.com/PagerDuty/pdagent
diff --git a/net-mgmt/py-pdagent/pkg-message b/net-mgmt/py-pdagent/pkg-message
new file mode 100644
index 000000000000..5cc0bf90e47a
--- /dev/null
+++ b/net-mgmt/py-pdagent/pkg-message
@@ -0,0 +1,8 @@
+[
+{ type: install
+  message: <<EOM
+You must add the required users and service accounts to the pdagent
+group to permit write access to /var/db/pdagent.
+EOM
+}
+]
diff --git a/net-mgmt/py-pdagent/pkg-plist b/net-mgmt/py-pdagent/pkg-plist
new file mode 100644
index 000000000000..02c3968d110a
--- /dev/null
+++ b/net-mgmt/py-pdagent/pkg-plist
@@ -0,0 +1,21 @@
+bin/pd-queue
+bin/pd-send
+bin/pdagentd.py
+ at sample etc/pdagent/pdagent.conf.sample
+%%PYTHON_SITELIBDIR%%/pdagent/__init__.py
+%%PYTHON_SITELIBDIR%%/pdagent/confdirs.py
+%%PYTHON_SITELIBDIR%%/pdagent/config.py
+%%PYTHON_SITELIBDIR%%/pdagent/constants.py
+%%PYTHON_SITELIBDIR%%/pdagent/heartbeat.py
+%%PYTHON_SITELIBDIR%%/pdagent/http.py
+%%PYTHON_SITELIBDIR%%/pdagent/jsonstore.py
+%%PYTHON_SITELIBDIR%%/pdagent/pdagentutil.py
+%%PYTHON_SITELIBDIR%%/pdagent/pdqueue.py
+%%PYTHON_SITELIBDIR%%/pdagent/pdthread.py
+%%PYTHON_SITELIBDIR%%/pdagent/root_certs/ca_certs.pem
+%%PYTHON_SITELIBDIR%%/pdagent/sendevent.py
+%%PYTHON_SITELIBDIR%%/pdagent/thirdparty/__init__.py
+%%PYTHON_SITELIBDIR%%/pdagent/thirdparty/argparse.py
+%%PYTHON_SITELIBDIR%%/pdagent/thirdparty/daemon.py
+%%PYTHON_SITELIBDIR%%/pdagent/thirdparty/filelock.py
+%%PYTHON_SITELIBDIR%%/pdagent/thirdparty/six.py


More information about the dev-commits-ports-all mailing list