0

I am trying to setup monitoring for my PostgreSQL installation with zabbix ang pg_monz.
I've followed this standard installation guide(http://pg-monz.github.io/pg_monz/index-en.html#install). Everything seems working ok, besides PostgreSQL service running item, script that comes with pg_monz returns 0, however DB is running and other parameters are monitored.
What could be the issue here?

pgsql_simple.sh script #!/bin/bash

PGSHELL_CONFDIR="$1"

# Load the psql connection option parameters.
source $PGSHELL_CONFDIR/pgsql_funcs.conf

psql -t -A -h $PGHOST -p $PGPORT -U $PGROLE $DBNAME -c "select 1;" 2>/dev/null
if [ $? -ne 0 ]; then
    echo 0
fi

zabbix userparameter:

UserParameter=psql.running[*],"$1"/pgsql_simple.sh "$2"
erizo
  • 157
  • 1
  • 6
  • Remove "2>/dev/null" temporary and execute script as zabbix user. You should to see in the output what is your problem (credentials,permissions,...) – Jan Garaj Sep 24 '15 at 07:43
  • Permissions are ok, all scripts belong to zabbix user. Also there is .pgpass in zabbix home directory. psql works well from terminal, but from script it doesn't. – erizo Sep 24 '15 at 07:46

1 Answers1

0

Wasn't expecting that, but problem was in the pg_monz script. Database name in configuration was declared as PGDATABASE but in the script that executes query $DBNAME was used to retrieve that name. Fixed that and monitoring started working.

erizo
  • 157
  • 1
  • 6