check_postgres.pl throws Could not find a suitable psql exe

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Ravina
Posts: 7
Joined: Wed Feb 08, 2017 4:06 am

check_postgres.pl throws Could not find a suitable psql exe

Post by Ravina »

Hi
I'm trying to monitor Postgres on Nagios Core.
While trying to connect to the Postgres Server,i'm getting the below error.
./check_postgres.pl --action=connection --db=dbname -H PostgresserverName -p 5432 -u DBUser
which: no psql in (/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/apps/data/hdpadmin/bin)
ERROR: Could not find a suitable psql executable.

Please help
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: check_postgres.pl throws Could not find a suitable psql

Post by rkennedy »

You're probably just missing the package as the error mentions -

Code: Select all

ERROR: Could not find a suitable psql executable.

Code: Select all

yum install postgresql
should install it and allow you to run it properly.
Former Nagios Employee
Ravina
Posts: 7
Joined: Wed Feb 08, 2017 4:06 am

Re: check_postgres.pl throws Could not find a suitable psql

Post by Ravina »

Thank You.
Now the connection looks fine.
Ravina
Posts: 7
Joined: Wed Feb 08, 2017 4:06 am

Re: check_postgres.pl throws Could not find a suitable psql

Post by Ravina »

Thanks and its working fine now.
I would like to add more services about PostgreSQL like database size,table size etc.
Currently check_postgres.pl is located in the below directory.
/usr/local/nagios/libexec/check_postgres.pl.

Could you please help how to do add other services with check_postgres.pl
Or do i need to install any other Postgres plugins?
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: check_postgres.pl throws Could not find a suitable psql

Post by rkennedy »

I would test it on the command line to find the metrics you're after - then, it really depends on how you defind the check_postgres command in Nagios. Here's what the help menu outputs for what's available -

Code: Select all

[root@xi libexec]# ./check_postgres.pl  --help
Usage: check_postgres.pl <options>
Run various tests against one or more Postgres databases.
Returns with an exit code of 0 (success), 1 (warning), 2 (critical), or 3 (unknown)
This is version 2.21.0.

Common connection options:
 -H,  --host=NAME       hostname(s) to connect to; defaults to none (Unix socket)
 -p,  --port=NUM        port(s) to connect to; defaults to 5432.
 -db, --dbname=NAME     database name(s) to connect to; defaults to 'postgres' or 'template1'
 -u   --dbuser=NAME     database user(s) to connect as; defaults to 'postgres'
      --dbpass=PASS     database password(s); use a .pgpass file instead when possible
      --dbservice=NAME  service name to use inside of pg_service.conf

Connection options can be grouped: --host=a,b --host=c --port=1234 --port=3344
would connect to a-1234, b-1234, and c-3344

Limit options:
  -w value, --warning=value   the warning threshold, range depends on the action
  -c value, --critical=value  the critical threshold, range depends on the action
  --include=name(s) items to specifically include (e.g. tables), depends on the action
  --exclude=name(s) items to specifically exclude (e.g. tables), depends on the action
  --includeuser=include objects owned by certain users
  --excludeuser=exclude objects owned by certain users

Other options:
  --assume-standby-mode assume that server in continious WAL recovery mode
  --assume-prod         assume that server in production mode
  --PGBINDIR=PATH       path of the postgresql binaries; avoid using if possible
  --PSQL=FILE           (deprecated) location of the psql executable; avoid using if possible
  -v, --verbose         verbosity level; can be used more than once to increase the level
  -h, --help            display this help information
  --man                 display the full manual
  -t X, --timeout=X     how long in seconds before we timeout. Defaults to 30 seconds.
  --symlinks            create named symlinks to the main program for each action

Actions:
Which test is determined by the --action option, or by the name of the program
 archive_ready         - Check the number of WAL files ready in the pg_xlog/archive_status
 autovac_freeze        - Checks how close databases are to autovacuum_freeze_max_age.
 backends              - Number of connections, compared to max_connections.
 bloat                 - Check for table and index bloat.
 checkpoint            - Checks how long since the last checkpoint
 cluster_id            - Checks the Database System Identifier
 commitratio           - Report if the commit ratio of a database is too low.
 connection            - Simple connection check.
 custom_query          - Run a custom query.
 database_size         - Report if a database is too big.
 dbstats               - Returns stats from pg_stat_database: Cacti output only
 disabled_triggers     - Check if any triggers are disabled
 disk_space            - Checks space of local disks Postgres is using.
 fsm_pages             - Checks percentage of pages used in free space map.
 fsm_relations         - Checks percentage of relations used in free space map.
 hitratio              - Report if the hit ratio of a database is too low.
 hot_standby_delay     - Check the replication delay in hot standby setup
 index_size            - Checks the size of indexes only.
 last_analyze          - Check the maximum time in seconds since any one table has been analyzed.
 last_autoanalyze      - Check the maximum time in seconds since any one table has been autoanalyzed.
 last_autovacuum       - Check the maximum time in seconds since any one table has been autovacuumed.
 last_vacuum           - Check the maximum time in seconds since any one table has been vacuumed.
 listener              - Checks for specific listeners.
 locks                 - Checks the number of locks.
 logfile               - Checks that the logfile is being written to correctly.
 new_version_bc        - Checks if a newer version of Bucardo is available.
 new_version_box       - Checks if a newer version of boxinfo is available.
 new_version_cp        - Checks if a newer version of check_postgres.pl is available.
 new_version_pg        - Checks if a newer version of Postgres is available.
 new_version_tnm       - Checks if a newer version of tail_n_mail is available.
 pgagent_jobs          - Check for no failed pgAgent jobs within a specified period of time.
 pgb_pool_cl_active    - Check the number of active clients in each pgbouncer pool.
 pgb_pool_cl_waiting   - Check the number of waiting clients in each pgbouncer pool.
 pgb_pool_maxwait      - Check the current maximum wait time for client connections in pgbouncer pools.
 pgb_pool_sv_active    - Check the number of active server connections in each pgbouncer pool.
 pgb_pool_sv_idle      - Check the number of idle server connections in each pgbouncer pool.
 pgb_pool_sv_login     - Check the number of login server connections in each pgbouncer pool.
 pgb_pool_sv_tested    - Check the number of tested server connections in each pgbouncer pool.
 pgb_pool_sv_used      - Check the number of used server connections in each pgbouncer pool.
 pgbouncer_backends    - Check how many clients are connected to pgbouncer compared to max_client_conn.
 pgbouncer_checksum    - Check that no pgbouncer settings have changed since the last check.
 prepared_txns         - Checks number and age of prepared transactions.
 query_runtime         - Check how long a specific query takes to run.
 query_time            - Checks the maximum running time of current queries.
 relation_size         - Checks the size of tables and indexes.
 replicate_row         - Verify a simple update gets replicated to another server.
 same_schema           - Verify that two databases have the exact same tables, columns, etc.
 sequence              - Checks remaining calls left in sequences.
 settings_checksum     - Check that no settings have changed since the last check.
 slony_status          - Ensure Slony is up to date via sl_status.
 table_size            - Checks the size of tables only.
 timesync              - Compare database time to local system time.
 txn_idle              - Checks the maximum "idle in transaction" time.
 txn_time              - Checks the maximum open transaction time.
 txn_wraparound        - See how close databases are getting to transaction ID wraparound.
 version               - Check for proper Postgres version.
 wal_files             - Check the number of WAL files in the pg_xlog directory


For a complete list of options and full documentation, view the manual.

    check_postgres.pl --man

Or visit: http://bucardo.org/check_postgres/


[root@xi libexec]#
Former Nagios Employee
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_postgres.pl throws Could not find a suitable psql

Post by tmcdonald »

Just checking in since we have not heard from you in a while. Did @rkennedy's post clear things up or has the issue otherwise been resolved?
Former Nagios employee
Locked