check_postgres icon indicating copy to clipboard operation
check_postgres copied to clipboard

txn_time/idle flap from OK to UNKNOWN

Open martinmarques opened this issue 10 years ago • 9 comments

I have been dealing with a problem in a new installation I was doing today. The problem came up as I saw in Icinga that txn_time and txn_idle were flapping and for no reason I could think of.

Checking the code, I found that the problem came here:

    ## Return unknown if stats_command_string / track_activities is off
    if ($cq =~ /disabled/o or $cq =~ /<command string not enabled>/) {
        add_unknown msg('psa-disabled');
        return;
    }

What would happen if the query had in some part the word 'disabled'? For example a column of a table which has been selected.

I think this is not the best way to check if a postgres setting is set accordinly.

Removing the offending code (as I'm sure the postgres setting has track_activities on) made everything work as expected.

martinmarques avatar Sep 02 '14 21:09 martinmarques

seeing the same thing

petere avatar Sep 12 '14 16:09 petere

So, no further comment? I'm starting to see flapping on another monitored system to which I don't have access to check, but I wouldn't be surprised that it related.

If you want to keep the if, at least use something like:

if ($cq =~ /^disabled$/o or $cq =~ /^<command string not enabled>$/) {

This is untested. Just a thought.

I directly removed the offending code.

Cheers,

martinmarques avatar Sep 23 '14 21:09 martinmarques

A pull request was sent but is still waiting.

martinmarques avatar Mar 03 '15 16:03 martinmarques

+1 for the patch, having the same issue with queries agaist a table with contains a disabled column.

sts avatar Jul 30 '15 07:07 sts

@bucardo any chance to get this fixed soon?

sts avatar Aug 05 '15 10:08 sts

I am getting ERROR very frequently please could any one tell me how I can over come from this issue? Some times we are getting expected output and some time UNKNOWN state.

Notification Type: PROBLEM

Service: postgres - txn_idle
Host: XXXXXX
State: UNKNOWN

Additional Info:POSTGRES_TXN_IDLE UNKNOWN: DB XX (host:xxxx) No queries - is stats_command_string or track_activities off?

ERROR is getting from below code(took from check_postgres.pl) but I am unable to find way to over come from it

Return unknown if stats_command_string / track_activities is off

    if ($cq =~ /disabled/o or $cq =~ /<command string not enabled>/) {
        add_unknown msg('psa-disabled');
        return;
    }

RajeshMadiwale avatar Sep 27 '16 07:09 RajeshMadiwale

@RajeshMadiwale: Are you seeing this also with the git version? If I remember correctly we changed a few bits here since the last tarball release.

df7cb avatar Sep 27 '16 08:09 df7cb

@ChristophBerg I did not tried with git version. I will check and update you . Thank you Chris

RajeshMadiwale avatar Sep 27 '16 08:09 RajeshMadiwale

I have tested with git version and yes I am able to get the correct output. previously there was issue if table have column name with "disabled" then check_postgres.pl use to give state UNKNOWN. Thank you Chris

RajeshMadiwale avatar Sep 27 '16 08:09 RajeshMadiwale