1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-24 00:45:52 +00:00

Resurrect net-mgmt/nagios-pf-plugin

This port was removed due to lack of public distfiles.  A new source
has been found at GitHub, and the submitter becomes its new maintainer.

PR:		188325
Submitted by:	rand (iteris.com)
Minor tweaks:	marino
This commit is contained in:
John Marino 2014-06-11 09:07:56 +00:00
parent 21d11f88f4
commit f466006dd0
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=357436
7 changed files with 131 additions and 0 deletions

View File

@ -130,6 +130,7 @@
SUBDIR += nagios-check_puppet
SUBDIR += nagios-check_smartmon
SUBDIR += nagios-check_tftp
SUBDIR += nagios-pf-plugin
SUBDIR += nagios-geom
SUBDIR += nagios-openldap-plugins
SUBDIR += nagios-plugins

View File

@ -0,0 +1,26 @@
# Created by: Kian Mohageri <kian.mohageri@gmail.com>
# $FreeBSD$
PORTNAME= nagios-pf-plugin
PORTVERSION= 0.1
PORTREVISION= 2
CATEGORIES= net-mgmt
DISTNAME= check_pf-${PORTVERSION}
MAINTAINER= rand@iteris.com
COMMENT= Nagios plugin for checking PF
USE_GITHUB= yes
GH_ACCOUNT= kian
GH_PROJECT= nagios-pf-plugin
GH_TAGNAME= ${GH_COMMIT}
GH_COMMIT= 2aba423
PLIST_FILES= libexec/nagios/check_pf
PLIST_DIRS= libexec/nagios/
SUB_FILES= pkg-message
pre-su-install:
@${MKDIR} ${STAGEDIR}${PREFIX}/libexec/nagios
.include <bsd.port.mk>

View File

@ -0,0 +1,2 @@
SHA256 (check_pf-0.1.tar.gz) = 5a6a5a2cdfed35bf1f07a8a49b139a7e423fb6cc06403aabc1fc1609c5d8782d
SIZE (check_pf-0.1.tar.gz) = 3145

View File

@ -0,0 +1,11 @@
--- Makefile.old 2014-04-06 14:08:46.000000000 -0500
+++ Makefile 2014-04-06 14:08:47.000000000 -0500
@@ -14,7 +14,7 @@
$(CC) $(CFLAGS) -o $(PROGRAM) $(PROGRAM).c
install:
- install -m 755 -o root -g wheel $(PROGRAM) $(DESTDIR)/$(PROGRAM)
+ install -m 755 -o root -g wheel $(PROGRAM) $(DESTDIR)/$(PREFIX)/libexec/nagios
uninstall:
rm -f $(DESTDIR)/$(PROGRAM)

View File

@ -0,0 +1,64 @@
--- check_pf.c.orig 2014-04-05 18:32:50.000000000 -0500
+++ check_pf.c 2014-04-05 18:44:27.000000000 -0500
@@ -65,10 +65,13 @@
const char *errstr;
const char *pf_device;
const char *msg;
+ char *pctindex;
float percent;
int ch, wflag, cflag, dev;
int states_warning;
int states_critical;
+ int default_warn_percent=DEFAULT_WARN_PERCENT;
+ int default_crit_percent=DEFAULT_CRIT_PERCENT;
int ret;
pf_device = "/dev/pf";
@@ -85,16 +88,30 @@
help();
break;
case 'w':
- wflag = 1;
- states_warning = strtonum(optarg, 0, UINT_MAX, &errstr);
+ pctindex = strchr(optarg, '%');
+ if(pctindex) {
+ /* Ends in a %, treat as a percentage */
+ *pctindex = '\0';
+ default_warn_percent = strtonum(optarg, 0, 100, &errstr);
+ } else {
+ wflag = 1;
+ states_warning = strtonum(optarg, 0, UINT_MAX, &errstr);
+ }
if (errstr) {
printf("PF UNKNOWN - -w is %s: %s\n", errstr, optarg);
return (STATE_UNKNOWN);
}
break;
case 'c':
- cflag = 1;
- states_critical = strtonum(optarg, 0, UINT_MAX, &errstr);
+ pctindex = strchr(optarg, '%');
+ if(pctindex) {
+ /* Ends in a %, treat as a percentage */
+ *pctindex = '\0';
+ default_crit_percent = strtonum(optarg, 0, 100, &errstr);
+ } else {
+ cflag = 1;
+ states_critical = strtonum(optarg, 0, UINT_MAX, &errstr);
+ }
if (errstr) {
printf("PF UNKNOWN - -c is %s: %s\n", errstr, optarg);
return (STATE_UNKNOWN);
@@ -128,10 +145,10 @@
/* default thresholds will be based on the current state limit */
if (!wflag)
- states_warning = pl.limit * DEFAULT_WARN_PERCENT / 100;
+ states_warning = pl.limit * default_warn_percent / 100;
if (!cflag)
- states_critical = pl.limit * DEFAULT_CRIT_PERCENT / 100;
+ states_critical = pl.limit * default_crit_percent / 100;
if (states_warning >= states_critical) {
printf("PF UNKNOWN - <warning> must be less than <critical>\n");

View File

@ -0,0 +1,21 @@
check_pf has been installed to %%PREFIX%%/libexec/nagios.
check_pf needs read permission to the pf(4) pseudo-device, i.e. /dev/pf.
Assuming check_pf will be run by user `nagios', the following will work:
# chmod 640 /dev/pf
# chgrp nagios /dev/pf
To make sure the change persists across reboots, add the following
to /etc/devfs.conf:
# nrpe2/nagios needs to be able to read statistics
own pf root:nagios
perm pf 0640
Please refer to the online documentation for additional information.
https://github.com/kian/nagios-pf-plugin/

View File

@ -0,0 +1,6 @@
check_pf is a plugin intended for use with the Nagios network
monitoring system. This plugin checks the status of PF, the OpenBSD
packet filter, and compares the current state count to given or default
thresholds, returning the result. It is written in C.
WWW: https://github.com/kian/nagios-pf-plugin/