Re: nagios -- number of postgres connections

Поиск
Список
Период
Сортировка
От Rafael Martinez
Тема Re: nagios -- number of postgres connections
Дата
Msg-id 4A388698.80905@usit.uio.no
обсуждение исходный текст
Ответ на nagios -- number of postgres connections  (Whit Armstrong <armstrong.whit@gmail.com>)
Ответы Re: nagios -- number of postgres connections  (Rafael Martinez <r.m.guerrero@usit.uio.no>)
Список pgsql-general
Whit Armstrong wrote:
> anyone know a way to get nagios to monitor the number of postgres connections?
>
> Thanks,
> Whit
>

Hello

We use this plugin. Save it under /etc/munin/plugins/pg_connections and
update the file /etc/munin/plugin-conf.d/postgres with:

-------------------
[pg_connection]
     user postgres
-------------------

-------------------------------------------------
#!/bin/sh
#
# Plugin to monitor PostgreSQL connections.
#
# Parameters:
#
#       config   (required)
#       autoconf (optional - only used by munin-config)
#
# Magic markers (optional - used by munin-config and some installation
# scripts):
#%# family=auto
#%# capabilities=autoconf

PID_FILE="/var/lib/pgsql/data/postmaster.pid"

if [ "$1" = "autoconf" ]; then
  if [  -f $PID_FILE ]; then
    echo yes
    exit 0
  else
    echo "no (Service not running)"
    exit 1
  fi
else
  if [ "$1" = "suggest" ]; then
    ls -1 /tmp/
    exit 0
  fi
fi


if [ "$1" = "config" ]; then

        echo "graph_title Number of connections to the database"
        echo 'graph_args -l 0 '
        echo 'graph_vlabel Number of PostgreSQL connections'
        echo 'graph_category PostgreSQL'
        echo 'graph_period second'
        echo 'graph_info The number of opened connections to PostgreSQL.'
        echo 'established.label established'
        echo 'established.type GAUGE'
        echo 'established.max 500'
        echo 'established.info The number of currently open connections.'
        exit 0
fi

printf 'established.value '
/usr/bin/psql template1 -At -c "SELECT count(*) FROM pg_stat_activity"
-------------------------------------------------

PS.- You have to update the PATHS with the values in your system, and
the  user postgres needs access to your database, for this plugin to work.

regards,
--
 Rafael Martinez, <r.m.guerrero@usit.uio.no>
 Center for Information Technology Services
 University of Oslo, Norway

 PGP Public Key: http://folk.uio.no/rafael/

В списке pgsql-general по дате отправления:

Предыдущее
От: Scott Mead
Дата:
Сообщение: Re: nagios -- number of postgres connections
Следующее
От: Rafael Martinez
Дата:
Сообщение: Re: nagios -- number of postgres connections