From owner-freebsd-ports-bugs@FreeBSD.ORG Sun Apr 6 20:00:00 2014 Return-Path: Delivered-To: freebsd-ports-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C77835B1 for ; Sun, 6 Apr 2014 20:00:00 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9E9AC61E for ; Sun, 6 Apr 2014 20:00:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.8/8.14.8) with ESMTP id s36K00Lr011734 for ; Sun, 6 Apr 2014 20:00:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.8/8.14.8/Submit) id s36K00qB011733; Sun, 6 Apr 2014 20:00:00 GMT (envelope-from gnats) Resent-Date: Sun, 6 Apr 2014 20:00:00 GMT Resent-Message-Id: <201404062000.s36K00qB011733@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Douglas K. Rand" Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EADFB3A7 for ; Sun, 6 Apr 2014 19:51:59 +0000 (UTC) Received: from newman.meridian-enviro.com (newman.meridian-enviro.com [12.192.92.56]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 76F893D5 for ; Sun, 6 Apr 2014 19:51:58 +0000 (UTC) Received: from venus.meridian-enviro.com (venus.meridian-enviro.com [12.192.93.14]) by newman.meridian-enviro.com (8.13.6/8.13.6) with ESMTP id s36JTMBe080729; Sun, 6 Apr 2014 14:29:22 -0500 (CDT) (envelope-from rand@venus.meridian-enviro.com) Received: from venus.meridian-enviro.com (localhost [127.0.0.1]) by venus.meridian-enviro.com (8.14.7/8.14.7) with ESMTP id s36JSt5T021778; Sun, 6 Apr 2014 14:29:00 -0500 (CDT) (envelope-from rand@venus.meridian-enviro.com) Received: (from root@localhost) by venus.meridian-enviro.com (8.14.7/8.14.7/Submit) id s36JSt4l021777; Sun, 6 Apr 2014 14:28:55 -0500 (CDT) (envelope-from rand) Message-Id: <201404061928.s36JSt4l021777@venus.meridian-enviro.com> Date: Sun, 6 Apr 2014 14:28:55 -0500 (CDT) From: "Douglas K. Rand" To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.114 Subject: ports/188325: Resurrecting the nagios-pf-plugin port Cc: kian.mohageri@gmail.com X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list Reply-To: "Douglas K. Rand" List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Apr 2014 20:00:00 -0000 >Number: 188325 >Category: ports >Synopsis: Resurrecting the nagios-pf-plugin port >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Apr 06 20:00:00 UTC 2014 >Closed-Date: >Last-Modified: >Originator: Douglas K. Rand >Release: FreeBSD 9.2-RELEASE-p3 i386 >Organization: Iteris Inc. >Environment: System: FreeBSD venus.meridian-enviro.com 9.2-RELEASE-p3 FreeBSD 9.2-RELEASE-p3 #2 r264082: Thu Apr 3 17:51:22 CDT 2014 rand@venus.meridian-enviro.com:/usr/obj/usr/src/sys/FIREWALL i386 >Description: The nagios-pf-plugin port was expired as the website was no longer operating. But the project on GitHub is up. I re did the port to use GitHub. >How-To-Repeat: Wish to monitor how many pf state table entries are in use with Nagios. >Fix: # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # nagios-pf-plugin # nagios-pf-plugin/files # nagios-pf-plugin/files/pkg-message.in # nagios-pf-plugin/files/patch-check_pf.c # nagios-pf-plugin/files/patch-Makefile # nagios-pf-plugin/Makefile # nagios-pf-plugin/distinfo # nagios-pf-plugin/pkg-descr # echo c - nagios-pf-plugin mkdir -p nagios-pf-plugin > /dev/null 2>&1 echo c - nagios-pf-plugin/files mkdir -p nagios-pf-plugin/files > /dev/null 2>&1 echo x - nagios-pf-plugin/files/pkg-message.in sed 's/^X//' >nagios-pf-plugin/files/pkg-message.in << '00e02b91c310aa8d0ebfb5ba10abd493' X Xcheck_pf has been installed to %%PREFIX%%/libexec/nagios. X Xcheck_pf needs read permission to the pf(4) pseudo-device, i.e. /dev/pf. X XAssuming check_pf will be run by user `nagios', the following will work: X X # chmod 640 /dev/pf X # chgrp nagios /dev/pf X XTo make sure the change persists across reboots, add the following Xto /etc/devfs.conf: X X # nrpe2/nagios needs to be able to read statistics X own pf root:nagios X perm pf 0640 X XPlease refer to the online documentation for additional information. X Xhttps://github.com/kian/nagios-pf-plugin/ X 00e02b91c310aa8d0ebfb5ba10abd493 echo x - nagios-pf-plugin/files/patch-check_pf.c sed 's/^X//' >nagios-pf-plugin/files/patch-check_pf.c << 'b3749c04de0483a38b1a2c661f907a7c' X--- check_pf.c.orig 2014-04-05 18:32:50.000000000 -0500 X+++ check_pf.c 2014-04-05 18:44:27.000000000 -0500 X@@ -65,10 +65,13 @@ X const char *errstr; X const char *pf_device; X const char *msg; X+ char *pctindex; X float percent; X int ch, wflag, cflag, dev; X int states_warning; X int states_critical; X+ int default_warn_percent=DEFAULT_WARN_PERCENT; X+ int default_crit_percent=DEFAULT_CRIT_PERCENT; X int ret; X X pf_device = "/dev/pf"; X@@ -85,16 +88,30 @@ X help(); X break; X case 'w': X- wflag = 1; X- states_warning = strtonum(optarg, 0, UINT_MAX, &errstr); X+ pctindex = strchr(optarg, '%'); X+ if(pctindex) { X+ /* Ends in a %, treat as a percentage */ X+ *pctindex = '\0'; X+ default_warn_percent = strtonum(optarg, 0, 100, &errstr); X+ } else { X+ wflag = 1; X+ states_warning = strtonum(optarg, 0, UINT_MAX, &errstr); X+ } X if (errstr) { X printf("PF UNKNOWN - -w is %s: %s\n", errstr, optarg); X return (STATE_UNKNOWN); X } X break; X case 'c': X- cflag = 1; X- states_critical = strtonum(optarg, 0, UINT_MAX, &errstr); X+ pctindex = strchr(optarg, '%'); X+ if(pctindex) { X+ /* Ends in a %, treat as a percentage */ X+ *pctindex = '\0'; X+ default_crit_percent = strtonum(optarg, 0, 100, &errstr); X+ } else { X+ cflag = 1; X+ states_critical = strtonum(optarg, 0, UINT_MAX, &errstr); X+ } X if (errstr) { X printf("PF UNKNOWN - -c is %s: %s\n", errstr, optarg); X return (STATE_UNKNOWN); X@@ -128,10 +145,10 @@ X X /* default thresholds will be based on the current state limit */ X if (!wflag) X- states_warning = pl.limit * DEFAULT_WARN_PERCENT / 100; X+ states_warning = pl.limit * default_warn_percent / 100; X X if (!cflag) X- states_critical = pl.limit * DEFAULT_CRIT_PERCENT / 100; X+ states_critical = pl.limit * default_crit_percent / 100; X X if (states_warning >= states_critical) { X printf("PF UNKNOWN - must be less than \n"); b3749c04de0483a38b1a2c661f907a7c echo x - nagios-pf-plugin/files/patch-Makefile sed 's/^X//' >nagios-pf-plugin/files/patch-Makefile << 'd0e023e144601fedea445dcb2ede9134' X--- Makefile.old 2014-04-06 14:08:46.000000000 -0500 X+++ Makefile 2014-04-06 14:08:47.000000000 -0500 X@@ -14,7 +14,7 @@ X $(CC) $(CFLAGS) -o $(PROGRAM) $(PROGRAM).c X X install: X- install -m 755 -o root -g wheel $(PROGRAM) $(DESTDIR)/$(PROGRAM) X+ install -m 755 -o root -g wheel $(PROGRAM) $(DESTDIR)/$(PREFIX)/libexec/nagios X X uninstall: X rm -f $(DESTDIR)/$(PROGRAM) d0e023e144601fedea445dcb2ede9134 echo x - nagios-pf-plugin/Makefile sed 's/^X//' >nagios-pf-plugin/Makefile << '04f81788f4ca263c1d4077a3715c22b0' X# Created by: Kian Mohageri X# $FreeBSD: net-mgmt/nagios-pf-plugin/Makefile 327757 2013-09-20 22:24:43Z bapt $ X XPORTNAME= nagios-pf-plugin XPORTVERSION= 0.1 XPORTREVISION= 1 XCATEGORIES= net-mgmt XDISTNAME= check_pf-${PORTVERSION} X XMAINTAINER= rand@iteris.com XCOMMENT= Nagios plugin for checking PF X XMASTER_SITES= https://github.com/kian/nagios-pf-plugin/tarball/${GH_COMMIT}/check_pf-0.1.tar.gz?dummy=/ XUSE_GITHUB= YES XGH_ACCOUNT= kian XGH_PROJECT= nagios-pf-plugin XGH_COMMIT= 2aba423 X XPLIST_FILES= libexec/nagios/check_pf XPLIST_DIRS= libexec/nagios/ XSUB_FILES= pkg-message X Xpre-su-install: X @${MKDIR} ${STAGEDIR}${PREFIX}/libexec/nagios X X.include 04f81788f4ca263c1d4077a3715c22b0 echo x - nagios-pf-plugin/distinfo sed 's/^X//' >nagios-pf-plugin/distinfo << '9ef3fe2f65e1746cd7ecf981864146a9' XSHA256 (check_pf-0.1.tar.gz) = 5a6a5a2cdfed35bf1f07a8a49b139a7e423fb6cc06403aabc1fc1609c5d8782d XSIZE (check_pf-0.1.tar.gz) = 3145 9ef3fe2f65e1746cd7ecf981864146a9 echo x - nagios-pf-plugin/pkg-descr sed 's/^X//' >nagios-pf-plugin/pkg-descr << 'e5f5d0000e588529cb73e899b9e45a89' Xcheck_pf is a plugin intended for use with the Nagios network Xmonitoring system. This plugin checks the status of PF, the OpenBSD Xpacket filter, and compares the current state count to given or default Xthresholds, returning the result. It is written in C. X XWWW: https://github.com/kian/nagios-pf-plugin/ e5f5d0000e588529cb73e899b9e45a89 exit >Release-Note: >Audit-Trail: >Unformatted: