# PostgreSQL user parameter

# Discovery Rule
#
# Database Discovery
UserParameter=db.list.discovery[*],"$1"/find_dbname.sh "$2"
UserParameter=db_table.list.discovery[*],"$1"/find_dbname_table.sh "$2"
UserParameter=sr.discovery[*],"$1"/find_sr.sh "$2"
UserParameter=sr.status.discovery[*],"$1"/find_sr_client_ip.sh "$2"
UserParameter=sr.db.list.discovery[*],"$1"/find_dbname.sh "$2"

# For pg_monz 2.0 psql monitoring
# $1: pgsql_*_funcs.sh directory path
# $2: pgsql_funcs.conf directory path
UserParameter=psql.running[*],"$1"/pgsql_simple.sh "$2"
UserParameter=psql.primary_server[*],"$1"/pgsql_primary.sh "$2"
UserParameter=psql.standby_server[*],"$1"/pgsql_standby.sh "$2"

# For pg_monz 2.0
#--- PostgreSQL user parameter -----------------------------------------------
# $1: pgsql_*_funcs.sh directory path
# $2: pgsql_funcs.conf directory path
# $3: hostname (which means the designated name specified on Zabbix Web UI)
# $4: zabbix_agentd.conf file path
# $5: DB name (only for LLD) or {$PGSLOWQUERY_TIME_THRESHOLD} ( only for pgsql.get.pg.slow_query )
# $6: DB schema name (only for LLD)
# $7: DB table name (only for LLD)
#-------------------------------------------------------------------------------
UserParameter=pgsql.get.pg.transactions[*],"$1"/pgsql_server_funcs.sh pg.transactions "$2" "$3" "$4"
UserParameter=pgsql.get.pg.bgwriter[*],"$1"/pgsql_server_funcs.sh pg.bgwriter $2 "$3" "$4"
UserParameter=pgsql.get.pg.slow_query[*],"$1"/pgsql_server_funcs.sh pg.slow_query "$2" "$3" "$4" "$5"
UserParameter=pgsql.get.pg.stat_database[*],"$1"/pgsql_db_funcs.sh pg.stat_database "$2" "$3" "$4" "$5"
UserParameter=pgsql.get.pg.size[*],"$1"/pgsql_userdb_funcs.sh pg.size "$2" "$3" "$4" "$5"

UserParameter=pgsql.get.pg.stat_table[*],"$1"/pgsql_tbl_funcs.sh pg.stat_table "$2" "$3" "$4" "$5" "$6" "$7"

#--- PostgreSQL SR user parameter --------------------------------------------
# $1: pgsql_*_funcs.sh directory path
# $2: pgsql_funcs.conf directory path
# $3: hostname (which means the designated name specified on Zabbix Web UI)
# $4: zabbix_agentd.conf file path
#-------------------------------------------------------------------------------
UserParameter=pgsql.get.pg.stat_replication[*],"$1"/pgsql_sr_server_funcs.sh pg.stat_replication "$2" "$3" "$4"
UserParameter=pgsql.get.pg.sr.status[*],"$1"/pgsql_sr_server_funcs.sh pg.sr.status "$2" "$3" "$4"

#--- pgpool-II user parameter --------------------------------------------
# Discovery Rule
UserParameter=backend.discovery[*],"$1"/find_pgpool_backend.sh "$2"
UserParameter=backend.status.discovery[*],"$1"/find_pgpool_backend_ip.sh "$2"

#--- pgpool-II user parameter --------------------------------------------
UserParameter=pgpool.running[*],"$1"/pgpool_simple.sh "$2"
UserParameter=pgpool.have_delegate_ip[*],"$1"/pgpool_delegate_ip.sh "$2"
UserParameter=pgpool.get.nodes[*],"$1"/pgpool_backend_status.sh pgpool.nodes "$2" "$3" "$4"
UserParameter=pgpool.get.connections[*],"$1"/pgpool_connections.sh pgpool.connections "$2" "$3" "$4"
UserParameter=pgpool.get.cache[*],"$1"/pgpool_cache.sh pgpool.cache $2 "$3" "$4" 
