[Pkg-nagios-changes] nagios README.Debian, 1.5, 1.6 README.mysql, 1.6, 1.7 README.pgsql, 1.6, 1.7 changelog, 1.86, 1.87 check_nagios_db, 1.2, 1.3 control, 1.18, 1.19 nagios-common.dirs, 1.6, 1.7 nagios-common.docs, 1.3, 1.4 nagios-common.install, 1.6, 1.7 nagios-common.postinst, 1.15, 1.16 nagios-common.postrm, 1.7, 1.8 nagios-mysql.config, NONE, 1.1 nagios-mysql.dirs, 1.3, 1.4 nagios-mysql.links, NONE, 1.1 nagios-mysql.postinst, NONE, 1.1 nagios-mysql.postrm, NONE, 1.1 nagios-mysql.prerm, NONE, 1.1 nagios-pgsql.config, NONE, 1.1 nagios-pgsql.dirs, 1.3, 1.4 nagios-pgsql.links, NONE, 1.1 nagios-pgsql.postinst, NONE, 1.1 nagios-pgsql.postrm, NONE, 1.1 nagios-pgsql.prerm, NONE, 1.1 nagios-text.postinst, 1.1, 1.2 nagios-text.prerm, NONE, 1.1 rules, 1.21, 1.22

seanius at haydn.debian.org seanius at haydn.debian.org
Thu Dec 8 13:12:28 UTC 2005


Update of /cvsroot/pkg-nagios/nagios
In directory haydn:/org/alioth.debian.org/chroot/home/users/seanius/tmp/cvs-serv22711

Modified Files:
	README.Debian README.mysql README.pgsql changelog 
	check_nagios_db control nagios-common.dirs nagios-common.docs 
	nagios-common.install nagios-common.postinst 
	nagios-common.postrm nagios-mysql.dirs nagios-pgsql.dirs 
	nagios-text.postinst rules 
Added Files:
	nagios-mysql.config nagios-mysql.links nagios-mysql.postinst 
	nagios-mysql.postrm nagios-mysql.prerm nagios-pgsql.config 
	nagios-pgsql.links nagios-pgsql.postinst nagios-pgsql.postrm 
	nagios-pgsql.prerm nagios-text.prerm 
Log Message:
oooooh boy.  i added dbconfig-common support along with a few other
fixes/tweaks here and there.  still need to test the pgsql support,
but things look good for mysql!


Index: README.Debian
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios/README.Debian,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- README.Debian	3 Apr 2005 00:34:28 -0000	1.5
+++ README.Debian	8 Dec 2005 13:12:23 -0000	1.6
@@ -13,6 +13,7 @@
 2. Compile options
 3. Nagios and Databases and "Cgi and init.d script can't read status info"
 4. Performance issues on heavily loaded servers
+5. Other miscellaneous and user-submitted information
 ================================================================================
 
 ================================================================================
@@ -80,8 +81,7 @@
 
 ================================================================================
 
-3. Nagios and Databases and "Cgi and init.d script can't read status
-info"
+3. Nagios and Databases and "Cgi and init.d script can't read status info"
 
 See README.mysql and README.pgsql.
 
@@ -99,3 +99,14 @@
 - upgrading to a faster machine ;p
 
 ================================================================================
+
+5. Other miscellaneous and user-submitted information
+
+- don't forget to check the online documentation!  there's a lot of
+  information in there!
+- use the cfg_dir option for large installations with many configurations.
+  see how it is done with the plugins for more information.
+- the submit_check_result_via_nsca script has been patched in the debian
+  version to take a hostname on the cmdline (-H).
+
+================================================================================

Index: README.mysql
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios/README.mysql,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- README.mysql	17 Nov 2005 16:22:00 -0000	1.6
+++ README.mysql	8 Dec 2005 13:12:23 -0000	1.7
@@ -1,26 +1,19 @@
-Welcome to the nagios-mysql package!
-
-This package does not come with sane defaults, you will need to modify
-alot of settings before it will do anything useful for you.
-
-The setup cannot automatically create the mysql setup for you, because
-nagios is flexible enough that every table could live on a different
-server.  Setup it up this way is:
+README.mysql for nagios
+$Id$
 
-1) Probably not ideal
+Welcome to the nagios-mysql package!
 
-2) Beyond the scope of this documentation.
+nagios-mysql now ships with dbconfig-common support, meaning you
+can have automated assistance in configuring the database-related
+aspects of nagios.  however, if you choose to decline this assistance,
+information in this file may be of help.
 
-However!  If you want to run MySQL on the same machine as nagios, we
+If you want to run MySQL on the same machine as nagios, we
 can help.  First thing, install the mysql-server package.
 
 $ mysqladmin -u root -p create nagios
 
-$ zcat /usr/share/doc/nagios-mysql/create_mysql.gz | mysql -u root -p nagios
-
-When prompted for a password, please enter the password you choosed when 
-configuring the package at install time... If you did not set a password,
-press ENTER.
+$ mysql -u root -p nagios < /usr/share/doc/nagios-mysql/create_mysql
 
 $ mysql -u root -p nagios
 
@@ -45,7 +38,7 @@
 be sure to make them NOT world readable by issuing something like
 chmod o= /etc/nagios/resource.cfg.
 
-1) /etc/nagios/resource.cfg
+1) /etc/nagios/database.cfg
 
 Uncomment and set the following lines to appropriate values, replacing
 the values you've chosen in the previous step for the database, user,
@@ -78,21 +71,16 @@
 3)
 
 Then you want the cgi-script and the init.d script to correctly
-know the status of nagios. To do this you will need something like the
-check_nagios_db file from /usr/share/doc/nagios-common/.  put it somewhere
-like /usr/local/sbin/check_nagios_db (which will be assumed for the
-rest of the document). 
-
-Make it executable:
-# chmod +x /usr/local/sbin/check_nagios_db
+know the status of nagios. To do this you will need the check_nagios_db
+plugin in /usr/lib/nagios/plugins.
 
-Now edit the /etc/nagios/cgi.cfg and change the line:
+Edit the /etc/nagios/cgi.cfg and change the line:
 
 nagios_check_command=/usr/lib/nagios/plugins/check_nagios /var/log/nagios/status.log 5 'nagios'
 
 to read:
 
-nagios_check_command=/usr/local/sbin/check_nagios_db
+nagios_check_command=/usr/lib/nagios/plugins/check_nagios_db -D mysql
 
 and finally, now (re)start nagios
 
@@ -108,7 +96,6 @@
 
 / This micro howto on how to set up Nagios for MySQL was provided
   by Jeff Bailey on the Debian GNU/Linux BTS (bug #163811).
-/ updated by sean finney 20050215 with some clarifications about
-  conf file defaults
-/ updated again by sean finney on 20051117 to reflect improvements to
-  the init script
+/ updated and currently maintained by sean finney <seanius at debian.org>
+  and the rest of the debian nagios maintenance team 
+  <pkg-nagios at lists.alioth.debian.org> 

Index: README.pgsql
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios/README.pgsql,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- README.pgsql	17 Nov 2005 16:22:00 -0000	1.6
+++ README.pgsql	8 Dec 2005 13:12:23 -0000	1.7
@@ -1,13 +1,14 @@
-INSTALLING AND CONFIGURING NAGIOS/POSTGRESQL
+README.pgsql for nagios in Debian GNU/Linux
+$Id$
 
-   Author: Ricky Ng-Adam, rngadam at yahoo.com, January 2005
-   Additional Editing by:
-   	Sean Finney <seanius at debian.org>
-	  - various added content and editorial liberties
-   	Marcus Better <marcus at better.se>
-	  - pointing out nagios needed to be owner of databases.
-	  - pointing out cgi scripts could be granted less privileges
-	    by creating a seperate user.
+Welcome to the nagios-pgsql package!
+
+nagios-pgsql now ships with dbconfig-common support, meaning you
+can have automated assistance in configuring the database-related
+aspects of nagios.  however, if you choose to decline this assistance,
+information in this file may be of help.
+
+INSTALLING AND CONFIGURING NAGIOS/POSTGRESQL
 
 = Introduction =
 
@@ -18,7 +19,6 @@
 
    Next, we will setup the PostgreSQL database:
 
-# gunzip /usr/share/doc/nagios-pgsql/create_pgsql.gz
 # su postgres
 # createuser -A -D nagios
 # createdb -O nagios nagios
@@ -60,47 +60,12 @@
 
 = Configuration =
 
-   First, install the libdbd-pg-perl package.
-
-apt-get install libdbd-pg-perl
-
-   Then, create a copy of the check_nagios_db script:
-
-cp /usr/share/doc/nagios-pgsql/check_nagios_db /usr/local/sbin/
-chmod +x /usr/local/sbin/check_nagios_db
-
-   Apply these changes to check_nagios_db:
-
---- /usr/share/doc/nagios-pgsql/check_nagios_db 2004-11-13 18:56:19.000000000 -0500
-+++ /etc/nagios/check_nagios_db     2004-12-31 09:16:16.000000000 -0500
-@@ -11,10 +11,10 @@
- use DBI;
-
- # Change this to Pg if you use postgresql.
--my $driver = "mysql";
-+my $driver = "Pg";
-
- my $CFG_DEF = "/etc/nagios/cgi.cfg";
--my $QUERY = "select *, UNIX_TIMESTAMP(last_update) as ut from programstatus;";
-+my $QUERY = "select *, date_part('epoch',last_update) as ut from programstatus;";
- my $EXPIRE_DEF = 5; ## expressed in minutes
- my $PROCCNT = 0;
-
-@@ -51,7 +51,7 @@
-
- # print "($dbhost, $dbport, $dbuser, $dbpass, $dbname)\n";
-
--my $dsn = "DBI:$driver:database=$dbname;host=$dbhost;port=$dbport";
-+my $dsn = "DBI:$driver:dbname=$dbname;host=$dbhost;port=$dbport";
- my $dbh = DBI->connect($dsn, $dbuser, $dbpass, {'RaiseError' => 1});
-
- my $sth = $dbh->prepare($QUERY);
-
-   Test it standalone:
+   You will need to use the check_nagios_db plugin.  First,
+   test it standalone:
 
-/etc/nagios/check_nagios_db
+sudo -u nagios /usr/lib/nagios/plugins/check_nagios_db -D pgsql
 
-   vi /etc/nagios/resource.cfg
+   vi /etc/nagios/database.cfg
 
 :%s/somehost/localhost/g
 :%s/somedatabase/nagios/g
@@ -126,7 +91,7 @@
 
    In the same file, change the check command:
 
-nagios_check_command=/usr/local/sbin/check_nagios_db
+nagios_check_command=/usr/lib/nagios/plugins/check_nagios_db
 
    Check and restart:
 
@@ -156,5 +121,14 @@
      * http://www.xach.com/aolserver/mysql-to-postgresql.html
      * http://www.archonet.com/pgdocs/grant-all.html
 
+= Credits =
+
+   Originally by: Ricky Ng-Adam, rngadam at yahoo.com, January 2005
+   Currently maintained by: Sean Finney <seanius at debian.org>
+   Additional comments/corrections from:
+   	Marcus Better <marcus at better.se>
+	  - pointing out nagios needed to be owner of databases.
+	  - pointing out cgi scripts could be granted less privileges
+	    by creating a seperate user.
+
 
- -- sean finney <seanius at debian.org>  Sun, 24 Jul 2005 19:56:55 -0400

Index: changelog
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios/changelog,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- changelog	3 Dec 2005 09:43:50 -0000	1.86
+++ changelog	8 Dec 2005 13:12:23 -0000	1.87
@@ -1,3 +1,28 @@
+nagios (2:1.3-cvs.20050402-11) UNRELEASED; urgency=low
+
+  [sean finney]
+  * First attempt at dbconfig-common support.  holding my breath...
+    - database configuration now goes in database.cfg for
+      the nagios daemon, and cgi.cfg for the web interface (i couldn't
+      find a non-invasive way to seperate that out)
+    - cgi.cfg is no longer shipped as a conffile, but instead managed
+      via ucf (so nagios-mysql/pgsql can update it too).
+    - requisite documentation changes to README.mysql/README.pgsql.
+    - moved the dbd packages from recommends to depends.
+  * all nagios flavors call start/stop on the init scripts in the
+    binary packages instead of in the -common package, otherwise strange
+    things can happen during upgrades/reconfigures.  maybe this is
+    the cause of #338931?
+  * bumped build-deps to libmysqlclient15-dev so nagios-mysql will
+    work with mysql 5.x.
+  * don't EVER rm -rf /etc/nagios, even at purge.  when did we start
+    doing that?
+  * allow the submit_check_result_via_nsca to take a cmdline paramter
+    to specify destination host.  put a note about this in README.Debian
+    too (closes: #342010).  thanks to Libor Klepac for the suggestions.
+
+ -- sean finney <seanius at debian.org>  Wed, 07 Dec 2005 21:24:26 +0100
+
 nagios (2:1.3-cvs.20050402-10) unstable; urgency=low
 
   * Sean Finney:

Index: check_nagios_db
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios/check_nagios_db,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- check_nagios_db	13 Nov 2004 23:56:19 -0000	1.2
+++ check_nagios_db	8 Dec 2005 13:12:23 -0000	1.3
@@ -1,45 +1,56 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -w
+#
+# check_nagios_db.pl:	check_nagios for nagios-mysql and nagios-pgsql
 
 use strict;
 $|++;
 
-use vars qw/$opt_e $opt_c/;
+use vars qw/$opt_e $opt_c $opt_D/;
 
 $ENV{"PATH"} = "/usr/bin:/usr/sbin:/bin";
 
 use Getopt::Std;
 use DBI;
-
-# Change this to Pg if you use postgresql.
-my $driver = "mysql";
+use lib '/usr/lib/nagios/plugins';
+use utils qw/%ERRORS/;
 
 my $CFG_DEF = "/etc/nagios/cgi.cfg";
-my $QUERY = "select *, UNIX_TIMESTAMP(last_update) as ut from programstatus;";
 my $EXPIRE_DEF = 5; ## expressed in minutes
-my $PROCCNT = 0;
-
-use constant OK => 1;
-use constant WARN => 2;
-
-my $STAT = WARN;
+my $STATE = $ERRORS{WARN};
 
 sub usage {
         print STDERR "\n";
-        print STDERR "$0 -F -e <expire time in minutes> -C <process string>\n";
+        print STDERR "$0 -D <mysql|Pg> [-e <expire time in minutes>] [-c <cgi.cfg location>]\n";
         print STDERR "\n";
-        exit -1;
+        exit $ERRORS{UNKNOWN};
 }
 
-getopt("e:c:");
+getopt("e:c:D:");
 
 my $EXPIRE = $opt_e || $EXPIRE_DEF;
 my $CFG = $opt_c || $CFG_DEF;
+my $driver = $opt_D;
+
+if( (!defined($driver)) || ($driver ne "Pg" && $driver ne "mysql") ){
+	if(defined($driver) && $driver eq "pgsql") { $driver="Pg"; }
+	else {
+		print STDERR "error: driver must be 'mysql' or 'Pg'!\n";
+		usage();
+	}
+}
+
+my $QUERY;
+if ($driver eq "Pg"){
+	$QUERY = "select *, round(date_part('epoch',last_update)) as ut from programstatus;";
+} elsif ($driver eq "mysql"){
+	$QUERY = "select *, UNIX_TIMESTAMP(last_update) as ut from programstatus;";
+} 
 
 ( -f $CFG ) or die "Can't open config file '$CFG': $!\n";
 
 my ($dbhost, $dbport, $dbuser, $dbpass, $dbname);
 
-open(F, "< $CFG");
+open(F, "< $CFG") || die("can not open $CFG: $!");
 while ( <F> ) {
         if (/^xsddb_host=(.+)/) { $dbhost = $1; next; };
         if (/^xsddb_port=(.+)/) { $dbport = $1; next; };
@@ -49,14 +60,18 @@
 }
 close(F);
 
-# print "($dbhost, $dbport, $dbuser, $dbpass, $dbname)\n";
+my $dsn = "DBI:$driver:dbname=$dbname";
+if(defined($dbhost)) { $dsn .= "host=$dbhost"; } else { $dbhost=""; }
+if(defined($dbport)) { $dsn .= "port=$dbport"; } else { $dbport=""; }
+if(!defined($dbuser)) { $dbuser=""; }
+if(!defined($dbpass)) { $dbpass=""; }
+
+#print "connecting host=$dbhost,port=$dbport,user=$dbuser,pass=$dbpass,db=$dbname)\n";
 
-my $dsn = "DBI:$driver:database=$dbname;host=$dbhost;port=$dbport";
 my $dbh = DBI->connect($dsn, $dbuser, $dbpass, {'RaiseError' => 1});
 
 my $sth = $dbh->prepare($QUERY);
 if (!$sth) { die "Error:" . $dbh->errstr . "\n"; }
-$sth->execute;
 if (!$sth->execute) { die "Error:" . $sth->errstr . "\n"; }
 
 my %status = ();
@@ -72,27 +87,18 @@
 #       print "$_: $status{$_}\n";
 #}
 
-if (!$status{nagios_pid}) {
-	print "Nagios problem: no process identifier found in the database\n";
-	exit 1;
-}
-
-my $lastupdated = time() - $status{"ut"};
-if ( $lastupdated < ($EXPIRE*60) ) { ## convert $EXPIRE to seconds
-        $STAT = OK;
-}
-
-open(PS, "ps -eaf | grep $status{nagios_pid} | grep -v grep | ");
-$PROCCNT = 0;
-while(<PS>) {
-        $PROCCNT++;
+my $lastupdated=undef;
+if(defined($status{ut})){
+	$lastupdated = time() - $status{"ut"};
 }
-close(PS);
 
-if ( $STAT == OK ) {
-        print "Nagios OK: located $PROCCNT processes, program status updated $lastupdated seconds ago\n";
+if ( !defined($lastupdated)){
+	print "Nagios db CRITICAL: can not determine program status\n";
+	exit $ERRORS{CRITICAL};
+} elsif (! ($lastupdated < $EXPIRE*60)) {
+	print "Nagios WARNING: program status updated $lastupdated (>= ".($EXPIRE*60).") seconds ago\n";
+	exit $ERRORS{WARNING};
 } else {
-	print "Nagios problem: no processus found";
-	exit 1;
+	print "Nagios OK: program status updated $lastupdated seconds ago\n";
+	exit $ERRORS{OK};
 }
-

Index: control
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios/control,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- control	2 Dec 2005 14:41:57 -0000	1.18
+++ control	8 Dec 2005 13:12:23 -0000	1.19
@@ -4,7 +4,7 @@
 Maintainer: Debian Nagios Maintainer Group <pkg-nagios-devel at lists.alioth.debian.org>
 Uploaders: Joerg Jaspert <joerg at debian.org>, sean finney <seanius at debian.org>, Guido Trotter <ultrotter at debian.org>
 Standards-Version: 3.6.2
-Build-Depends: debhelper (>= 4.2.21), dpatch (>= 2.0.10), libpng12-dev, libgd2-noxpm-dev (>= 2.0.1) | libgd2-xpm-dev (>= 2.0.1), iputils-ping, libpq-dev, libmysqlclient12-dev
+Build-Depends: debhelper (>= 4.2.21), dpatch (>= 2.0.10), libpng12-dev, libgd2-noxpm-dev (>= 2.0.1) | libgd2-xpm-dev (>= 2.0.1), iputils-ping, libpq-dev, libmysqlclient15-dev
 
 Package: nagios-common
 Architecture: all
@@ -63,8 +63,8 @@
 
 Package: nagios-pgsql
 Architecture: any
-Depends: ${shlibs:Depends}, nagios-common (= ${Source-Version})
-Recommends: libdbd-pg-perl, nagios-images
+Depends: ${shlibs:Depends}, nagios-common (= ${Source-Version}), libdbd-pg-perl
+Recommends: nagios-images
 Suggests: nagios-nrpe-plugin
 Conflicts: nagios
 Replaces: nagios
@@ -92,8 +92,8 @@
 
 Package: nagios-mysql
 Architecture: any
-Depends: ${shlibs:Depends}, nagios-common (= ${Source-Version})
-Recommends: libdbd-mysql-perl, nagios-images
+Depends: ${shlibs:Depends}, nagios-common (= ${Source-Version}), libdbd-mysql-perl
+Recommends: nagios-images
 Suggests: nagios-nrpe-plugin
 Conflicts: nagios
 Replaces: nagios

Index: nagios-common.dirs
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios/nagios-common.dirs,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- nagios-common.dirs	2 Jul 2005 16:44:20 -0000	1.6
+++ nagios-common.dirs	8 Dec 2005 13:12:23 -0000	1.7
@@ -14,3 +14,5 @@
 usr/share/nagios/htdocs/docs/images
 usr/share/nagios/htdocs/images/logos
 usr/share/nagios/htdocs/ssi
+usr/share/nagios/debian
+usr/lib/nagios/plugins

Index: nagios-common.docs
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios/nagios-common.docs,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- nagios-common.docs	18 Jan 2005 06:40:04 -0000	1.3
+++ nagios-common.docs	8 Dec 2005 13:12:23 -0000	1.4
@@ -4,4 +4,3 @@
 debian/README.pgsql
 contrib/database/create_mysql
 contrib/database/create_pgsql
-debian/check_nagios_db

Index: nagios-common.install
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios/nagios-common.install,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- nagios-common.install	4 Jul 2005 16:46:34 -0000	1.6
+++ nagios-common.install	8 Dec 2005 13:12:23 -0000	1.7
@@ -13,3 +13,7 @@
 debian/apache.conf etc/nagios/
 debian/checkcommands.cfg etc/nagios/
 debian/check-imap usr/lib/nagios/plugins
+debian/misc/database.cfg usr/share/nagios/debian
+debian/misc/cgi.cfg usr/share/nagios/debian
+debian/misc/cgi.cfg.dbconfig usr/share/nagios/debian
+debian/check_nagios_db usr/lib/nagios/plugins/

Index: nagios-common.postinst
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios/nagios-common.postinst,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- nagios-common.postinst	22 Jul 2005 06:27:45 -0000	1.15
+++ nagios-common.postinst	8 Dec 2005 13:12:23 -0000	1.16
@@ -205,6 +205,5 @@
 # Make sure the config file is readable by both nagios
 # and apache
 chown -R nagios:www-data /var/log/nagios /etc/nagios /var/run/nagios /var/cache/nagios
-chmod 750 /etc/nagios/cgi.cfg || true
 
 #DEBHELPER#

Index: nagios-common.postrm
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios/nagios-common.postrm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- nagios-common.postrm	28 Mar 2005 14:42:56 -0000	1.7
+++ nagios-common.postrm	8 Dec 2005 13:12:23 -0000	1.8
@@ -35,10 +35,15 @@
     purge|remove|abort-install|abort-upgrade|failed-upgrade|disappear)
 	if [ "$1" = "purge" ]; then
 	    # Remove logfiles
-		rm -Rf {/var/cache,/var/run,/var/log,/etc}/nagios
+		rm -Rf {/var/cache,/var/run,/var/log}/nagios
 		# remove stat overrides
 		dpkg-statoverride --list '/usr/lib/cgi-bin/nagios/*.cgi' | \
 			cut -d' ' -f4 | xargs -r -n 1 dpkg-statoverride --remove
+		# remove ucf registered files
+		if [ -f /etc/nagios/cgi.cfg ]; then
+			ucf --purge /etc/nagios/cgi.cfg
+			rm -f /etc/nagios/cgi.cfg
+		fi
 	else
 	    # Remove apache config if wanted.
 	    db_get nagios/configapache

--- NEW FILE: nagios-mysql.config ---
#!/bin/sh -e

. /usr/share/debconf/confmodule
. /usr/share/dbconfig-common/dpkg/config.mysql 
dbc_first_version="2:1.3-cvs.20050402-11"
dbc_go nagios-mysql $@


Index: nagios-mysql.dirs
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios/nagios-mysql.dirs,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- nagios-mysql.dirs	7 Nov 2004 23:18:46 -0000	1.3
+++ nagios-mysql.dirs	8 Dec 2005 13:12:23 -0000	1.4
@@ -1,2 +1,3 @@
 usr/sbin
 usr/lib/cgi-bin/nagios
+usr/share/dbconfig-common/data/nagios-mysql/install

--- NEW FILE: nagios-mysql.links ---
usr/share/doc/nagios-common usr/share/doc/nagios-mysql
usr/share/doc/nagios-common/create_mysql usr/share/dbconfig-common/data/nagios-mysql/install/mysql

--- NEW FILE: nagios-mysql.postinst ---
#!/bin/sh -e

# dbconfig-common related stuff
. /usr/share/debconf/confmodule
. /usr/share/dbconfig-common/dpkg/postinst.mysql
dbc_generate_include="template:/etc/nagios/database.cfg"
dbc_generate_include_args="-C# -O nagios:www-data -m 640 -o template_infile=/usr/share/nagios/debian/database.cfg"
dbc_first_version="2:1.3-cvs.20050402-11"
dbc_go nagios-mysql $@

# additionally, we need to manage a second configuration file:
cgi_template="/usr/share/nagios/debian/cgi.cfg.dbconfig"

case "$1" in
configure|upgrade)
	# dbconfigurate the cgi file, additionally.
	# oy.  now that's a command.
	dbconfig-generate-include -f template -C'#' \
	                          -o template_infile="$cgi_template" \
	                          -O nagios:www-data -m 640 -U \
	                          /etc/dbconfig-common/nagios-mysql.conf
							  /etc/nagios/cgi.cfg
;;
esac

# manually start nagios here instead of in -common.
if [ -x "/etc/init.d/nagios" ]; then
	update-rc.d nagios defaults 30 18 >/dev/null
	if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
		invoke-rc.d nagios start || exit 0
	else
		/etc/init.d/nagios start || exit 0
	fi
fi

#DEBHELPER#

--- NEW FILE: nagios-mysql.postrm ---
#!/bin/sh -e

. /usr/share/debconf/confmodule
. /usr/share/dbconfig-common/dpkg/postrm.mysql
dbc_go nagios-mysql $@

# stop the daemon if we're being removed
if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
	if [ -f /etc/init.d/nagios ]; then
		invoke-rc.d nagios stop || true
	fi
fi

if [ "$1" = "purge" ]; then
	rm -f /etc/nagios/database.cfg
fi

#DEBHELPER#

--- NEW FILE: nagios-mysql.prerm ---
#!/bin/sh -e

. /usr/share/debconf/confmodule
. /usr/share/dbconfig-common/dpkg/prerm.mysql
dbc_go nagios-mysql $@

if [ -x "/etc/init.d/nagios" ]; then
	if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
		invoke-rc.d nagios stop || exit 0
	else
		/etc/init.d/nagios stop || exit 0
	fi
fi

#DEBHELPER#

--- NEW FILE: nagios-pgsql.config ---
#!/bin/sh -e

. /usr/share/debconf/confmodule
. /usr/share/dbconfig-common/dpkg/config.pgsql 
dbc_first_version="2:1.3-cvs.20050402-11"
dbc_go nagios-pgsql $@


Index: nagios-pgsql.dirs
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios/nagios-pgsql.dirs,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- nagios-pgsql.dirs	7 Nov 2004 23:18:46 -0000	1.3
+++ nagios-pgsql.dirs	8 Dec 2005 13:12:23 -0000	1.4
@@ -1,2 +1,3 @@
 usr/sbin
 usr/lib/cgi-bin/nagios
+usr/share/dbconfig-common/data/nagios-pgsql/install

--- NEW FILE: nagios-pgsql.links ---
usr/share/doc/nagios-common usr/share/doc/nagios-pgsql
usr/share/doc/nagios-common/create_pgsql usr/share/dbconfig-common/data/nagios-pgsql/install/pgsql

--- NEW FILE: nagios-pgsql.postinst ---
#!/bin/sh -e
# postinst script for nagios-pgsql

# dbconfig-common related stuff
. /usr/share/debconf/confmodule
. /usr/share/dbconfig-common/dpkg/postinst.pgsql
dbc_generate_include="template:/etc/nagios/database.cfg"
dbc_generate_include_args="-C# -O nagios:www-data -m 640 -o template_infile=/usr/share/nagios/debian/database.cfg"
dbc_first_version="2:1.3-cvs.20050402-11"
dbc_go nagios-pgsql $@

# additionally, we need to manage a second configuration file:
cgi_template="/usr/share/nagios/debian/cgi.cfg.dbconfig"

case "$1" in
configure|upgrade)
	# dbconfigurate the cgi file, additionally.
	# oy.  now that's a command.
	dbconfig-generate-include -f template -C'#' \
	                          -o template_infile="$cgi_template" \
	                          -O nagios:www-data -m 640 -U \
	                          /etc/dbconfig-common/nagios-pgsql.conf \
							  /etc/nagios/cgi.cfg
;;
esac

# manually start nagios here instead of in -common.
if [ -x "/etc/init.d/nagios" ]; then
	update-rc.d nagios defaults 30 18 >/dev/null
	if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
		invoke-rc.d nagios start || exit 0
	else
		/etc/init.d/nagios start || exit 0
	fi
fi

#DEBHELPER#

--- NEW FILE: nagios-pgsql.postrm ---
#!/bin/sh -e

. /usr/share/debconf/confmodule
. /usr/share/dbconfig-common/dpkg/postrm.pgsql
dbc_go nagios-pgsql $@

# stop the daemon if we're being removed
if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
	if [ -f /etc/init.d/nagios ]; then
		invoke-rc.d nagios stop || true
	fi
fi

if [ "$1" = "purge" ]; then
	rm -f /etc/nagios/database.cfg
fi

#DEBHELPER#

--- NEW FILE: nagios-pgsql.prerm ---
#!/bin/sh -e

. /usr/share/debconf/confmodule
. /usr/share/dbconfig-common/dpkg/prerm.pgsql
dbc_go nagios-pgsql $@

# manually stop nagios here instead of in -common
if [ -x "/etc/init.d/nagios" ]; then
	if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
		invoke-rc.d nagios stop || exit 0
	else
		/etc/init.d/nagios stop || exit 0
	fi
fi

#DEBHELPER#

Index: nagios-text.postinst
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios/nagios-text.postinst,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- nagios-text.postinst	15 Feb 2005 22:17:39 -0000	1.1
+++ nagios-text.postinst	8 Dec 2005 13:12:23 -0000	1.2
@@ -14,7 +14,19 @@
 		chown nagios:www-data "$statusfile"
 		chmod 644 "$statusfile"
 	fi
+    # update the cgi.cfg, which is managed via ucf
+    ucf /usr/share/nagios/debian/cgi.cfg /etc/nagios/cgi.cfg
 ;;
 esac
 
+
+if [ -x "/etc/init.d/nagios" ]; then
+	update-rc.d nagios defaults 30 18 >/dev/null
+	if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
+		invoke-rc.d nagios start || exit 0
+	else
+		/etc/init.d/nagios start || exit 0
+	fi
+fi
+
 #DEBHELPER#

--- NEW FILE: nagios-text.prerm ---
#!/bin/sh -e

if [ -x "/etc/init.d/nagios" ]; then
	if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
		invoke-rc.d nagios stop || exit 0
	else
		/etc/init.d/nagios stop || exit 0
	fi
fi

Index: rules
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios/rules,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- rules	16 Oct 2005 18:23:33 -0000	1.21
+++ rules	8 Dec 2005 13:12:23 -0000	1.22
@@ -172,11 +172,12 @@
 		/usr/bin/install -m 755 cgi/$$bin.cgi.mysql debian/$@/usr/lib/cgi-bin/nagios/$$bin.cgi; \
 	done;
 
-	dh_link              -p$@ -P$(b)/$@ usr/share/doc/nagios-common usr/share/doc/nagios-mysql
+	dh_link              -p$@ -P$(b)/$@
 	dh_strip             -p$@ -P$(b)/$@
 	dh_compress          -p$@ -P$(b)/$@
 	dh_fixperms          -p$@ -P$(b)/$@
 	dh_installdeb        -p$@ -P$(b)/$@
+	dh_installdebconf    -p$@ -P$(b)/$@
 	dh_shlibdeps         -p$@ -P$(b)/$@
 	dh_gencontrol        -p$@ -P$(b)/$@
 	dh_makeshlibs        -p$@ -P$(b)/$@ -V
@@ -191,7 +192,7 @@
 		/usr/bin/install -m 755 cgi/$$bin.cgi.pgsql debian/$@/usr/lib/cgi-bin/nagios/$$bin.cgi; \
 	done;
 
-	dh_link              -p$@ -P$(b)/$@ usr/share/doc/nagios-common usr/share/doc/nagios-pgsql
+	dh_link              -p$@ -P$(b)/$@
 	dh_strip             -p$@ -P$(b)/$@
 	dh_compress          -p$@ -P$(b)/$@
 	dh_fixperms          -p$@ -P$(b)/$@
@@ -213,16 +214,18 @@
 	)
 	install -m 755 cgi/grouplist.cgi.in debian/$@/usr/lib/cgi-bin/nagios/grouplist.cgi
 	dh_installchangelogs -p$@ -P$(b)/$@ Changelog
-	dh_installinit 	     -p$@ -P$(b)/$@ --name nagios -- defaults 30 18
+	dh_installinit 	     -p$@ -P$(b)/$@ --no-start --name nagios -- defaults 30 18
 	dh_install           -p$@ -P$(b)/$@
 	chmod +x $(maindir)/debian/nagios-common/usr/lib/nagios/plugins/check-imap
+	chmod +x $(maindir)/debian/nagios-common/usr/lib/nagios/plugins/check_nagios_db
 	chmod +x $(maindir)/debian/nagios-common/usr/lib/cgi-bin/nagios/traceroute.cgi
 	chmod 660 $(maindir)/debian/nagios-common/etc/nagios/resource.cfg
 	rm -f $(maindir)/debian/nagios-common/etc/nagios/hosts.cfg
+	rm -f $(maindir)/debian/nagios-common/etc/nagios/cgi.cfg
 
 	dh_link              -p$@ -P$(b)/$@ usr/share/nagios-common/htdocs/docs usr/share/doc/nagios-common/html
 	dh_strip             -p$@ -P$(b)/$@
-	dh_compress          -p$@ -P$(b)/$@
+	dh_compress          -p$@ -P$(b)/$@ -Xcreate_mysql -Xcreate_pgsql
 	dh_fixperms          -p$@ -P$(b)/$@ -Xnagios/resource.cfg -Xcheck-imap
 	dh_installdebconf    -p$@ -P$(b)/$@
 	dh_installdeb        -p$@ -P$(b)/$@




More information about the Pkg-nagios-changes mailing list