From dd4201c282f9e65fd9fbaf28eda305a67fa12e9c Mon Sep 17 00:00:00 2001 From: Dan Langille Date: Thu, 15 Apr 2021 13:00:46 +0000 Subject: 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(-) create mode 100644 net-mgmt/py-pdagent-integrations/Makefile create mode 100644 net-mgmt/py-pdagent-integrations/distinfo create mode 100644 net-mgmt/py-pdagent-integrations/files/pagerduty-icinga2.conf.in create mode 100644 net-mgmt/py-pdagent-integrations/files/pkg-message.in create mode 100644 net-mgmt/py-pdagent-integrations/pkg-descr create mode 100644 net-mgmt/py-pdagent-integrations/pkg-plist create mode 100644 net-mgmt/py-pdagent/Makefile create mode 100644 net-mgmt/py-pdagent/distinfo create mode 100644 net-mgmt/py-pdagent/files/pdagentd.in create mode 100644 net-mgmt/py-pdagent/pkg-descr create mode 100644 net-mgmt/py-pdagent/pkg-message create mode 100644 net-mgmt/py-pdagent/pkg-plist 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@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 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: < 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 +# +# $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: <