aboutsummaryrefslogtreecommitdiffstats
path: root/net-mgmt/nagios-plugins
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2012-08-22 08:55:25 +0800
committerbdrewery <bdrewery@FreeBSD.org>2012-08-22 08:55:25 +0800
commit14717e0340cb134c33a2b99efe628aa9a426be60 (patch)
tree7c5acdfb10ac6b183c2b06d706a228dc127a0039 /net-mgmt/nagios-plugins
parent85e84e1f85522129c1003765b0329f6615741b4c (diff)
downloadfreebsd-ports-gnome-14717e0340cb134c33a2b99efe628aa9a426be60.tar.gz
freebsd-ports-gnome-14717e0340cb134c33a2b99efe628aa9a426be60.tar.zst
freebsd-ports-gnome-14717e0340cb134c33a2b99efe628aa9a426be60.zip
- Update to 1.4.16 [1]
- Use 1.4.15 version of check_users on non-utmpx systems [1] - Fix some locale issues [1] - Convert to new options framework - Remove versioned LIB_DEPENDS on net/radiusclient PR: ports/169977 [1] Submitted by: myself, maintainer Approved by: Jarrod Sayers <jarrod@downtools.com.au> (maintainer) Approved by: eadler (mentor)
Diffstat (limited to 'net-mgmt/nagios-plugins')
-rw-r--r--net-mgmt/nagios-plugins/Makefile55
-rw-r--r--net-mgmt/nagios-plugins/distinfo4
-rw-r--r--net-mgmt/nagios-plugins/files/extra-patch-plugins__check_users.c83
3 files changed, 116 insertions, 26 deletions
diff --git a/net-mgmt/nagios-plugins/Makefile b/net-mgmt/nagios-plugins/Makefile
index c775eac3321c..4e789a825779 100644
--- a/net-mgmt/nagios-plugins/Makefile
+++ b/net-mgmt/nagios-plugins/Makefile
@@ -6,8 +6,7 @@
#
PORTNAME= nagios-plugins
-PORTVERSION= 1.4.15
-PORTREVISION= 1
+PORTVERSION= 1.4.16
PORTEPOCH= 1
CATEGORIES= net-mgmt
MASTER_SITES= SF/nagiosplug/nagiosplug/${PORTVERSION}
@@ -21,15 +20,17 @@ USE_PERL5= yes
USE_AUTOTOOLS= libtool aclocal autoconf automake
ACLOCAL_ARGS= -I m4 -I gl/m4
-OPTIONS= QSTAT "Game server query support (check_game)" OFF \
- FPING "Support for non-flooding fast ping (check_fping)" OFF \
- NETSNMP "SNMP support (check_snmp)" OFF \
- RADIUS "Radius support (check_radius)" OFF \
- MYSQL "MySQL support (check_mysql)" OFF \
- PGSQL "PostgreSQL support (check_pgsql)" OFF \
- LDAP "OpenLDAP support (check_ldap)" OFF \
- IPV6 "IPv6 support" ON \
- JAIL "Compilation within jail(8) (see Makefile)" OFF
+OPTIONS_DEFINE= QSTAT FPING NETSNMP RADIUS MYSQL PGSQL LDAP IPV6 JAIL NLS
+OPTIONS_DEFAULT=IPV6
+
+QSTAT_DESC= Game server query support (check_game)
+FPING_DESC= Support for non-flooding fast ping (check_fping)
+NETSNMP_DESC= SNMP support (check_snmp)
+RADIUS_DESC= Radius support (check_radius)
+MYSQL_DESC= MySQL support (check_mysql)
+PGSQL_DESC= PostgreSQL support (check_pgsql)
+LDAP_DESC= OpenLDAP support (check_ldap)
+JAIL_DESC= Compilation within jail(8) (see Makefile)
GNU_CONFIGURE= yes
@@ -61,7 +62,7 @@ CPPFLAGS+= -I${LOCALBASE}/include
LDFLAGS+= -L${LOCALBASE}/lib
CFLAGS+= -I${LOCALBASE}/include
-.if defined(WITH_QSTAT)
+.if ${PORT_OPTIONS:MQSTAT}
BUILD_DEPENDS+= qstat:${PORTSDIR}/games/qstat
RUN_DEPENDS+= qstat:${PORTSDIR}/games/qstat
CONFIGURE_ARGS+= --enable-qstat
@@ -70,13 +71,13 @@ PLIST_SUB+= SUB_QSTAT=""
PLIST_SUB+= SUB_QSTAT="@comment "
.endif
-.if !defined(WITHOUT_IPV6)
+.if ${PORT_OPTIONS:MIPV6}
CONFIGURE_ARGS+= --with-ipv6
.else
CONFIGURE_ARGS+= --without-ipv6
.endif
-.if defined(WITH_FPING)
+.if ${PORT_OPTIONS:MFPING}
BUILD_DEPENDS+= fping:${PORTSDIR}/net/fping
RUN_DEPENDS+= fping:${PORTSDIR}/net/fping
CONFIGURE_ARGS+= --enable-fping
@@ -85,7 +86,7 @@ PLIST_SUB+= SUB_FPING=""
PLIST_SUB+= SUB_FPING="@comment "
.endif
-.if defined(WITH_NETSNMP)
+.if ${PORT_OPTIONS:MNETSNMP}
BUILD_DEPENDS+= snmpcheck:${PORTSDIR}/net-mgmt/net-snmp \
p5-Net-SNMP>=0:${PORTSDIR}/net-mgmt/p5-Net-SNMP
RUN_DEPENDS+= snmpcheck:${PORTSDIR}/net-mgmt/net-snmp \
@@ -96,15 +97,15 @@ PLIST_SUB+= SUB_SNMP=""
PLIST_SUB+= SUB_SNMP="@comment "
.endif
-.if defined(WITH_RADIUS)
-LIB_DEPENDS+= radiusclient-ng.2:${PORTSDIR}/net/radiusclient
+.if ${PORT_OPTIONS:MRADIUS}
+LIB_DEPENDS+= radiusclient-ng:${PORTSDIR}/net/radiusclient
CONFIGURE_ARGS+= --enable-radius
PLIST_SUB+= SUB_RADIUS=""
.else
PLIST_SUB+= SUB_RADIUS="@comment "
.endif
-.if defined(WITH_MYSQL)
+.if ${PORT_OPTIONS:MMYSQL}
USE_MYSQL= YES
CONFIGURE_ARGS+= --with-mysql=${LOCALBASE}
PLIST_SUB+= SUB_MYSQL=""
@@ -113,7 +114,7 @@ CONFIGURE_ARGS+= --without-mysql
PLIST_SUB+= SUB_MYSQL="@comment "
.endif
-.if defined(WITH_PGSQL)
+.if ${PORT_OPTIONS:MPGSQL}
USE_PGSQL= YES
CONFIGURE_ARGS+= --with-pgsql=${LOCALBASE}
PLIST_SUB+= SUB_PGSQL=""
@@ -122,7 +123,7 @@ CONFIGURE_ARGS+= --with-pgsql=${NONEXISTENT}
PLIST_SUB+= SUB_PGSQL="@comment "
.endif
-.if defined(WITH_LDAP)
+.if ${PORT_OPTIONS:MLDAP}
USE_OPENLDAP= YES
CONFIGURE_ARGS+= --enable-ldap
PLIST_SUB+= SUB_LDAP=""
@@ -130,7 +131,7 @@ PLIST_SUB+= SUB_LDAP=""
PLIST_SUB+= SUB_LDAP="@comment "
.endif
-.if defined(WITHOUT_NLS)
+.if empty(PORT_OPTIONS:MNLS)
CONFIGURE_ARGS+= --disable-nls
PLIST_SUB+= NLS="@comment "
.else
@@ -138,13 +139,19 @@ USE_GETTEXT= yes
PLIST_SUB+= NLS=""
.endif
+# Restore check_users from 1.4.15 for hosts without getutxent(3)
+.if ${OSVERSION} < 900007
+EXTRA_PATCHES+= ${FILESDIR}/extra-patch-plugins__check_users.c
+.endif
+
post-patch:
.for file in check_by_ssh.c check_disk.c check_http.c check_mrtgtraf.c \
- check_nagios.c check_pgsql.c check_snmp.c check_ssh.c check_swap.c \
- check_time.c check_users.c utils.c
+ check_nagios.c check_ntp.c check_ntp_peer.c check_ntp_time.c \
+ check_pgsql.c check_snmp.c check_ssh.c check_swap.c check_time.c \
+ check_users.c
@${REINPLACE_CMD} -e 's|setlocale (LC_ALL, "");|setlocale (LC_ALL, ""); setlocale(LC_NUMERIC, "C");|g' ${WRKSRC}/plugins/${file}
.endfor
-.if defined(WITH_JAIL)
+.if ${PORT_OPTIONS:MJAIL}
@${REINPLACE_CMD} -e 's# 127.0.0.1 # ${NAGIOSPOLLIP} #g' ${WRKSRC}/configure.in
@${REINPLACE_CMD} -e 's# ::1 # ${NAGIOSPOLLIP6} #g' ${WRKSRC}/configure.in
.endif
diff --git a/net-mgmt/nagios-plugins/distinfo b/net-mgmt/nagios-plugins/distinfo
index 599ba43bea67..12b7547d3167 100644
--- a/net-mgmt/nagios-plugins/distinfo
+++ b/net-mgmt/nagios-plugins/distinfo
@@ -1,2 +1,2 @@
-SHA256 (nagios-plugins-1.4.15.tar.gz) = 51136e5210e3664e1351550de3aff4a766d9d9fea9a24d09e37b3428ef96fa5b
-SIZE (nagios-plugins-1.4.15.tar.gz) = 2095419
+SHA256 (nagios-plugins-1.4.16.tar.gz) = b0caf07e0084e9b7f10fdd71cbd3ebabcd85ad78df64da360b51233b0e73b2bd
+SIZE (nagios-plugins-1.4.16.tar.gz) = 2087089
diff --git a/net-mgmt/nagios-plugins/files/extra-patch-plugins__check_users.c b/net-mgmt/nagios-plugins/files/extra-patch-plugins__check_users.c
new file mode 100644
index 000000000000..29f6211ab02e
--- /dev/null
+++ b/net-mgmt/nagios-plugins/files/extra-patch-plugins__check_users.c
@@ -0,0 +1,83 @@
+--- plugins/check_users.c.orig 2012-06-28 03:02:47.000000000 +0930
++++ plugins/check_users.c 2012-08-05 10:29:00.000000000 +0930
+@@ -35,8 +35,8 @@
+ const char *email = "nagiosplug-devel@lists.sourceforge.net";
+
+ #include "common.h"
++#include "popen.h"
+ #include "utils.h"
+-#include <utmpx.h>
+
+ #define possibly_set(a,b) ((a) == 0 ? (b) : 0)
+
+@@ -52,8 +52,8 @@
+ {
+ int users = -1;
+ int result = STATE_UNKNOWN;
++ char input_buffer[MAX_INPUT_BUFFER];
+ char *perf;
+- struct utmpx *putmpx;
+
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, LOCALEDIR);
+@@ -67,18 +67,43 @@
+ if (process_arguments (argc, argv) == ERROR)
+ usage4 (_("Could not parse arguments"));
+
++ /* run the command */
++ child_process = spopen (WHO_COMMAND);
++ if (child_process == NULL) {
++ printf (_("Could not open pipe: %s\n"), WHO_COMMAND);
++ return STATE_UNKNOWN;
++ }
++
++ child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
++ if (child_stderr == NULL)
++ printf (_("Could not open stderr for %s\n"), WHO_COMMAND);
++
+ users = 0;
+
+- /* get currently logged users from utmpx */
+- setutxent ();
++ while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) {
+
+- while ((putmpx = getutxent ()) != NULL)
+- if (putmpx->ut_type == USER_PROCESS)
++ /* increment 'users' on all lines except total user count */
++ if (input_buffer[0] != '#') {
+ users++;
++ continue;
++ }
++
++ /* get total logged in users */
++ if (sscanf (input_buffer, _("# users=%d"), &users) == 1)
++ break;
++
++ }
+
+- endutxent ();
++ /* check STDERR */
++ if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr))
++ result = possibly_set (result, STATE_UNKNOWN);
++ (void) fclose (child_stderr);
++
++ /* close the pipe */
++ if (spclose (child_process))
++ result = possibly_set (result, STATE_UNKNOWN);
+
+- /* check the user count against warning and critical thresholds */
++ /* else check the user count against warning and critical thresholds */
+ if (users > cusers)
+ result = STATE_CRITICAL;
+ else if (users > wusers)
+--- plugins/Makefile.am.orig 2012-06-28 03:02:47.000000000 +0930
++++ plugins/Makefile.am 2012-08-05 10:29:00.000000000 +0930
+@@ -101,7 +101,7 @@
+ check_time_LDADD = $(NETLIBS)
+ check_ntp_time_LDADD = $(NETLIBS) $(MATHLIBS)
+ check_ups_LDADD = $(NETLIBS)
+-check_users_LDADD = $(BASEOBJS)
++check_users_LDADD = $(BASEOBJS) popen.o
+ check_by_ssh_LDADD = $(NETLIBS)
+ check_ide_smart_LDADD = $(BASEOBJS)
+ negate_LDADD = $(BASEOBJS)