1
Description: Backported plugins from upstream tags/1.3.4. postgres_block_read_,
2
postgres_commits_, postgres_connections, postgres_locks, postgres_queries_,
4
Origin: http://munin.projects.linpro.no/browser/tags/1.3.4/node/node.d/
1
6
Index: munin-1.2.6/node/node.d/postgres_block_read_.in
2
7
===================================================================
3
8
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
4
+++ munin-1.2.6/node/node.d/postgres_block_read_.in 2008-10-26 13:55:37.000000000 +0100
9
+++ munin-1.2.6/node/node.d/postgres_block_read_.in 2009-07-27 00:50:56.000000000 +0200
768
773
Index: munin-1.2.6/node/node.d/postgres_space_.in
769
774
===================================================================
770
775
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
771
+++ munin-1.2.6/node/node.d/postgres_space_.in 2008-10-26 13:56:35.000000000 +0100
776
+++ munin-1.2.6/node/node.d/postgres_space_.in 2009-07-27 00:53:09.000000000 +0200
776
+# Plugin to monitor PostgreSQL disk usage.
778
+# Written by Bjrn Ruberg (bjorn@linpro.no) 2006
779
+# Rewritten by Moses Moore 2006-04-08 moc.iazom@sesom
780
+# Licenced under GPL
787
+# Configuration variables:
789
+# PGHOST - Database server to use. Defaults to using ident
790
+# authentication with the local server.
791
+# PGPORT - Port to connect to. Defaults to '5432'.
792
+# PGDATABASE - Database to connect to. Defaults to 'template1'.
793
+# Note that this can be different from the database to
794
+# monitor, which is defined via the symlink.
795
+# PGUSER - User to connect as, if necessary.
796
+# PGPASSWORD - Corresponding password to use, if necessary.
798
+# (See libpq documentation for more.)
799
+# Note that PGDATABASE will default to 'template1' in this plugin, and
800
+# without PGHOST it will try ident authentication with the local server,
801
+# as the user that the plugin is running as.
803
+# Configuration example:
805
+# # Use local server, ident authentication with the 'postgres' user.
809
+# # Use local server, TCP authentication with a username and password.
811
+# env.PGHOST localhost
812
+# env.PGUSER someuser
813
+# env.PGPASSWORD somepassword
817
+#%# capabilities=suggest
783
+postgresql_space_ - Plugin to monitor PostgreSQL disk usage.
787
+Link the plugin to @@CONFDIR@@/plugins/ :
788
+ ln -s @@LIBDIR@@/plugins/postgres_space_ @@CONFDIR@@/plugins/postgres_space_dbname
790
+The database name from the link is only used in the graph title. You have to
791
+configure the name of the database to connect in the configuration file.
793
+=head1 CONFIGURATION
795
+The plugin supports the following parameters:
798
+ autoconf (optional - used by munin-node-configure)
801
+To configure the plugin set configuration variables in
802
+@@CONFDIR@@/plugin-conf.d/postgres :
804
+ PGHOST - Database server to use. Defaults to using ident
805
+ authentication with the local server.
806
+ PGPORT - Port to connect to. Defaults to '5432'.
807
+ PGDATABASE - Database to connect to. Defaults to 'template1'.
808
+ Note that this can be different from the database to
809
+ monitor, which is defined via the symlink.
810
+ PGUSER - User to connect as, if necessary.
811
+ PGPASSWORD - Corresponding password to use, if necessary.
813
+(See libpq documentation for more.)
815
+Note that PGDATABASE will default to 'template1' in this plugin, and
816
+without PGHOST it will try ident authentication with the local server,
817
+as the user that the plugin is running as.
819
+Configuration example:
821
+# Use local server, ident authentication with the 'postgres' user.
824
+ env.PGDATABASE myappdb
826
+# Use local server, TCP authentication with a username and password.
828
+ env.PGHOST localhost
829
+ env.PGDATABASE myappdb
830
+ env.PGUSER someuser
831
+ env.PGPASSWORD somepassword
835
+ Written by Bjrn Ruberg (bjorn@linpro.no) 2006
836
+ Rewritten by Moses Moore 2006-04-08 moc.iazom@sesom
843
+=head1 MAGIC MARKERS
846
+ #%# capabilities=autoconf suggest
828
859
+ # Check for DBD::Pg
829
860
+ if (! eval "require DBD::Pg;") {
830
861
+ print "no (DBD::Pg not found)";
833
864
+ # Then we try to detect PostgreSQL presence.
834
+ my $tempdbh = DBI->connect ('dbi:Pg:', '', '');
865
+ my $tempdbh = DBI->connect ('dbi:Pg:', '', '', { PrintError => 0 });
835
866
+ if ($tempdbh) {
839
870
+ print "no (Can't connect to given host, please check environment settings)\n";
842
873
+ } elsif ($ARGV[0] and $ARGV[0] eq 'debug') {
843
874
+ # Set config flag
943
974
+ "pg_toast_${relfilenode}_index");
944
975
+ my $relpages = $sth2->fetchrow_array;
945
976
+ if ($relkind eq 'r') {
946
+ $table_pages += $relpages if $meta == 0;
947
+ $metatable_pages += $relpages if $meta == 1;
977
+ $table_pages += $relpages if defined($relpages) and $meta == 0;
978
+ $metatable_pages += $relpages if defined($relpages) and $meta == 1;
948
979
+ } elsif ($relkind eq 'i') {
949
+ $table_indexes += $relpages if $meta == 0;
950
+ $metatable_indexes += $relpages if $meta == 1;
980
+ $table_indexes += $relpages if defined($relpages) and $meta == 0;
981
+ $metatable_indexes += $relpages if defined($relpages) and $meta == 1;
952
983
+ print "#\tR:$relfilenode\tP:$table_pages\tI:$table_indexes\n" if $debug;