first stab at ucf-izing the plugin configs

This commit is contained in:
Sean Finney 2006-09-20 21:28:35 +00:00
parent 70c0368c56
commit 1bc469da67
7 changed files with 86 additions and 13 deletions

3
debian/changelog vendored
View file

@ -3,6 +3,9 @@ nagios-plugins (1.4.3.0cvs.20060707-4) UNRELEASED; urgency=low
* NOT RELEASED YET
* include fix for braindead behaviour in check_tcp based plugins
such as check_simap (closes: #351847).
* dpkg's conffile handling can't deal with migrating config files
from nagios-plugins to nagios-plugins-foo, so we're now managing
all the config files via ucf (closes: #339971).
-- sean finney <seanius@debian.org> Sat, 02 Sep 2006 23:03:45 +0200

4
debian/control vendored
View file

@ -30,7 +30,7 @@ Description: Plugins for the nagios network monitoring and management system
Package: nagios-plugins-basic
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, procps, iputils-ping
Depends: ${shlibs:Depends}, ${misc:Depends}, procps, iputils-ping, ucf
Conflicts: nagios-plugins (<= 1.4.2-3)
Replaces: nagios-plugins, nagios-plugins-standard
Suggests: nagios-text | nagios
@ -56,7 +56,7 @@ Package: nagios-plugins-standard
Architecture: any
Conflicts: nagios-plugins (<= 1.4.2-3)
Replaces: nagios-plugins
Depends: ${shlibs:Depends}, ${misc:Depends}, fping, qstat, snmp, radiusclient1, libnet-snmp-perl, dnsutils, bind9-host | host, smbclient
Depends: ${shlibs:Depends}, ${misc:Depends}, fping, qstat, snmp, radiusclient1, libnet-snmp-perl, dnsutils, bind9-host | host, smbclient, ucf
Suggests: nagios-text | nagios
Description: Plugins for the nagios network monitoring and management system
Nagios is a host/service/network monitoring and management system. It has

12
debian/nagios-plugins-basic.postinst vendored Normal file
View file

@ -0,0 +1,12 @@
#!/bin/sh -e
if [ "$1" = "configure" ]; then
(
cd /usr/share/nagios-plugins/templates-basic
for f in *cfg; do
ucf $f /etc/nagios-plugins/config/$f
done
);
fi
#DEBHELPER#

17
debian/nagios-plugins-basic.postrm.in vendored Normal file
View file

@ -0,0 +1,17 @@
#!/bin/sh -e
BASIC_PLUGINS="@BASIC_PLUGINS@"
if [ "$1" = "purge" ]; then
if which ucf >/dev/null 2>&1; then
have_ucf="yes"
fi
for f in $BASIC_PLUGINS; do
rm -f /etc/nagios-plugins/config/$f
if [ "$have_ucf" = "yes" ]; then
ucf --purge /etc/nagios-plugins/config/$f
fi
done
fi
#DEBHELPER#

12
debian/nagios-plugins-standard.postinst vendored Normal file
View file

@ -0,0 +1,12 @@
#!/bin/sh -e
if [ "$1" = "configure" ]; then
(
cd /usr/share/nagios-plugins/templates-standard
for f in *cfg; do
ucf $f /etc/nagios-plugins/config/$f
done
);
fi
#DEBHELPER#

View file

@ -0,0 +1,17 @@
#!/bin/sh -e
STD_PLUGINS="@STD_PLUGINS@"
if [ "$1" = "purge" ]; then
if which ucf >/dev/null 2>&1; then
have_ucf="yes"
fi
for f in $STD_PLUGINS; do
rm -f /etc/nagios-plugins/config/$f
if [ "$have_ucf" = "yes" ]; then
ucf --purge /etc/nagios-plugins/config/$f
fi
done
fi
#DEBHELPER#

34
debian/rules vendored
View file

@ -18,17 +18,21 @@ DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
CFLAGS = -Wall -g
NP_LIBEXEC:=/usr/lib/nagios/plugins
NP_ETC:=/etc/nagios-plugins/config
NP_BASIC_DIR:=$(CURDIR)/debian/nagios-plugins-basic
NP_BASIC_TEMPLATES:=$(NP_BASIC_DIR)/usr/share/nagios-plugins/templates-basic
NP_STD_DIR:=$(CURDIR)/debian/nagios-plugins-standard
NP_STD_TEMPLATES:=$(NP_STD_DIR)/usr/share/nagios-plugins/templates-standard
std_plugins:=check_breeze check_ifoperstatus check_hpjd check_ifstatus \
check_rpc check_snmp check_wave check_fping check_game \
check_radius check_mysql check_mysql_query check_pgsql \
check_disk_smb check_ldap check_ldaps \
check_dns check_dig check_flexlm check_oracle
std_plugin_cfgs:=breeze dns flexlm games hppjd ifstatus ldap mrtg mysql \
netware nt pgsql radius snmp
basic_plugin_cfgs:=apt dhcp disk dummy ftp http load mail ntp ping procs real \
ssh tcp_udp telnet users
std_plugin_cfgs:=breeze disk-smb dns flexlm fping games hppjd ifstatus ldap \
mrtg mysql netware nt pgsql radius rpc-nfs snmp
PATH = /bin:/sbin:/usr/bin:/usr/sbin
@ -65,11 +69,7 @@ build: patch-stamp build-stamp
build-stamp: config.status
dh_testdir
# Add here commands to compile the package.
$(MAKE)
#/usr/bin/docbook-to-man debian/nagios-plugins.sgml > nagios-plugins.1
touch build-stamp
clean: really-clean unpatch
@ -85,6 +85,7 @@ really-clean:
-rm -f platform.h auto-include.h
find -type d -name build -print0 | xargs -0 -r rm -rf \;
find \( -name config.sub -o -name config.guess \) -print0 | xargs -0 -r rm -f \;
-rm -f debian/nagios-plugins-basic.postrm debian/nagios-plugins-standard.postrm
dh_clean
install: build
@ -96,15 +97,26 @@ install: build
# Add here commands to install the package into debian/nagios-plugins.
$(MAKE) install DESTDIR=${NP_BASIC_DIR}
chmod 644 ${NP_BASIC_DIR}/usr/lib/nagios/plugins/utils.pm
cp $(CURDIR)/debian/pluginconfig/*.cfg ${NP_BASIC_DIR}/${NP_ETC}
# split up basic vs. standard plugins
for p in ${std_plugins}; do \
mv ${NP_BASIC_DIR}/${NP_LIBEXEC}/$$p ${NP_STD_DIR}/${NP_LIBEXEC}; \
done
# now do the same for their configs
for c in ${std_plugin_cfgs}; do \
mv ${NP_BASIC_DIR}/${NP_ETC}/$${c}.cfg ${NP_STD_DIR}/${NP_ETC}; \
# now do the same for their configs, copying them into seperate
# "template" directories outside of /usr/share/doc for ucf to use.
for c in ${basic_plugin_cfgs}; do \
cp $(CURDIR)/debian/pluginconfig/$${c}.cfg ${NP_BASIC_TEMPLATES}; \
done
for c in ${std_plugin_cfgs}; do \
cp $(CURDIR)/debian/pluginconfig/$${c}.cfg ${NP_STD_TEMPLATES}; \
done
# dynamically create the postrm scripts using a template, so that we
# don't have to define the same list of plugin configs over and over.
sed -e 's/@BASIC_PLUGINS@/${basic_plugin_cfgs}/' \
< debian/nagios-plugins-basic.postrm.in \
> debian/nagios-plugins-basic.postrm
sed -e 's/@STD_PLUGINS@/${std_plugin_cfgs}/' \
< debian/nagios-plugins-basic.postrm.in \
> debian/nagios-plugins-basic.postrm
# Build architecture-independent files here.