Page 1 of 2
Monitoring postgre - update /usr/bin/psql
Posted: Wed Sep 09, 2020 1:43 pm
by steph007
Hi,
I'm trying to use check_postgres.pl to monitor some prostgres databases, but it's look like the version used for /usr/bin/psql is too old for our databases. How can I upgrade /usr/bin/psql?
Note
With verbose option used with check_postgres.pl, I can see the version of psql:
psql=/usr/bin/psql version=8.4
Re: Monitoring postgre - update /usr/bin/psql
Posted: Thu Sep 10, 2020 3:44 pm
by benjaminsmith
Hi,
What operating system are you using? Have you tried updating using the package manager?
Also, what type of error message are you getting when running the plugin? Can you post the output to the thread?
Thanks, Benjamin
Re: Monitoring postgre - update /usr/bin/psql
Posted: Wed Sep 16, 2020 3:01 pm
by steph007
I'm on Nagios XI under CentOS 6.
I want use it to monitor some postgres database.
But when I use the version installed, I got an error for ssl connection.
We suspect that is because the version of the database is newer then the one installed on Nagios.
It seem that it's a entire postgres installed on Nagios. Is it used by Nagios? Why not just have deployed an client to connect/monitor postgres database?
Re: Monitoring postgre - update /usr/bin/psql
Posted: Thu Sep 17, 2020 4:12 pm
by lmiltchev
It seem that it's a entire postgres installed on Nagios. Is it used by Nagios?
The postgres db was used on older versions of Nagios XI and it would be still used if you upgraded from an old system.
Why not just have deployed an client to connect/monitor postgres database?
Are you trying to monitor postgres on the same machine (with Nagios XI on it) or on a remote box? Can you show us a actual check that you are using run from the command line along with the output of it?
Nagios XI has 3 postgres wizards. Have you tried using any of them?
example-01.jpg
Re: Monitoring postgre - update /usr/bin/psql
Posted: Thu Sep 17, 2020 6:40 pm
by steph007
Why which wizard is important?
The problem I have it's when I use check_postgres.pl to connect to my postgres database to monitor with ssl. When ssl is used, it's not working. When I don't used ssl, it's working. I think because /usr/bin/psql is ourdated compare to the database to monitor. Is it possible to update only /usr/bin/psql or we need to update all postgres on my Nagios XI?
Re: Monitoring postgre - update /usr/bin/psql
Posted: Fri Sep 18, 2020 9:29 am
by lmiltchev
Why which wizard is important?
I wouldn't say the wizards are "important" or "more important" than plugins, but they are easy to use, and are included in XI by default. Most users find them very useful.
The problem I have it's when I use check_postgres.pl to connect to my postgres database to monitor with ssl. When ssl is used, it's not working. When I don't used ssl, it's working.
Are you trying to monitor postgres on the same machine (with Nagios XI on it) or on a remote box? Can you show us both checks (working and not working), run from the command line along with the output of it?
I think because /usr/bin/psql is ourdated compare to the database to monitor. Is it possible to update only /usr/bin/psql or we need to update all postgres on my Nagios XI?
We support the packages that are included by the OS. If you decide to upgrade a package to something newer than the OS provides, this would be out of the scope of Nagios support.
Re: Monitoring postgre - update /usr/bin/psql
Posted: Tue Sep 22, 2020 2:53 pm
by steph007
I'm monitoring a remote postgres database.
This is a working trace, Without SSL:
---------------------------------------------
Code: Select all
root@plgesmon02[/root]# /usr/local/nagios/libexec/check_postgres.pl -H 10.211.209.164 --port=5439 --dbuser=nagios --dbname=postgres --dbpass="XXX" -v -v -v --action=connection
$POSTGRES1 = {
"verbose" => 3,
"test" => 0,
"transform" => "",
"dbpass" => [
"XXX"
],
"showperf" => 1,
"port" => [
5439
],
"defaultport" => 5432,
"dbname" => [
"postgres"
],
"host" => [
"10.211.209.164"
],
"defaultuser" => "postgres",
"dbuser" => [
"nagios"
],
"showtime" => 1,
"timeout" => 30,
"action" => "connection"
};
psql=/usr/bin/psql version=8.4
Starting run_command with: SELECT version() AS v
Created temporary pgpass file /tmp/YgKJCf3LDf/check_postgres.SgqNHDfJ.tmp
$POSTGRES1 = [
"-q",
"-t",
"-d",
"postgres",
"-U",
"nagios",
"-p",
5439,
"-h",
"10.211.209.164",
"-o",
"/tmp/YgKJCf3LDf/check_postgres_psql.JRfhIfl.tmp",
"-x",
"-c",
"BEGIN;SET statement_timeout=30000;COMMIT;SELECT version() AS v"
];
$POSTGRES1 = {
"hosts" => 1,
"db" => [
{
"dbpass" => "XXX",
"dbservice" => "",
"port" => 5439,
"dbname" => "postgres",
"host" => "10.211.209.164",
"ok" => 1,
"dbuser" => "nagios",
"totaltime" => "0.08",
"slurp" => [
{
"v" => "PostgreSQL 11.5 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36), 64-bit"
}
],
"pname" => "port=5439 host=10.211.209.164 db=postgres user=nagios"
}
],
"command" => "SELECT version() AS v"
};
POSTGRES_CONNECTION OK: DB "postgres" (host:10.211.209.164) (port=5439) version 4.8.5 | time=0.08s
This is a no working trace once SSL activated on the remote postgres
-------------------------------------------------------------------------------------
Code: Select all
root@plgesmon02[/root]# /usr/local/nagios/libexec/check_postgres.pl -H 10.211.209.164 --port=5439 --dbuser=nagios --dbname=postgres --dbpass="XXX" -v -v -v --action=connection
$POSTGRES1 = {
"verbose" => 3,
"test" => 0,
"transform" => "",
"dbpass" => [
"XXX"
],
"showperf" => 1,
"port" => [
5439
],
"defaultport" => 5432,
"dbname" => [
"postgres"
],
"host" => [
"10.211.209.164"
],
"defaultuser" => "postgres",
"dbuser" => [
"nagios"
],
"showtime" => 1,
"timeout" => 30,
"action" => "connection"
};
psql=/usr/bin/psql version=8.4
Starting run_command with: SELECT version() AS v
Created temporary pgpass file /tmp/AbdD4WKgRy/check_postgres.UaYeZcJT.tmp
$POSTGRES1 = [
"-q",
"-t",
"-d",
"postgres",
"-U",
"nagios",
"-p",
5439,
"-h",
"10.211.209.164",
"-o",
"/tmp/AbdD4WKgRy/check_postgres_psql.SiTT1tc.tmp",
"-x",
"-c",
"BEGIN;SET statement_timeout=30000;COMMIT;SELECT version() AS v"
];
System call failed with a 512
ERROR: authentication method 10 not supported
Re: Monitoring postgre - update /usr/bin/psql
Posted: Wed Sep 23, 2020 9:16 am
by lmiltchev
Thanks for the info @steph007! We will try to lab this in-house, and find a solution for you. In order to do this, we need a little bit more information.
1. What is the OS/architecture of the machine with the remote postgres database on it?
2. Describe in details how you configured SSL on the remote postgres
Thank you!
Re: Monitoring postgre - update /usr/bin/psql
Posted: Wed Sep 23, 2020 10:09 am
by steph007
Hi,
The remote machie is a Linux RedHat with postgres version 12.
The problem is if we enable MD5 encryption of the pw on the database side. Once it's done, with psql version 8, it cannot handle it correctly. If we remove the MD5 encryption of the pw on the database side, it's work well.
To fix the problem, I have installed postgresql11 from postgres repository. See below.
root@plgesmon02[/root]# yum list installed | grep postgres
postgresql.x86_64 8.4.20-8.el6_9 @updates
postgresql-libs.x86_64 8.4.20-8.el6_9 @updates
postgresql-server.x86_64 8.4.20-8.el6_9 @updates
postgresql11.x86_64 11.9-1PGDG.rhel6 @pgdg11
postgresql11-libs.x86_64 11.9-1PGDG.rhel6 @pgdg11
This has been add to the actual postgres installed. Not a overwrite. So, it should be good.
and now I can connect to my postgres database with MD5 encrypted password!
Re: Monitoring postgre - update /usr/bin/psql
Posted: Wed Sep 23, 2020 10:32 am
by lmiltchev
Great! I am glad you've been able to resolve the issue! Thanks for sharing the solution on the forum! This may help other users facing the same problem. Let us know if it is safe to lock this thread now.