From: Darold Gilles Date: Wed, 11 Jul 2012 21:43:06 +0000 (+0200) Subject: Add hourly report of checkpoint warning when checkpoints are occuring too frequently... X-Git-Tag: v3.2~187 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c4b5b4aa6c72075934ef0a7d3a7c95dd8a431865;p=pgbadger Add hourly report of checkpoint warning when checkpoints are occuring too frequently, it will display the hourly count and the average occuring time --- diff --git a/pgbadger b/pgbadger index 8b71876..0a97985 100755 --- a/pgbadger +++ b/pgbadger @@ -538,7 +538,7 @@ foreach $logfile (@log_files) { my $t1 = Benchmark->new; my $td = timediff($t1, $t0); -&logmsg('DEBUG', "Ok, generating $format report...") if ($debug); +&logmsg('DEBUG', "Ok, generating $extension report...") if ($debug); # Open filehandle my $fh = new IO::File ">$outfile"; @@ -1756,6 +1756,9 @@ sub dump_as_html if (exists $checkpoint_info{chronos}) { print $fh qq{Checkpoints}; } + if (exists $checkpoint_info{warning}) { + print $fh qq{Checkpoint warning}; + } if ($tempfile_info{count} || exists $checkpoint_info{chronos}) { print $fh qq{}; } @@ -1765,6 +1768,9 @@ sub dump_as_html if (exists $checkpoint_info{chronos}) { print $fh qq{Wrote buffersAddedRemovedRecycledWrite time (sec)Sync time (sec)Total time (sec)}; } + if (exists $checkpoint_info{warning}) { + print $fh qq{CountAv. time (sec)}; + } if ($tempfile_info{count} || exists $checkpoint_info{chronos}) { print $fh qq{}; foreach my $d (sort {$a <=> $b} keys %per_hour_info) { @@ -1785,8 +1791,14 @@ sub dump_as_html if (exists $checkpoint_info{chronos}) { if (exists $checkpoint_info{chronos}{$d}{$h}) { print $fh "", &comma_numbers($checkpoint_info{chronos}{$d}{$h}{wbuffer}) || 0, "", &comma_numbers($checkpoint_info{chronos}{$d}{$h}{file_added}) || 0, "", &comma_numbers($checkpoint_info{chronos}{$d}{$h}{file_removed}) || 0, "", &comma_numbers($checkpoint_info{chronos}{$d}{$h}{file_recycled}) || 0, "", &comma_numbers($checkpoint_info{chronos}{$d}{$h}{write}) || 0, "", &comma_numbers($checkpoint_info{chronos}{$d}{$h}{sync}) || 0, "", &comma_numbers($checkpoint_info{chronos}{$d}{$h}{total}) || 0, ""; + if ($checkpoint_info{warning}) { + print $fh "", &comma_numbers($checkpoint_info{chronos}{$d}{$h}{warning}) || 0, "", &comma_numbers(sprintf("%.2f", ($checkpoint_info{chronos}{$d}{$h}{warning_seconds}||0)/($checkpoint_info{chronos}{$d}{$h}{warning}||1))) || 0, ""; + } } else { print $fh "0000000"; + if ($checkpoint_info{warning}) { + print $fh "00"; + } } } print $fh "\n"; @@ -2550,8 +2562,6 @@ sub parse_query } return; } - # Reclassifying the checkpoint LOG information into WARNING to be reported into error/warning sections - $t_loglevel = 'WARNING' if ($t_query =~ /checkpoints are occurring too frequently/); # Do not parse lines that are not an error like message if ($error_only && ($t_loglevel !~ /(WARNING|ERROR|FATAL|PANIC|DETAIL|HINT|STATEMENT|CONTEXT)/) ) { if (exists $cur_info{$t_pid} && ($t_session != $cur_info{$t_pid}{session})) { @@ -2711,6 +2721,14 @@ sub parse_query $checkpoint_info{chronos}{"$t_year$t_month$t_day"}{"$t_hour"}{total} += $8; return; } + if (($t_loglevel eq 'LOG') && ($t_query =~ /checkpoints are occurring too frequently \((\d+) seconds apart\)/)) { + return if ($disable_checkpoint); + $checkpoint_info{warning}++; + $checkpoint_info{warning_seconds} += $1; + $checkpoint_info{chronos}{"$t_year$t_month$t_day"}{"$t_hour"}{warning}++; + $checkpoint_info{chronos}{"$t_year$t_month$t_day"}{"$t_hour"}{warning_seconds} += $1; + return; + } # Store the detail of the error if ($cur_info{$t_pid}{loglevel} =~ /WARNING|ERROR|FATAL|PANIC/) {