- Fix parameters passed to /bin/ps which is used by check_procs and check_nagios

- Port change: support environment value NAGIOS_PLUGINS_OPTIONS which can be used
  to preselect compile options

PR:		ports/65144
Submitted by:	Blaz Zupan <blaz.zupan@amis.net> (maintainer)
This commit is contained in:
Pav Lucistnik 2004-04-17 22:24:55 +00:00
parent fe31eb5e25
commit 56657359d6
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=107380
3 changed files with 60 additions and 25 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= nagios-plugins
PORTVERSION= 1.3.1
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= net-mgmt
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= nagiosplug

View File

@ -1,5 +1,5 @@
--- configure.in.orig Fri Jul 11 08:12:23 2003
+++ configure.in Sun Jul 13 13:13:37 2003
+++ configure.in Sun Apr 4 01:03:13 2004
@@ -12,7 +12,7 @@
AM_INIT_AUTOMAKE(nagios-plugins,${PACKAGE_VERSION})
AM_CONFIG_HEADER(plugins/config.h plugins/common.h plugins/version.h plugins/netutils.h plugins/utils.h plugins/popen.h)
@ -79,7 +79,33 @@
LIBS="$_SAVEDLIBS"
dnl Check for OpenSSL location
@@ -841,6 +852,8 @@
@@ -418,9 +429,24 @@
fi
AC_PATH_PROG(PATH_TO_PS,ps)
+dnl For FreeBSD
+dnl STAT UCOMM VSZ RSS USER PPID COMMAND
+if ps -axwo 'stat ucomm vsz rss user uid ppid command' 2>/dev/null | egrep -i ["^ *STAT +UCOMM +VSZ +RSS +USER +UID +PPID +COMMAND"] > /dev/null
+then
+ AC_DEFINE(USE_PS_VARS,1,[Define if 'ps' will be parsed with sscanf])
+ AC_DEFINE_UNQUOTED(PS_VARLIST,[procstat,&procuid,&procppid,procprog,&pos],[Variable list for sscanf of 'ps' output])
+ AC_DEFINE_UNQUOTED(PS_RAW_COMMAND,"$PATH_TO_PS -axwo 'stat uid ppid command'",[Verbatim command to execute for ps in check_netsaint])
+ EXTRAS="$EXTRAS check_nagios"
+ AC_DEFINE_UNQUOTED(PS_COMMAND,"$PATH_TO_PS -axwo 'stat uid ppid ucomm command'",[Verbatim command to execute for ps in check_procs])
+ AC_DEFINE_UNQUOTED(PS_FORMAT,"%s %d %d %s %n",[Format string for scanning ps output in check_procs])
+ AC_DEFINE_UNQUOTED(VSZ_COMMAND,"$PATH_TO_PS -axwo 'vsz ucomm'",[Verbatim command to execute for ps in check_vsz])
+ AC_DEFINE_UNQUOTED(VSZ_FORMAT,"%d %s",[Format string for scanning ps output in check_vsz])
+ AC_DEFINE_UNQUOTED(RSS_COMMAND,"$PATH_TO_PS -axwo 'rss ucomm'",[Verbatim command to execute for ps in check_rss])
+ AC_DEFINE_UNQUOTED(RSS_FORMAT,"%d %s",[Format string for scanning ps output in check_rss])
+ echo " ps syntax... $PATH_TO_PS -axwo 'stat uid ppid ucomm command'"
dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
dnl STAT UCOMM VSZ RSS USER PPID COMMAND
-if ps -axwo 'stat comm vsz rss user uid ppid args' 2>/dev/null | egrep -i ["^ *STAT +UCOMM +VSZ +RSS +USER +UID +PPID +COMMAND"] > /dev/null
+elif ps -axwo 'stat comm vsz rss user uid ppid args' 2>/dev/null | egrep -i ["^ *STAT +UCOMM +VSZ +RSS +USER +UID +PPID +COMMAND"] > /dev/null
then
AC_DEFINE(USE_PS_VARS,1,[Define if 'ps' will be parsed with sscanf])
AC_DEFINE_UNQUOTED(PS_VARLIST,[procstat,&procuid,&procppid,procprog,&pos],[Variable list for sscanf of 'ps' output])
@@ -841,6 +867,8 @@
AC_DEFINE_UNQUOTED(WHO_COMMAND,"$PATH_TO_WHO",[path and arguments for invoking 'who'])
fi
@ -88,7 +114,7 @@
AC_PATH_PROG(PATH_TO_SNMPGET,snmpget)
if test -x "$PATH_TO_SNMPGET"
then
@@ -863,7 +876,10 @@
@@ -863,7 +891,10 @@
echo "** Tried $PERL - install Net::SNMP perl module if you want to"
echo " use the perl snmp plugins"
fi
@ -99,7 +125,7 @@
AC_PATH_PROG(PATH_TO_QUAKESTAT,quakestat)
AC_PATH_PROG(PATH_TO_QSTAT,qstat)
if test -x "$PATH_TO_QUAKESTAT"
@@ -877,7 +893,10 @@
@@ -877,7 +908,10 @@
else
echo "** Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin"
fi
@ -110,7 +136,7 @@
AC_PATH_PROG(PATH_TO_FPING,fping)
if test -x "$PATH_TO_FPING"
then
@@ -885,6 +904,7 @@
@@ -885,6 +919,7 @@
EXTRAS="$EXTRAS check_fping"
else
echo "** Get fping from http://www.fping.com in order to make check_fping plugin"

View File

@ -7,24 +7,31 @@ fi
tempfile=`mktemp -t checklist`
if [ "${BATCH}" = "yes" ]; then
else
/usr/bin/dialog --title "NetSaint plugins configuration options" --clear \
if [ "${NAGIOS_PLUGINS_OPTIONS}" ]; then
set ${NAGIOS_PLUGINS_OPTIONS}
fi
for i; do
eval status_$i=ON
done
if [ -z "${BATCH}" ]; then
/usr/bin/dialog --title "Nagios plugins configuration options" --clear \
--checklist "\n\
Please select desired options:" -1 -1 16 \
QStat "Game server query support" OFF \
FPing "Support for non-flooding fast ping" OFF \
NetSNMP "SNMP support" OFF \
Radiusclient "Radius support" OFF \
MySQL "MySQL support" OFF \
PostgreSQL "PostgreSQL support" OFF \
OpenLDAP "OpenLDAP support" OFF \
QStat "Game server query support" "$status_QStat" \
FPing "Support for non-flooding fast ping" "$status_FPing" \
NetSNMP "SNMP support" "$status_NetSNMP" \
Radius "Radius support" "$status_Radius" \
MySQL "MySQL support" "$status_MySQL" \
PgSQL "PostgreSQL support" "$status_PgSQL" \
OpenLDAP "OpenLDAP support" "$status_OpenLDAP" \
2> $tempfile
retval=$?
if [ -s $tempfile ]; then
set `cat $tempfile`
set `sed 's/"//g' $tempfile`
fi
rm -f $tempfile
@ -42,6 +49,8 @@ fi
${MKDIR} ${WRKDIRPREFIX}${CURDIR}
exec > ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
echo "PREFIX= ${PREFIX}"
SUB_QSTAT="@comment "
SUB_FPING="@comment "
SUB_SNMP="@comment "
@ -52,19 +61,19 @@ SUB_LDAP="@comment "
while [ "$1" ]; do
case $1 in
\"QStat\")
QStat)
echo "BUILD_DEPENDS+= qstat:\${PORTSDIR}/games/qstat"
echo "RUN_DEPENDS+= qstat:\${PORTSDIR}/games/qstat"
echo "CONFIGURE_ARGS+= --enable-qstat"
SUB_QSTAT=""
;;
\"FPing\")
FPing)
echo "BUILD_DEPENDS+= fping:\${PORTSDIR}/net/fping"
echo "RUN_DEPENDS+= fping:\${PORTSDIR}/net/fping"
echo "CONFIGURE_ARGS+= --enable-fping"
SUB_FPING=""
;;
\"NetSNMP\")
NetSNMP)
echo "BUILD_DEPENDS+= snmpcheck:\${PORTSDIR}/net-mgmt/net-snmp"
echo "RUN_DEPENDS+= snmpcheck:\${PORTSDIR}/net-mgmt/net-snmp"
echo "BUILD_DEPENDS+= \${LOCALBASE}/lib/perl5/site_perl/\${PERL_VER}/Net/SNMP.pm:\${PORTSDIR}/net-mgmt/p5-Net-SNMP"
@ -72,12 +81,12 @@ while [ "$1" ]; do
echo "CONFIGURE_ARGS+= --enable-snmp"
SUB_SNMP=""
;;
\"Radiusclient\")
Radius)
echo "LIB_DEPENDS+= radiusclient.0:\${PORTSDIR}/net/radiusclient"
echo "CONFIGURE_ARGS+= --enable-radius"
SUB_RADIUS=""
;;
\"MySQL\")
MySQL)
echo ".if exists(${LOCALBASE}/lib/mysql/libmysqlclient.so.12)"
echo "LIB_DEPENDS+= mysqlclient.12:${PORTSDIR}/databases/mysql40-client"
echo ".else"
@ -90,19 +99,19 @@ while [ "$1" ]; do
echo "CONFIGURE_ARGS+= --with-mysql=\${LOCALBASE}"
SUB_MYSQL=""
;;
\"PostgreSQL\")
PgSQL)
echo "POSTGRESQL_PORT?= databases/postgresql7"
echo "LIB_DEPENDS+= pq.3:\${PORTSDIR}/\${POSTGRESQL_PORT}"
echo "CONFIGURE_ARGS+= --with-pgsql=\${LOCALBASE}"
SUB_PGSQL=""
;;
\"OpenLDAP\")
OpenLDAP)
echo "LIB_DEPENDS+= ldap.2:\${PORTSDIR}/net/openldap20-client"
echo "CONFIGURE_ARGS+= --enable-ldap"
SUB_LDAP=""
;;
*)
echo "Invalid option(s): $*" > /dev/stderr
echo "Unknown option(s): $*" > /dev/stderr
rm -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
exit 1
;;