Page 1 of 1
Postgres Database Size ERROR
Posted: Wed Feb 28, 2018 9:05 am
by coco163
Hi,
I have two Postgres engines version 9.3 and 9.4 for both and same configuration.
pg_hba.conf is configured for my nagios to have access and it works.
But for one engine, when i have all information when i check the database size mentioning
only one dabatase, the script actually check
all databases as you can see on the following output.
Command:
Code: Select all
check_postgres.pl -H XXXXXXX--port=5432 --dbuser=xxx--dbname=xxx--dbpass="xxx" --action=database_size --warning=50GB --critical=60GB
Result:
Code: Select all
POSTGRES_DATABASE_SIZE OK: DB "XXXXX" (host:XXXXXXX) mydatabase: 50831362232 (47 GB) postgres: 6793400 (6634 kB) template0: 6793400 (6634 kB) template1: 6793400 (6634 kB)
On another hand, on another server, i can check all postgres element, such as Table size, connections...etc, but the access of template0 is not op0en (because not in use on production) and returns the following error:
Code: Select all
ERROR: permission denied for database template0
Why does the script checks all the databases where we specify only one?
Re: Postgres Database Size ERROR
Posted: Wed Feb 28, 2018 5:54 pm
by cdienger
The check has this to say regarding the check_database_size function:
## Check the size of one or more databases
## Supports: Nagios, MRTG
## mrtg reports the largest two databases
## By default, checks all databases
## Can check specific one(s) with include
## Can ignore some with exclude
## Warning and critical are bytes
## Valid units: b, k, m, g, t, e
## All above may be written as plural or with a trailing 'b'
## Limit to a specific user (db owner) with the includeuser option
## Exclude users with the excludeuser option
To run this for a specific database you can use the --include=dbname
Re: Postgres Database Size ERROR
Posted: Thu Mar 01, 2018 1:51 am
by coco163
Problem remains:
[
[email protected] ~]$ /usr/local/nagios/libexec/check_postgres.pl -H XXXXXXXX --port=5432 --dbuser=XXXX --dbname=mydatabase --dbpass="mypassword" --include=mydatabase --exclude=template0 --action=database_size --warning=500MB --critical=1GB
ERROR: permission denied for database template0
On another hand:
Code: Select all
[[email protected] ~]$ /usr/local/nagios/libexec/check_postgres.pl -H XXXXXXXX --port=5432 --dbuser=XXXX --dbname=mydatabase --dbpass="mypassword" --action=connection
POSTGRES_CONNECTION OK: DB "mydatabase" (host:XXXXXXXX) version 9.4.11 | time=0.01s
Re: Postgres Database Size ERROR
Posted: Thu Mar 01, 2018 5:25 pm
by cdienger
I haven't been able to reproduce the issue yet. Please confirm the version by running .
/check_postgres.pl --version and also run the command with the
--verbose option to get more detailed output.
There are also some alternative postgres plugins available on the exchange including
https://exchange.nagios.org/directory/P ... ze/details that may work better for you.
Re: Postgres Database Size ERROR
Posted: Sun Mar 04, 2018 9:02 am
by coco163
Code: Select all
[root@localhost libexec]# ./check_postgres.pl -H XXXXXXXXXXXX --port=5432 --dbuser=XXXX --dbname=XXXXX --dbpass="XXXXXXXXX" --action=database_size --warning=500MB --critical=1GB --verbose
ERROR: permission denied for database template0
Code: Select all
[root@localhost libexec]# ./check_postgres.pl --version
check_postgres.pl version 2.23.0
Re: Postgres Database Size ERROR
Posted: Mon Mar 05, 2018 2:25 pm
by scottwilkerson
Where did you get this version? The latest we ship with Nagios XI is 2.21.0
I have a postgres server with both a template0 and template1 database on my nagios server. Running 2.21.0 of the plugin with this command I get this output
Code: Select all
# /usr/local/nagios/libexec/check_postgres.pl -H localhost --port=5432 --dbuser=nagiosxi --dbname=nagiosxi --dbpass="n@gweb" --action=database_size --warning=500MB --critical=1GB --verbose --exclude=template1 --exclude=template0
POSTGRES_DATABASE_SIZE OK: DB "nagiosxi" (host:localhost) nagiosxi: 17457444 (17 MB) postgres: 5488932 (5360 kB) | time=0.01s nagiosxi=17457444;524288000;1073741824 postgres=5488932;524288000;1073741824
If I just want the nagiosxi database the include command works for me
Code: Select all
# /usr/local/nagios/libexec/check_postgres.pl -H localhost --port=5432 --dbuser=nagiosxi --dbname=nagiosxi --dbpass="n@gweb" --action=database_size --warning=500MB --critical=1GB --verbose --include=nagiosxi
POSTGRES_DATABASE_SIZE OK: DB "nagiosxi" (host:localhost) nagiosxi: 17457444 (17 MB) | time=0.01s nagiosxi=17457444;524288000;1073741824
I am going to attach 2.21.0 here if you would like to try to downgrade to this version
check_postgres.zip
unzip and place in
/usr/local/nagios/libexec
Re: Postgres Database Size ERROR
Posted: Tue Mar 06, 2018 7:20 am
by coco163
Thank you but same error.
Re: Postgres Database Size ERROR
Posted: Tue Mar 06, 2018 3:19 pm
by scottwilkerson
This is strange, I've never seen this, nor could I find a single person that has ever experienced it
You clearly have one that works and one that doesn't, can you distinguish any difference between the configuration and access allowed between the 2 servers?