check_postgres
check_postgres copied to clipboard
txn_time/idle flap from OK to UNKNOWN
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.
seeing the same thing
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,
A pull request was sent but is still waiting.
+1 for the patch, having the same issue with queries agaist a table with contains a disabled column.
@bucardo any chance to get this fixed soon?
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: Are you seeing this also with the git version? If I remember correctly we changed a few bits here since the last tarball release.
@ChristophBerg I did not tried with git version. I will check and update you . Thank you Chris
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