+++ /dev/null
-#!/usr/bin/perl -w
-# Plugin to monitor pg_stat_*_tables (user by default)
-#
-# Copyright Dalibo <cedric.villemain@dalibo.com> 2007
-# Based on a plugin (postgres_block_read_) from Björn Ruberg <bjorn@linpro.no>
-#
-# Licenced under GPL v2.
-#
-# Usage:
-#
-# Symlink into /etc/munin/plugins/ and add the monitored
-# database to the filename. e.g.:
-#
-# ln -s /usr/share/munin/plugins/pg__stat_tables \
-# /etc/munin/plugins/pg_<databasename>_stat_tables
-# This should, however, be given through autoconf and suggest.
-#
-# If required, give username, password and/or Postgresql server
-# host through environment variables.
-#
-# You must also activate Postgresql statistics. See
-# http://www.postgresql.org/docs/8.1/interactive/monitoring-stats.html
-# for how to enable this. Specifically, the following lines must
-# exist in your postgresql.conf:
-#
-# stats_start_collector = true
-# stats_block_level = true
-#
-#
-# Parameters:
-#
-# config (required)
-#
-# Config variables:
-#
-# dbhost - Which database server to use. Defaults to
-# 'localhost'.
-# dbname - Which database to use. Defaults to template1
-# dbuser - A Postgresql user account with read permission to
-# the given database. Defaults to
-# 'postgres'. Anyway, Munin must be told which user
-# this plugin should be run as.
-# dbpass - The corresponding password, if
-# applicable. Default to undef. Remember that
-# pg_hba.conf must be configured accordingly.
-#
-# Magic markers
-#%# family=auto
-#%# capabilities=autoconf
-
-use strict;
-use DBI;
-use vars qw ( $debug $configure );
-use constant _PGMINI => 70400;
-
-my $dbhost = $ENV{'dbhost'} || '';
-my $dbname = $ENV{'dbname'} || 'template1';
-my $dbuser = $ENV{'dbuser'} || 'postgres';
-my $dbport = $ENV{'dbport'} || '5432';
-my $dbpass = $ENV{'dbpass'} || '';
-my $statscope = $ENV{'statscope'} || 'user';
-
-my $dsn = "DBI:Pg:dbname=$dbname";
-$dsn .=";host=$dbhost;port=$dbport" if $dbhost;
-my $pg_server_version;
-
-if (exists $ARGV[0]) {
- if ($ARGV[0] eq 'autoconf') {
- # Check for DBD::Pg
- if (! eval "require DBD::Pg;") {
- print "no (DBD::Pg not found)";
- exit 1;
- }
- my $dbh = DBI->connect ($dsn,
- $dbuser,
- $dbpass,
- {RaiseError =>1});
- if ($dbh) {
- $pg_server_version = $dbh->{'pg_server_version'};
- if ($pg_server_version < (_PGMINI)) {
- $pg_server_version =~ /(\d)(\d){2,2}(\d){2,2}/;
- print "PostgreSQL Server version " . (_PGMINI) . " or above is needed. Current is $1.$2.$3 \n";
- exit 1;
- }
- print "yes\n";
- exit 0;
- } else {
- print "no Unable to access Database $dbname on host $dbhost as user $dbuser.\nError returned was: ". $DBI::errstr;
- exit 1;
- }
- } elsif ($ARGV[0] eq 'debug') {
- # Set debug flag
- $debug = 1;
- } elsif ($ARGV[0] eq 'config') {
- # Set config flag
- $configure = 1;
- }
-}
-
-print "# $dsn\n" if $debug;
-my $dbh = DBI->connect ($dsn,
- $dbuser,
- $dbpass,
- {RaiseError =>1});
-
-die ("no Unable to access Database $dbname on host $dbhost as user $dbuser.\nError returned was: ". $DBI::errstr."\n") unless($dbh);
-$pg_server_version = $dbh->{'pg_server_version'};
-
-if ($configure) {
- print "graph_title Total Nominatim Lag Time\n";
- print "graph_vlabel Lag\n";
- print "graph_category Nominatim \n";
- print "graph_period minute\n";
- print "graph_args --base 1000\n";
-
- print "lag.label Lag\n";
- print "lag.draw LINE\n";
- print "lag.type GAUGE\n";
- print "lag.min 0\n";
-
-} else {
-
- my $sql = "select round(extract('epoch' from 'now'::timestamp with time zone - lastimportdate)) from import_status";
- print "# $sql\n" if $debug;
- my $sth = $dbh->prepare($sql);
- $sth->execute();
- printf ("# Rows: %d\n", $sth->rows) if $debug;
- if ($sth->rows > 0) {
- my ($lag) = $sth->fetchrow_array();
- print "lag.value $lag\n";
- }
-}
-
-exit 0;
-
+++ /dev/null
-#!/usr/bin/perl -w
-# Plugin to monitor pg_stat_*_tables (user by default)
-#
-# Copyright Dalibo <cedric.villemain@dalibo.com> 2007
-# Based on a plugin (postgres_block_read_) from Björn Ruberg <bjorn@linpro.no>
-#
-# Licenced under GPL v2.
-#
-# Usage:
-#
-# Symlink into /etc/munin/plugins/ and add the monitored
-# database to the filename. e.g.:
-#
-# ln -s /usr/share/munin/plugins/pg__stat_tables \
-# /etc/munin/plugins/pg_<databasename>_stat_tables
-# This should, however, be given through autoconf and suggest.
-#
-# If required, give username, password and/or Postgresql server
-# host through environment variables.
-#
-# You must also activate Postgresql statistics. See
-# http://www.postgresql.org/docs/8.1/interactive/monitoring-stats.html
-# for how to enable this. Specifically, the following lines must
-# exist in your postgresql.conf:
-#
-# stats_start_collector = true
-# stats_block_level = true
-#
-#
-# Parameters:
-#
-# config (required)
-#
-# Config variables:
-#
-# dbhost - Which database server to use. Defaults to
-# 'localhost'.
-# dbname - Which database to use. Defaults to template1
-# dbuser - A Postgresql user account with read permission to
-# the given database. Defaults to
-# 'postgres'. Anyway, Munin must be told which user
-# this plugin should be run as.
-# dbpass - The corresponding password, if
-# applicable. Default to undef. Remember that
-# pg_hba.conf must be configured accordingly.
-#
-# Magic markers
-#%# family=auto
-#%# capabilities=autoconf
-
-use strict;
-use DBI;
-use vars qw ( $debug $configure );
-use constant _PGMINI => 70400;
-
-my $dbhost = $ENV{'dbhost'} || '';
-my $dbname = $ENV{'dbname'} || 'template1';
-my $dbuser = $ENV{'dbuser'} || 'postgres';
-my $dbport = $ENV{'dbport'} || '5432';
-my $dbpass = $ENV{'dbpass'} || '';
-my $statscope = $ENV{'statscope'} || 'user';
-
-my $dsn = "DBI:Pg:dbname=$dbname";
-$dsn .=";host=$dbhost;port=$dbport" if $dbhost;
-my $pg_server_version;
-
-if (exists $ARGV[0]) {
- if ($ARGV[0] eq 'autoconf') {
- # Check for DBD::Pg
- if (! eval "require DBD::Pg;") {
- print "no (DBD::Pg not found)";
- exit 1;
- }
- my $dbh = DBI->connect ($dsn,
- $dbuser,
- $dbpass,
- {RaiseError =>1});
- if ($dbh) {
- $pg_server_version = $dbh->{'pg_server_version'};
- if ($pg_server_version < (_PGMINI)) {
- $pg_server_version =~ /(\d)(\d){2,2}(\d){2,2}/;
- print "PostgreSQL Server version " . (_PGMINI) . " or above is needed. Current is $1.$2.$3 \n";
- exit 1;
- }
- print "yes\n";
- exit 0;
- } else {
- print "no Unable to access Database $dbname on host $dbhost as user $dbuser.\nError returned was: ". $DBI::errstr;
- exit 1;
- }
- } elsif ($ARGV[0] eq 'debug') {
- # Set debug flag
- $debug = 1;
- } elsif ($ARGV[0] eq 'config') {
- # Set config flag
- $configure = 1;
- }
-}
-
-print "# $dsn\n" if $debug;
-my $dbh = DBI->connect ($dsn,
- $dbuser,
- $dbpass,
- {RaiseError =>1});
-
-die ("no Unable to access Database $dbname on host $dbhost as user $dbuser.\nError returned was: ". $DBI::errstr."\n") unless($dbh);
-$pg_server_version = $dbh->{'pg_server_version'};
-
-if ($configure) {
- print "graph_title Total Nominatim response time\n";
- print "graph_vlabel Time to response\n";
- print "graph_category Nominatim \n";
- print "graph_period minute\n";
- print "graph_args --base 1000\n";
-
- print "avg.label Average time to response\n";
- print "avg.draw LINE\n";
- print "avg.type GAUGE\n";
- print "avg.min 0\n";
- print "avg.info Moving 5 minute average time to perform search\n";
- print "avg.label Average time to response\n";
-
- print "min.label Fastest time to response\n";
- print "min.draw LINE\n";
- print "min.type GAUGE\n";
- print "min.min 0\n";
- print "min.info Fastest query in last 5 minutes\n";
-
- print "max.label Slowest time to response\n";
- print "max.draw LINE\n";
- print "max.type GAUGE\n";
- print "max.min 0\n";
- print "max.info Slowest query in last 5 minutes\n";
-
-} else {
-
- my $sql = "select TO_CHAR(avg(endtime-starttime),'SS.MS'),TO_CHAR(min(endtime-starttime),'SS.MS'),TO_CHAR(max(endtime-starttime),'SS.MS') from query_log where starttime > 'now'::timestamp - '5 minutes'::interval";
- print "# $sql\n" if $debug;
- my $sth = $dbh->prepare($sql);
- $sth->execute();
- printf ("# Rows: %d\n", $sth->rows) if $debug;
- if ($sth->rows > 0) {
- my ($avg, $min, $max) = $sth->fetchrow_array();
- print "avg.value $avg\n";
- print "min.value $min\n";
- print "max.value $max\n";
- }
-}
-
-exit 0;
-
+++ /dev/null
-#!/usr/bin/perl -w
-# Plugin to monitor pg_stat_*_tables (user by default)
-#
-# Copyright Dalibo <cedric.villemain@dalibo.com> 2007
-# Based on a plugin (postgres_block_read_) from Björn Ruberg <bjorn@linpro.no>
-#
-# Licenced under GPL v2.
-#
-# Usage:
-#
-# Symlink into /etc/munin/plugins/ and add the monitored
-# database to the filename. e.g.:
-#
-# ln -s /usr/share/munin/plugins/pg__stat_tables \
-# /etc/munin/plugins/pg_<databasename>_stat_tables
-# This should, however, be given through autoconf and suggest.
-#
-# If required, give username, password and/or Postgresql server
-# host through environment variables.
-#
-# You must also activate Postgresql statistics. See
-# http://www.postgresql.org/docs/8.1/interactive/monitoring-stats.html
-# for how to enable this. Specifically, the following lines must
-# exist in your postgresql.conf:
-#
-# stats_start_collector = true
-# stats_block_level = true
-#
-#
-# Parameters:
-#
-# config (required)
-#
-# Config variables:
-#
-# dbhost - Which database server to use. Defaults to
-# 'localhost'.
-# dbname - Which database to use. Defaults to template1
-# dbuser - A Postgresql user account with read permission to
-# the given database. Defaults to
-# 'postgres'. Anyway, Munin must be told which user
-# this plugin should be run as.
-# dbpass - The corresponding password, if
-# applicable. Default to undef. Remember that
-# pg_hba.conf must be configured accordingly.
-#
-# Magic markers
-#%# family=auto
-#%# capabilities=autoconf
-
-use strict;
-use DBI;
-use vars qw ( $debug $configure );
-use constant _PGMINI => 70400;
-
-my $dbhost = $ENV{'dbhost'} || '';
-my $dbname = $ENV{'dbname'} || 'template1';
-my $dbuser = $ENV{'dbuser'} || 'postgres';
-my $dbport = $ENV{'dbport'} || '5432';
-my $dbpass = $ENV{'dbpass'} || '';
-my $statscope = $ENV{'statscope'} || 'user';
-
-my $dsn = "DBI:Pg:dbname=$dbname";
-$dsn .=";host=$dbhost;port=$dbport" if $dbhost;
-my $pg_server_version;
-
-if (exists $ARGV[0]) {
- if ($ARGV[0] eq 'autoconf') {
- # Check for DBD::Pg
- if (! eval "require DBD::Pg;") {
- print "no (DBD::Pg not found)";
- exit 1;
- }
- my $dbh = DBI->connect ($dsn,
- $dbuser,
- $dbpass,
- {RaiseError =>1});
- if ($dbh) {
- $pg_server_version = $dbh->{'pg_server_version'};
- if ($pg_server_version < (_PGMINI)) {
- $pg_server_version =~ /(\d)(\d){2,2}(\d){2,2}/;
- print "PostgreSQL Server version " . (_PGMINI) . " or above is needed. Current is $1.$2.$3 \n";
- exit 1;
- }
- print "yes\n";
- exit 0;
- } else {
- print "no Unable to access Database $dbname on host $dbhost as user $dbuser.\nError returned was: ". $DBI::errstr;
- exit 1;
- }
- } elsif ($ARGV[0] eq 'debug') {
- # Set debug flag
- $debug = 1;
- } elsif ($ARGV[0] eq 'config') {
- # Set config flag
- $configure = 1;
- }
-}
-
-print "# $dsn\n" if $debug;
-my $dbh = DBI->connect ($dsn,
- $dbuser,
- $dbpass,
- {RaiseError =>1});
-
-die ("no Unable to access Database $dbname on host $dbhost as user $dbuser.\nError returned was: ". $DBI::errstr."\n") unless($dbh);
-$pg_server_version = $dbh->{'pg_server_version'};
-
-if ($configure) {
- print "graph_title Total Nominatim queries processed\n";
- print "graph_vlabel Number / \${graph_period}\n";
- print "graph_category Nominatim \n";
- print "graph_args --base 1000\n";
-
- print "search.label Queries performed\n";
- print "search.draw LINE\n";
- print "search.type DERIVE\n";
- print "search.min 0\n";
- print "search.info Number of search queries performed\n";
-
- print "search_completed.label Queries completed\n";
- print "search_completed.draw LINE\n";
- print "search_completed.type DERIVE\n";
- print "search_completed.min 0\n";
- print "search_completed.info Number of search queries completed\n";
-
- print "search_failed.label Queries failed\n";
- print "search_failed.draw LINE\n";
- print "search_failed.type DERIVE\n";
- print "search_failed.min 0\n";
- print "search_failed.info Number of search queries failed to find a match\n";
-} else {
-
- my $sql = "select count(*),sum(case when results > 0 THEN 1 ELSE 0 END),sum(case when results = 0 THEN 1 ELSE 0 END) from query_log";
- print "# $sql\n" if $debug;
- my $sth = $dbh->prepare($sql);
- $sth->execute();
- printf ("# Rows: %d\n", $sth->rows) if $debug;
- if ($sth->rows > 0) {
- my ($search, $search_completed, $search_failed) = $sth->fetchrow_array();
- print "search.value $search\n";
- print "search_completed.value $search_completed\n";
- print "search_failed.value $search_failed\n";
- }
-}
-
-exit 0;
-
variables :source_directory => source_directory
end
+munin_plugin_conf "nominatim" do
+ template "munin.erb"
+end
+
+munin_plugin "nominatim_importlag" do
+ target "#{source_directory}/munin/nominatim_importlag"
+end
+
+munin_plugin "nominatim_query_speed" do
+ target "#{source_directory}/munin/nominatim_query_speed"
+end
+
+munin_plugin "nominatim_requests" do
+ target "#{source_directory}/munin/nominatim_requests"
+end
+
+munin_plugin "nominatim_throttled_ips" do
+ target "#{source_directory}/munin/nominatim_throttled_ips"
+end