1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-06 06:30:19 +00:00

- added support for variables from net-mgmt/nagios

- updated sample configuration file
- renamed startup script from nrpe2.sh to nrpe2
- changed maintainer to Jarrod Sayers <jarrot@netleader.com.au>

PR:		ports/114035
Submitted by:	Jarrod Sayers <jarrot@netleader.com.au>
Approved by:	maintainer, garga (mentor)
This commit is contained in:
Martin Matuska 2007-07-24 12:57:40 +00:00
parent 4bf69b4773
commit c55da37cb0
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=196188
7 changed files with 144 additions and 115 deletions

View File

@ -7,31 +7,54 @@
PORTNAME= nrpe2
PORTVERSION= 2.7
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= net-mgmt
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= nagios
DISTNAME= nrpe-${PORTVERSION}
MAINTAINER= dan@langille.org
MAINTAINER= jarrod@netleader.com.au
COMMENT= Nagios Remote Plugin Executor
RUN_DEPENDS= ${LOCALBASE}/libexec/nagios/check_nagios:${PORTSDIR}/net-mgmt/nagios-plugins
GNU_CONFIGURE= yes
USE_PERL5_BUILD= yes
USE_RC_SUBR= nrpe2.sh
SUB_FILES= pkg-message
PLIST_FILES= sbin/nrpe2 etc/nrpe.cfg-sample libexec/nagios/check_nrpe2
CONFIGURE_ARGS= --libexecdir=${PREFIX}/libexec/nagios \
--bindir=${PREFIX}/sbin --sysconfdir=${PREFIX}/etc
USE_RC_SUBR= nrpe2
OPTIONS= SSL "SSL support" off \
ARGS "Enable command arguments *POTENTIAL SECURITY RISK*" off
GNU_CONFIGURE= yes
NAGIOSUSER?= nagios
NAGIOSGROUP?= nagios
NAGIOSDIR?= /var/spool/nagios
NAGIOSUID= 181
NAGIOSGID= ${NAGIOSUID}
CONFIGURE_ARGS= --bindir=${PREFIX}/sbin \
--libexecdir=${PREFIX}/libexec/nagios \
--sysconfdir=${PREFIX}/etc \
--with-nrpe-user=${NAGIOSUSER} \
--with-nrpe-group=${NAGIOSGROUP} \
--prefix=${PREFIX}
PLIST_FILES= sbin/nrpe2 etc/nrpe.cfg-sample libexec/nagios/check_nrpe2
SUB_VARS= NAGIOSDIR=${NAGIOSDIR} \
NAGIOSUSER=${NAGIOSUSER} \
NAGIOSGROUP=${NAGIOSGROUP} \
NAGIOSUID=${NAGIOSUID} \
NAGIOSGID=${NAGIOSGID}
SUB_FILES= pkg-install \
pkg-deinstall \
pkg-message
SUB_LIST+= ${SUB_VARS}
PLIST_SUB+= ${SUB_VARS}
.include <bsd.port.pre.mk>
.if defined(WITH_SSL)
@ -45,24 +68,21 @@ CONFIGURE_ARGS+= --disable-ssl
CONFIGURE_ARGS+= --enable-command-args
.endif
post-build:
@${REINPLACE_CMD} -e 's|nrpe.pid|nrpe2.pid|g' \
${WRKSRC}/sample-config/nrpe.cfg
post-patch:
@${REINPLACE_CMD} -e 's#nrpe.pid#nrpe2.pid#g' \
-e 's#/usr/lib/nagios/plugins/#${LOCALBASE}/libexec/nagios/#g' \
-e 's#/usr/bin/sudo#${LOCALBASE}/bin/sudo#g' \
${WRKSRC}/sample-config/nrpe.cfg.in
pre-install:
PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
@${SH} ${PKGINSTALL} ${DISTNAME} PRE-INSTALL
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/src/nrpe ${PREFIX}/sbin/nrpe2
${INSTALL_PROGRAM} ${WRKSRC}/src/check_nrpe \
${PREFIX}/libexec/nagios/check_nrpe2
${INSTALL_DATA} ${WRKSRC}/sample-config/nrpe.cfg \
${PREFIX}/etc/nrpe.cfg-sample
${INSTALL_PROGRAM} ${WRKSRC}/src/check_nrpe ${PREFIX}/libexec/nagios/check_nrpe2
${INSTALL_DATA} ${WRKSRC}/sample-config/nrpe.cfg ${PREFIX}/etc/nrpe.cfg-sample
post-install:
${CAT} ${PKGMESSAGE}
post-deinstall:
PKG_PREFIX=${PREFIX} ${SH} ${PKGDEINSTALL} ${PKGNAME} DEINSTALL
@${CAT} ${PKGMESSAGE}
.include <bsd.port.post.mk>

View File

@ -1,7 +1,7 @@
--- sample-config/nrpe.cfg.in~ Mon Dec 11 21:04:00 2006
+++ sample-config/nrpe.cfg.in Wed Jan 31 20:40:28 2007
--- sample-config/nrpe.cfg.in.orig Tue Dec 12 12:34:00 2006
+++ sample-config/nrpe.cfg.in Tue Jun 26 20:16:45 2007
@@ -190,8 +190,10 @@
command[check_users]=@libexecdir@/check_users -w 5 -c 10
command[check_load]=@libexecdir@/check_load -w 15,10,5 -c 30,25,20
-command[check_disk1]=@libexecdir@/check_disk -w 20 -c 10 -p /dev/hda1
@ -11,5 +11,5 @@
+command[check_disk_tmp]=@libexecdir@/check_disk -w 20 -c 10 --path /tmp
+command[check_disk_usr]=@libexecdir@/check_disk -w 20 -c 10 --path /usr
command[check_zombie_procs]=@libexecdir@/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=@libexecdir@/check_procs -w 150 -c 200
command[check_total_procs]=@libexecdir@/check_procs -w 150 -c 200

View File

@ -0,0 +1,22 @@
#!/bin/sh
#
# $FreeBSD$
#
NAGIOSDIR=%%NAGIOSDIR%%
NAGIOSUSER=%%NAGIOSUSER%%
NAGIOSGROUP=%%NAGIOSGROUP%%
if [ "$2" = "POST-DEINSTALL" ]; then
if /usr/sbin/pw group show "${NAGIOSGROUP}" 2>&1 >/dev/null; then
echo "You should manually remove the \"${NAGIOSGROUP}\" group."
fi
if /usr/sbin/pw user show "${NAGIOSUSER}" 2>&1 >/dev/null; then
echo "You should manually remove the \"${NAGIOSUSER}\" user."
fi
if [ -e "${NAGIOSDIR}" ]; then
echo "You should manually remove the \"${NAGIOSDIR}\" directory."
fi
fi

View File

@ -0,0 +1,74 @@
#!/bin/sh
#
# $FreeBSD$
#
NAGIOSDIR=%%NAGIOSDIR%%
NAGIOSUSER=%%NAGIOSUSER%%
NAGIOSGROUP=%%NAGIOSGROUP%%
NAGIOSUID=%%NAGIOSUID%%
NAGIOSGID=%%NAGIOSGID%%
ask() {
local question default answer
question=$1
default=$2
if [ -z "${PACKAGE_BUILDING}" ]; then
read -p "${question} [${default}]? " answer
fi
if [ "x${answer}" = "x" ]; then
answer=${default}
fi
echo ${answer}
}
yesno() {
local default question answer
question=$1
default=$2
while :; do
answer=$(ask "${question}" "${default}")
case "${answer}" in
[Yy][Ee][Ss]|[Yy])
return 0
;;
[Nn][Oo]|[Nn])
return 1
;;
esac
echo "Please answer yes or no."
done
}
if [ "$2" = "PRE-INSTALL" ]; then
if /usr/sbin/pw group show "${NAGIOSGROUP}" 2>&1 >/dev/null; then
echo "You already have a \"${NAGIOSGROUP}\" group, so I will use it."
else
echo "You need a \"${NAGIOSGROUP}\" group."
if yesno "Would you like me to create it" "YES"; then
/usr/sbin/pw groupadd "${NAGIOSGROUP}" -g "${NAGIOSGID}" -h - || \
/usr/sbin/pw groupadd "${NAGIOSGROUP}" -h - || exit
echo "Done."
else
echo "Please create the \"${NAGIOSGROUP}\" group manually and try again."
exit 1
fi
fi
if /usr/sbin/pw user show "${NAGIOSUSER}" 2>&1 >/dev/null; then
echo "You already have a \"${NAGIOSUSER}\" user, so I will use it."
else
echo "You need a \"${NAGIOSUSER}\" user."
if yesno "Would you like me to create it" "YES"; then
/usr/sbin/pw useradd "${NAGIOSUSER}" -u "${NAGIOSUID}" -g "${NAGIOSGROUP}" -h - -d "${NAGIOSDIR}" \
-s /sbin/nologin -c "Nagios pseudo-user" || \
/usr/sbin/pw useradd "${NAGIOSUSER}" -g "${NAGIOSGROUP}" -h - -d "${NAGIOSDIR}" \
-s /sbin/nologin -c "Nagios pseudo-user" || exit
else
echo "Please create the \"${NAGIOSUSER}\" user manually and try again."
exit 1
fi
fi
fi

View File

@ -1,19 +0,0 @@
#!/bin/sh
PATH=/bin:/usr/bin:/usr/sbin
TMPFILE=/tmp/services-$RANDOM-$$
PKG_PREFIX=${PKG_PREFIX:=/usr/local}
case "$2" in
"DEINSTALL")
# Note how to delete UID/GID
USER=nagios
GROUP=nagios
if pw usershow "${USER}" 2>/dev/null 1>&2; then
echo "To delete nagios user permanently, use 'pw userdel ${USER}'"
echo "To delete nagios group permanently, use 'pw groupdel ${GROUP}'"
fi
;;
esac

View File

@ -1,68 +0,0 @@
#!/bin/sh
#
# $FreeBSD: /tmp/pcvs/ports/net-mgmt/nrpe2/Attic/pkg-install,v 1.1 2003-01-09 22:13:58 edwin Exp $
#
PKG_PREFIX=${PKG_PREFIX:=/usr/local}
user=nagios
group=nagios
ask() {
local question default answer
question=$1
default=$2
if [ -z "${PACKAGE_BUILDING}" ]; then
read -p "${question} [${default}]? " answer
fi
if [ x${answer} = x ]; then
answer=${default}
fi
echo ${answer}
}
yesno() {
local dflt question answer
question=$1
dflt=$2
while :; do
answer=$(ask "${question}" "${dflt}")
case "${answer}" in
[Yy]*) return 0;;
[Nn]*) return 1;;
esac
echo "Please answer yes or no."
done
}
if [ x"$2" = xPRE-INSTALL ]; then
if /usr/sbin/pw groupshow "${group}" 2>/dev/null; then
echo "You already have a group \"${group}\", so I will use it."
else
echo "You need a group \"${group}\"."
if yesno "Would you like me to create it" y; then
/usr/sbin/pw groupadd ${group} -h - || exit
echo "Done."
else
echo "Please create it, and try again."
exit 1
fi
fi
if /usr/sbin/pw user show "${user}" 2>/dev/null; then
echo "You already have a user \"${user}\", so I will use it."
else
echo "You need a user \"${user}\"."
if yesno "Would you like me to create it" y; then
/usr/sbin/pw useradd ${user} -g ${group} -h - -d ${PKG_PREFIX}/var/nagios \
-s /nonexistent -c "Nagios pseudo-user" || exit
echo "Done."
else
echo "Please create it, and try again."
exit 1
fi
fi
fi