Check_Postgres plugin- Critical State

This forum was archived to /woltlab and is now in read-only mode.
  • I am trying to pull the Postgresql monitoring data by making use of check_postgres.pl plugin. But the status is always showing critical on the Icinga 2 web even if there are no thresh holds applied on the service. Below are my configuration files


    Commands.conf

    -----------------------------------------

    Code
    1. object CheckCommand "check_postgres" {
    2.         import "plugin-check-command"
    3.         command = [ PluginContribDir + "/check_postgres.pl" ]
    4.         arguments = {
    5.                 "-H" =  "$postgres_host$"
    6.                 //"-w" =  "$postgres_warning$"
    7.                 //"-c" =  "$postgres_critical$"
    8.                 "--action" = "$postgres_action$"
    9.                 }
    10. }


    Services.conf

    -----------------------------------------

    Code
    1. apply Service "check_postgres_locks" {
    2.         import "generic-service"
    3.         check_command = "check_postgres"
    4.         vars.postgres_host = "hostname" //ExternalHost
    5.         vars.action="locks"
    6.         //vars.postgres_warning = 2
    7.         //vars.postgres_critical = 3
    8.         assign where host.name == NodeName
    9. }

    After restarting the Icinga 2 service I am always seeing the status as critical in Icinga Web. Please help if there was a mistake in defining services




  • You've commented out the command arguments and service attributes. Is that by intention?


    Question aside - why don't you use the contributed plugin check command definition from the ITL for postgres?

    https://www.icinga.com/docs/ic…emplate-library/#postgres

  • dnsmichi : Yes I have commented the critical and warning for testing purpose. I have read the ITL earlier but confused on how to get started and I did not find the example on how to get started

  • https://www.icinga.com/docs/ic…emplate-library/#postgres mentions that you need to pass arguments as custom attributes.


    https://www.icinga.com/docs/ic…ommand-passing-parameters


    Looking into the specific thresholds for the "locks" action: https://bucardo.org/check_post…ck_postgres.pl.html#locks


    Moving your example to the ITL way:


    Code
    1. apply Service "postgres-locks" {
    2. import "generic-service"
    3. check_command = "postgres"
    4. vars.postgres_host = "hostname" //ExternalHost
    5. vars.postgres_action = "locks"
    6. vars.postgres_warning = 2
    7. vars.postgres_critical = 3
    8. assign where host.name == NodeName
    9. }
  • dnsmichi : Thanks a lo again. It is working. Not sure where I have made mistake earlier probably I need to include the critical and warning attributes also but when tested the plugin separately with out passing these arguments it was working fine and ITL is simple to use :)