check postgres - parsing password

Thomas Guyot-Sionnest dermoth at aei.ca
Tue Feb 10 07:07:25 CET 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/02/09 12:37 AM, Chris wrote:
> I am using the check_pgsql plugin to check my postgres database on a
> remote server. My postgres password has special characters "$" and
> "#". It works fine from the command line when I parse my password
> using the "\" escape sequence. But I tried from Nagios configuration
> file and it says "Password authentication failed." commands.cfg has
> 
> define command{
>         command_name check_postgres
>         command_line $USER1$/check_pgsql -H $HOSTADDRESS$ -l $ARG1$ -p
> $ARG2$ -d $ARG3$
> }
> 
> unix.cfg
> 
> define service{
>         use                             generic-service
>         host_name                       server1
>         service_description             Postgres Database Engine
>         check_command
> check_postgres!nagios!pa$$w#rd!database_name
>         }
> 
> In commands.cfg I have tried putting the password directly with escape
> sequence and double quotes, with no luck.

You most likely want to use single quotes around your password as "$"
will be interpretted by the shell. AFAIK $$ in command definition/args
should work.

Putting that together (with the command_line above):
check_command  check_postgres!nagios!'pa$$w#rd'!database_name


Want to know what end up on the command line? add "echo" in front of the
command before $USER1$ (you will not see single and double quotes, but
you'll see if characters are being interpreted). If you need more
details a simple perl script can print arguments one by one.

Finally, if you're out of ideas, get the Git (or SVN) head and enable
extra-opts in configure, then you can define the password in an ini file.

- --
Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJkRmd6dZ+Kt5BchYRAr9jAJ9vvRbWqBA7OhMGDFQVoU1L8tcL7QCgiEBz
T4d527nhA1k1grHQqglr5L8=
=IT8i
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list