Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pg_monz/usr-local-bin/find_dbname.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

# Get list of Database Name which you want to monitor.
# The default settings are excepted template databases(template0/template1).
Expand All @@ -13,7 +13,7 @@ PGSHELL_CONFDIR="$1"
GETDB="select datname from pg_database where datistemplate = 'f';"

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

result=$(psql -h $PGHOST -p $PGPORT -U $PGROLE -d $PGDATABASE -t -c "${GETDB}" 2>&1)
if [ $? -ne 0 ]; then
Expand Down
4 changes: 2 additions & 2 deletions pg_monz/usr-local-bin/find_dbname_table.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

PGSHELL_CONFDIR="$1"

Expand Down Expand Up @@ -38,7 +38,7 @@ GETDB="select datname from pg_database where datistemplate = 'f';"
GETTABLE="select row_to_json(t) from (select current_database() as \"{#DBNAME}\",schemaname as \"{#SCHEMANAME}\",tablename as \"{#TABLENAME}\" from pg_tables where schemaname not in ('pg_catalog','information_schema')) as t"

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

# This low level discovery rules are disabled by deafult.
dbname_list=$(psql -h $PGHOST -p $PGPORT -U $PGROLE -d $PGDATABASE -t -c "${GETDB}" 2>&1)
Expand Down
4 changes: 2 additions & 2 deletions pg_monz/usr-local-bin/find_pgpool_backend.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

# Get list of pgpool-II database backend name which you want to monitor.

Expand All @@ -7,7 +7,7 @@ PGPOOLSHELL_CONFDIR="$1"
POOL_STATUS="show pool_status"

# Load the pgpool connection option parameters.
source $PGPOOLSHELL_CONFDIR/pgpool_funcs.conf
. $PGPOOLSHELL_CONFDIR/pgpool_funcs.conf

config=$(psql -A --field-separator=',' -h $PGPOOLHOST -p $PGPOOLPORT -U $PGPOOLROLE -d $PGPOOLDATABASE -t -c "${POOL_STATUS}" 2>&1)
if [ $? -ne 0 ]; then
Expand Down
4 changes: 2 additions & 2 deletions pg_monz/usr-local-bin/find_pgpool_backend_ip.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

# Get list of pgpool-II database backend name which you want to monitor.

Expand All @@ -7,7 +7,7 @@ PGPOOLSHELL_CONFDIR="$1"
POOL_STATUS="show pool_status"

# Load the pgpool connection option parameters.
source $PGPOOLSHELL_CONFDIR/pgpool_funcs.conf
. $PGPOOLSHELL_CONFDIR/pgpool_funcs.conf

config=$(psql -A --field-separator=',' -h $PGPOOLHOST -p $PGPOOLPORT -U $PGPOOLROLE -d $PGPOOLDATABASE -t -c "${POOL_STATUS}" 2>&1)
if [ $? -ne 0 ]; then
Expand Down
4 changes: 2 additions & 2 deletions pg_monz/usr-local-bin/find_sr.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash
#!/bin/sh

PGSHELL_CONFDIR="$1"

GETROW="select count(*) from pg_stat_replication"

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

result=$(psql -h $PGHOST -p $PGPORT -U $PGROLE -d $PGDATABASE -t -c "$GETROW" 2>&1)
if [ $? -ne 0 ]; then
Expand Down
4 changes: 2 additions & 2 deletions pg_monz/usr-local-bin/find_sr_client_ip.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash
#!/bin/sh

PGSHELL_CONFDIR="$1"

GETTABLE="select row_to_json(t) from (select client_addr as \"{#SRCLIENT}\" from pg_stat_replication) as t"

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

result=$(psql -h $PGHOST -p $PGPORT -U $PGROLE -d $PGDATABASE -t -c "${GETTABLE}" 2>&1)
if [ $? -ne 0 ]; then
Expand Down
4 changes: 2 additions & 2 deletions pg_monz/usr-local-bin/pgpool_backend_status.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

# Get status of pgpool-II database backend which you want to monitor.

Expand All @@ -11,7 +11,7 @@ BACKENDDB="show pool_nodes"
TIME=` date +%s`

# Load the pgpool connection option parameters.
source $PGPOOLSHELL_CONFDIR/pgpool_funcs.conf
. $PGPOOLSHELL_CONFDIR/pgpool_funcs.conf

case "$APP_NAME" in
pgpool.nodes)
Expand Down
4 changes: 2 additions & 2 deletions pg_monz/usr-local-bin/pgpool_cache.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

# Get list of pgpool-II database backend name which you want to monitor.

Expand All @@ -11,7 +11,7 @@ POOL="show pool_cache"
TIME=` date +%s`

# Load the pgpool connection option parameters.
source $PGPOOLSHELL_CONFDIR/pgpool_funcs.conf
. $PGPOOLSHELL_CONFDIR/pgpool_funcs.conf

case "$APP_NAME" in
pgpool.cache)
Expand Down
4 changes: 2 additions & 2 deletions pg_monz/usr-local-bin/pgpool_connections.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

# Get list of pgpool-II database backend name which you want to monitor.

Expand All @@ -11,7 +11,7 @@ POOL="show pool_pools"
TIME=` date +%s`

# Load the pgpool connection option parameters.
source $PGPOOLSHELL_CONFDIR/pgpool_funcs.conf
. $PGPOOLSHELL_CONFDIR/pgpool_funcs.conf

case "$APP_NAME" in
pgpool.connections)
Expand Down
4 changes: 2 additions & 2 deletions pg_monz/usr-local-bin/pgpool_delegate_ip.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
#!/bin/sh

PGSHELL_CONFDIR="$1"

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

if [ ! -n "$PGPOOLCONF" ]; then
echo 0
Expand Down
4 changes: 2 additions & 2 deletions pg_monz/usr-local-bin/pgpool_simple.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
#!/bin/sh

PGSHELL_CONFDIR="$1"

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

psql -t -A -h $PGPOOLHOST -p $PGPOOLPORT -U $PGPOOLROLE $PGPOOLDATABASE -c "select 1" 2>/dev/null
if [ $? -ne 0 ]; then
Expand Down
4 changes: 2 additions & 2 deletions pg_monz/usr-local-bin/pgsql_db_funcs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

APP_NAME="$1"
PGSHELL_CONFDIR="$2"
Expand All @@ -9,7 +9,7 @@ DBNAME="$5"
TIMESTAMP_QUERY='extract(epoch from now())::int'

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

case "$APP_NAME" in
pg.stat_database)
Expand Down
4 changes: 2 additions & 2 deletions pg_monz/usr-local-bin/pgsql_primary.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
#!/bin/sh

PGSHELL_CONFDIR="$1"

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

result=$(psql -A -t -h $PGHOST -p $PGPORT -U $PGROLE -d $PGDATABASE -c "select (NOT(pg_is_in_recovery()))::int" 2>&1)
echo "$result"
4 changes: 2 additions & 2 deletions pg_monz/usr-local-bin/pgsql_server_funcs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
#===============================================================================
# GLOBAL DECLARATIONS
#===============================================================================
Expand All @@ -9,7 +9,7 @@ ZABBIX_AGENTD_CONF="$4"
PARAM1="$5"

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

TIMESTAMP_QUERY='extract(epoch from now())::int'

Expand Down
4 changes: 2 additions & 2 deletions pg_monz/usr-local-bin/pgsql_simple.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
#!/bin/sh

PGSHELL_CONFDIR="$1"

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

psql -t -A -h $PGHOST -p $PGPORT -U $PGROLE -d $PGDATABASE -c "select 1" 2>/dev/null
if [ $? -ne 0 ]; then
Expand Down
4 changes: 2 additions & 2 deletions pg_monz/usr-local-bin/pgsql_sr_server_funcs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
#===============================================================================
# GLOBAL DECLARATIONS
#===============================================================================
Expand All @@ -10,7 +10,7 @@ ZABBIX_AGENTD_CONF="$4"
TIMESTAMP_QUERY='extract(epoch from now())::int'

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

PGVERSION=$(psql -A -t -h $PGHOST -p $PGPORT -U $PGROLE $PGDATABASE -c 'select * from version()' | cut -d ' ' -f 2 | sed -e 's/\([0-9]\+\.[0-9]\+\).*/\1/g')

Expand Down
4 changes: 2 additions & 2 deletions pg_monz/usr-local-bin/pgsql_standby.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
#!/bin/sh

PGSHELL_CONFDIR="$1"

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

result=$(psql -A -t -h $PGHOST -p $PGPORT -U $PGROLE -d $PGDATABASE -c "select pg_is_in_recovery()::int" 2>&1)
echo "$result"
4 changes: 2 additions & 2 deletions pg_monz/usr-local-bin/pgsql_tbl_funcs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

APP_NAME="$1"
PGSHELL_CONFDIR="$2"
Expand All @@ -11,7 +11,7 @@ TABLENAME="$7"
TIMESTAMP_QUERY='extract(epoch from now())::int'

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

case "$APP_NAME" in
pg.stat_table)
Expand Down
4 changes: 2 additions & 2 deletions pg_monz/usr-local-bin/pgsql_userdb_funcs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

APP_NAME="$1"
PGSHELL_CONFDIR="$2"
Expand All @@ -9,7 +9,7 @@ DBNAME="$5"
TIMESTAMP_QUERY='extract(epoch from now())::int'

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

case "$APP_NAME" in
pg.size)
Expand Down