[check_postgres] [commit] Perl module-a-fy

check_postgres at bucardo.org check_postgres at bucardo.org
Fri May 1 19:19:20 UTC 2009


Committed by Greg Sabino Mullane <greg at endpoint.com>

Perl module-a-fy

---
 .perlcriticrc     |    1 +
 MANIFEST          |   55 ++++++++++++++++++++++++++++++++++++++++
 MANIFEST.SKIP     |    8 ++++++
 META.yml          |   54 +++++++++++++++++++++++++++++++++++++++
 Makefile          |   36 --------------------------
 Makefile.PL       |   72 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 README            |   69 ++++++++++++++++++++++++++++++++++++++++++++++++++
 check_postgres.pl |    3 +-
 8 files changed, 261 insertions(+), 37 deletions(-)

diff --git a/.perlcriticrc b/.perlcriticrc
index b10f0b3..2645ed9 100644
--- a/.perlcriticrc
+++ b/.perlcriticrc
@@ -2,6 +2,7 @@
 
 verbose = 8
 severity = 1
+profile-strictness = quiet
 
 [Documentation::PodSpelling]
 stop_words = Mullane Nagios Slony nols salesrep psql dbname postgres USERNAME usernames dbuser pgpass nagios stderr showperf symlinked timesync criticals quirm lancre exabytes sami includeuser excludeuser flagg tardis WAL tablespaces tablespace perflimit burrick mallory grimm oskar ExclusiveLock garrett artemus queryname speedtest checksum checksums morpork klatch pluto faceoff slon greg watson franklin wilkins scott Sabino Seklecki dbpass autovacuum Astill refactoring NAGIOS localhost cronjob symlink symlinks backends snazzo logfile syslog parens plugin Cwd Ioannis Tambouras schemas SQL MRTG mrtg uptime datallowconn dbhost dbport ok contrib pageslots robert dylan emma fsm minvalue nextval dbstats del ret upd Bucardo noidle bucardo petabytes zettabytes tuples
diff --git a/MANIFEST b/MANIFEST
new file mode 100644
index 0000000..4119589
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,55 @@
+check_postgres.pl
+check_postgres.pl.asc
+check_postgres.pl.html
+README
+SIGNATURE
+Makefile.PL
+index.html
+MANIFEST
+MANIFEST.SKIP
+.gitignore
+.perlcriticrc
+META.yml
+
+
+t/00_basic.t
+t/00_signature.t
+t/00_test_tester.t
+t/02_autovac_freeze.t
+t/02_backends.t
+t/02_bloat.t
+t/02_checkpoint.t
+t/02_connection.t
+t/02_custom_query.t
+t/02_database_size.t
+t/02_dbstats.t
+t/02_disabled_triggers.t
+t/02_disk_space.t
+t/02_fsm_pages.t
+t/02_fsm_relations.t
+t/02_last_analyze.t
+t/02_last_vacuum.t
+t/02_listener.t
+t/02_locks.t
+t/02_logfile.t
+t/02_new_version_cp.t
+t/02_new_version_pg.t
+t/02_prepared_txns.t
+t/02_query_runtime.t
+t/02_query_time.t
+t/02_relation_size.t
+t/02_replicate_row.t
+t/02_sequence.t
+t/02_settings_checksum.t
+t/02_timesync.t
+t/02_txn_idle.t
+t/02_txn_time.t
+t/02_txn_wraparound.t
+t/02_version.t
+t/02_wal_files.t
+t/03_translations.t
+t/99_cleanup.t
+t/99_perlcritic.t
+t/99_pod.t
+t/99_spellcheck.t
+t/CP_Testing.pm
diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP
new file mode 100644
index 0000000..24da8d8
--- /dev/null
+++ b/MANIFEST.SKIP
@@ -0,0 +1,8 @@
+test_database_check_postgres/
+~$
+^tmp/
+^blib/
+Makefile
+pm_to_blib
+TODO
+tar.gz$
diff --git a/META.yml b/META.yml
new file mode 100644
index 0000000..c159a7f
--- /dev/null
+++ b/META.yml
@@ -0,0 +1,54 @@
+--- #YAML:1.0
+name                        : check_postgres.pl
+version                     : 2.8.0
+abstract                    : Postgres monitoring script
+author:              
+  - Greg Sabino Mullane <greg at endpoint.com>
+
+license                     : bsd
+distribution_type           : script
+dynamic_config              : 0
+
+requires:
+  perl                      : 5.006001
+build_requires:
+  Test::More                : 0.61
+recommends:
+  Cwd                       : 0
+  File::Temp                : 0
+  File::Comments            : 0
+  Module::Signature         : 0.50
+  Perl::Critic              : 0
+  Pod::Spell                : 0
+  Time::HiRes               : 0
+  Test::Pod                 : 0.95
+  Test::Pod::Coverage       : 0
+  Test::Warn                : 0.08
+  Test::YAML::Meta          : 0.03
+  Text::SpellChecker        : 0
+
+provides:
+  check_postgres:
+    file                    : check_postgres.pl
+    version                 : 2.8.0
+
+keywords:
+  - Postgres
+  - PostgreSQL
+  - Nagios
+  - monitoring
+  - MRTG
+  - bloat
+
+resources:
+  homepage                  : http://bucardo.org/check_postgres/
+  license                   : http://bucardo.org/check_postgres/
+  bugtracker                : http://bucardo.org/check_postgres/
+  MailingList               : https://mail.endcrypt.com/mailman/listinfo/check_postgres
+  Repository                : http://bucardo.org/check_postgres.git/
+
+meta-spec:
+  version                   : 1.4
+  url                       : http://module-build.sourceforge.net/META-spec-v1.4.html
+
+generated_by                : emacs
diff --git a/Makefile b/Makefile
deleted file mode 100644
index f0c9cff..0000000
--- a/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
-
-all: check_postgres.pl.html index.html
-
-check_postgres.pl.html: check_postgres.pl
-
-	pod2html check_postgres.pl > check_postgres.pl.html
-	@ perl -pi -e "s/<link.*?>//" check_postgres.pl.html
-	perl -pi -e "s~ git clone.*~ git clone http://bucardo.org/check_postgres.git</pre>~" check_postgres.pl.html
-	perl -pi -e "s~<title>\S+(.+)~<title>check_postgres.pl\\1</TITLE>~" check_postgres.pl.html
-	perl -pi -e "s~.*</title>~~" check_postgres.pl.html
-	perl -pi -e "s~</TITLE>~</title>~" check_postgres.pl.html
-	perl -pi -e "s~\`\`(.+?)''~&quot;\\1&quot;~g" check_postgres.pl.html
-	@ rm -f pod2htmd.tmp pod2htmi.tmp
-
-index.html: check_postgres.pl
-
-	perl -pi -e "s/\d+\.\d+\.\d+/`grep describes check_postgres.pl | cut -d' ' -f6`/" index.html
-	perl -pi -e "s/released on ([^\.]+)/released on `date +\"%B %d, %Y\"`/" index.html
-
-critic:
-
-	perlcritic --profile-strictness quiet check_postgres.pl
-
-test:
-
-	@ prove t/*.t
-
-signature:
-
-	@ gpg --yes -ba check_postgres.pl
-	@ gpg --verify check_postgres.pl.asc
-
-clean:
-
-	@ (kill `head -1 test_database_check_postgres/data\ space/postmaster.pid | awk '{print $1}'`) 2>/dev/null
-	@ rm -fr test_database_check_postgres
diff --git a/Makefile.PL b/Makefile.PL
new file mode 100644
index 0000000..f7cc3af
--- /dev/null
+++ b/Makefile.PL
@@ -0,0 +1,72 @@
+# $Id: Makefile.PL 12712 2009-04-23 16:22:51Z turnstep $
+
+use ExtUtils::MakeMaker;
+use Config;
+use strict;
+use warnings;
+use 5.006001;
+
+my $VERSION = '2.8.0';
+
+if ($VERSION =~ /_/) {
+	print "WARNING! This is a test version ($VERSION) and should not be used in production!\n";
+}
+
+if (grep { /help/ } @ARGV) {
+	print qq{
+Usage: perl $0
+
+The usual steps to install check_postgres.pl:
+
+1.   perl Makefile.PL
+2.   make
+3.   make test
+4.   make install
+
+Do steps 1 to 3 as a normal user, not as root!
+
+See the README file for more help.
+
+If all else fails, email check_postgres\@bucardo.org for help.
+
+};
+
+	exit 1;
+
+
+}
+
+print "Configuring check_postgres $VERSION\n";
+
+my %opts =
+	(
+	 NAME           => 'check_postgres',
+	 VERSION_FROM   => 'check_postgres.pl',
+	 AUTHOR         => 'Greg Sabino Mullane <greg at endpoint.com>',
+	 ABSTRACT       => 'Postgre monitoring script',
+	 PREREQ_PM      => {
+						'ExtUtils::MakeMaker' => '6.11',
+						'Test::More'          => '0.61',
+						'version'             => '0',
+					   },
+	 NEEDS_LINKING  => 0,
+	 NO_META        => 1,
+     NORECURS       => 1,
+     MAN1PODS       => {},
+	 clean          => { FILES => 'test_database_check_postgres/' },
+);
+
+{
+	package MY;
+	sub clean {
+		my $string = shift->SUPER::clean(@_);
+		$string =~ s{\t}{\tperl t/99_cleanup\.t\n\t};
+		return $string;
+	}
+}
+
+my $output = WriteMakefile(%opts);
+
+exit 0;
+
+# end of Makefile.PL
diff --git a/README b/README
new file mode 100644
index 0000000..ee4db39
--- /dev/null
+++ b/README
@@ -0,0 +1,69 @@
+This is check_postgres, a monitoring tool for Postgres.
+
+The most complete and up to date information about this script can be found at:
+
+http://bucardo.org/check_postgres/
+
+You should go check there right now to make sure you are installing 
+the latest version!
+
+This document will cover how to install the script.
+
+* Quick method:
+
+For the impatient Nagios admin, just copy the "check_postgres.pl" file 
+to your Nagios scripts directory, and perhaps symlink entries to that 
+file by:
+
+cd <the directory you just copied the file to>
+mkdir postgres
+cd postgres
+perl ../check_postgres.pl --symlinks
+
+Then join the announce mailing list (see below)
+
+
+* Complete method:
+
+The better way to install this script is via the standard Perl process:
+
+perl Makefile.PL
+make
+make test
+make install
+
+The last step usually needs to be done as the root user. You may want to 
+copy the script to a place that makes more sense for Nagios, if using it 
+for that purpose. See the "Quick" insructions above.
+
+For 'make test', please report any failing tests to check_postgres at bucardo.org. 
+The tests need to have some standard Postgres binaries available, such as 
+'initdb', 'psql', and 'pg_ctl'. If these are not in your path, or you want to 
+use specific ones, pleae set the environment variable PGBINDIR first.
+
+Once 'make install' has been done, you should have access to the complete 
+documentation by typing:
+
+man check_postgres
+
+The HTML version of the documentation is also available at:
+
+http://bucardo.org/check_postgres/check_postgres.pl.html
+
+* Mailing lists
+
+The final step should be to subscribe to the low volume check_postgres-announce 
+mailing list, so you learn of new versions and important changes. Information 
+on joining can be found at:
+
+https://mail.endcrypt.com/mailman/listinfo/check_postgres-announce
+
+General questions and development issues are discussed on the check_postgres list, 
+which we recommend people join as well:
+
+https://mail.endcrypt.com/mailman/listinfo/check_postgres
+
+Development happens via git. You can check out the repository by doing:
+
+git clone http://bucardo.org/check_postgres.git
+
diff --git a/check_postgres.pl b/check_postgres.pl
index 8144315..2e23045 100755
--- a/check_postgres.pl
+++ b/check_postgres.pl
@@ -6076,7 +6076,7 @@ Items not specifically attributed are by Greg Sabino Mullane.
 
 =over 4
 
-=item B<Version 2.8.0> (April ??, 2009)
+=item B<Version 2.8.0> (May ??, 2009)
 
   Added internationalization support (Greg)
   Added the 'disabled_triggers' check (Greg)
@@ -6089,6 +6089,7 @@ Items not specifically attributed are by Greg Sabino Mullane.
   Make fsm_pages and fsm_relatins handle 8.4 servers smoothly. (Greg)
   Fix missing 'upd' field in show_dbstats (Andras Fabian)
   Allow ENV{PGCONTROLDATA} and ENV{PGBINDIR}. (Greg)
+  Add various Perl module infratructure, including (e.g. Makefile.PL) (Greg)
   Fix incorrect regex in txn_wraparound (Greg)
   For txn_wraparound: consistent ordering and fix duplicates in perf output (Andras Fabian)
   Add in missing exabyte regex check (Selena Deckelmann)
-- 
1.6.0.5



More information about the Check_postgres mailing list