Hi, sorry for the delayed response on this.

My check looks like this:

object Service "mydb" {
  import "generic-service"
  host_name = "somehost.mycompany.com"
  check_command = "postgres"
  vars.postgres_host = "somehost.mycompany.com"
  vars.postgres_dbname = "catalog"
  vars.postgres_dbuser = "mon"
  vars.postgres_dbpass = "mon"
  vars.postgres_action = "connection"
}

This check generates the error "Peer authentication failed for user "mon"",
which after some digging is the result of the lack of a -H (host) parameter
to check_postgres.pl. Note that in
/usr/share/icinga2/include/plugins-contrib.d/databases.conf
the CheckCommand object includes "vars.postgres_unixsocket = false", and
the -H argument has "set_if = {{ macro("$postgres_unixsocket$") == false }}".
Since I haven't defined postgres_unixsocket to be true (or anything else)
the expectation is for the -H to be passed, but this doesn't happen.

I can't say whether my proposal to surround the "false" in quotes is the
right fix as I'm far from an icinga2 language expert... But there's
definitely some type mismatch going on: the result of the macro() function
seems to be a string regardless of its parameter.

Thanks for the link to the developer guidelines. I still can't find an
issue tracker though (which is where this conversation could take place),
maybe consider activating issues in github?

Thanks for all your help and for making an awesome monitoring system!

Shay

On Wed, Jul 1, 2015 at 6:36 PM, Michael Friedrich <
michael.friedr...@netways.de> wrote:

>  Am 30.06.2015 um 11:50 schrieb Shay Rojansky:
>
> Icinga2 comes with plugins-contrib.d/databases.conf which contains the
> "postgres" CheckCommand. There seems to be an issue with the following
> line:
>
>  set_if = {{ macro("$postgres_unixsocket$") == false }}
>
>  This seems to never evaluate to true; the -H argument never seems to be
> passed regardless of what value postgres_unixsocket is set to.
>
>
> How does your configuration look like?
>
>
>  I've done some tracking down, and it seems that
> macro("$postgres_unixsocket$") always returns a String although
> $postgres_unixsocket$ is a Boolean. Changing the set_if to the following
> fixes the issue:
>
>  set_if = {{ macro("$postgres_unixsocket$") == "false" }}
>  (note the quotes)
>
>  I'm not sure if this is the proper fix.
>
>
> Did not test it, but this really works for both cases?
>
>
>  On another note, is there any issue tracker for icinga2, the github has
> issues turned off. Do you accept PRs?
>
>
> https://wiki.icinga.org/display/Dev/Developer+Guidelines
>
> Kind regards,
> Michael
>
>
>
> --
> Michael Friedrich, DI (FH)
> Application Developer
>
> NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
> Tel: +49 911 92885-0 | Fax: +49 911 92885-77
> GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
> http://www.netways.de | michael.friedr...@netways.de
>
> ** OSBConf 2015 - September - osbconf.org **
> ** OSMC 2015 - November - netways.de/osmc **
>
> _______________________________________________
> icinga-users mailing list
> icinga-users@lists.icinga.org
> https://lists.icinga.org/mailman/listinfo/icinga-users
>
>
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to