From: Darold Gilles Date: Thu, 5 Jul 2012 14:50:42 +0000 (+0200) Subject: Add -a|--average option to configure the per minutes average interval for queries... X-Git-Tag: v3.2~197 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a0263bd3c01aa7ca328302ceed29da7552bc9a21;p=pgbadger Add -a|--average option to configure the per minutes average interval for queries and connexions. If you want the average to be calculated each minutes, use --average 1 or like the default --average 5 --- diff --git a/README b/README index cb15cf1..910f3f8 100644 --- a/README +++ b/README @@ -41,6 +41,8 @@ SYNOPSIS -w | -watch-mode : only report errors just like logwatch could do. -z | --zcat exec_path : set the full path to the zcat program. Use it if zcat is not on your path or you want to use gzcat. + -a | --average minutes : number of minutes to build the average graphs of + queries and connections. --pie-limit num : pie data lower than num% will show a sum instead. --exclude-query regex : any query matching the given regex will be excluded from the report- for example: "^(VACUUM|COMMIT)". diff --git a/doc/pgBadger.pod b/doc/pgBadger.pod index 752ec23..9a619ce 100644 --- a/doc/pgBadger.pod +++ b/doc/pgBadger.pod @@ -44,6 +44,8 @@ Options: -w | -watch-mode : only report errors just like logwatch could do. -z | --zcat exec_path : set the full path to the zcat program. Use it if zcat is not on your path or you want to use gzcat. + -a | --average minutes : number of minutes to build the average graphs of + queries and connections. --pie-limit num : pie data lower than num% will show a sum instead. --exclude-query regex : any query matching the given regex will be excluded from the report- for example: "^(VACUUM|COMMIT)". diff --git a/pgbadger b/pgbadger index 5cb8dac..d81221b 100755 --- a/pgbadger +++ b/pgbadger @@ -116,6 +116,7 @@ my $result = GetOptions ( "regex-user=s" => \$regex_prefix_dbuser, "q|quiet!" => \$quiet, "p|progress!" => \$progress, + "a|average=i" => \$avg_minutes, "pie-limit=i" => \$pie_percentage_limit, "image-format=s"=> \$img_format, "w|watch-mode!" => \$error_only, @@ -164,6 +165,11 @@ if ($#log_files < 0) { # Quiet mode is forced with progress bar $quiet = 1 if ($progress); +# Set the default number minutes for queries and connections average +$avg_minutes ||= 5; +$avg_minutes = 60 if ($avg_minutes > 60); +$avg_minutes = 1 if ($avg_minutes < 1); + # Set default format $format ||= &autodetect_format($log_files[0]); # Set default top query @@ -550,6 +556,8 @@ Options: -w | -watch-mode : only report errors just like logwatch could do. -z | --zcat exec_path : set the full path to the zcat program. Use it if zcat is not on your path or you want to use gzcat. + -a | --average minutes : number of minutes to build the average graphs of + queries and connections. --pie-limit num : pie data lower than num% will show a sum instead. --exclude-query regex : any query matching the given regex will be excluded from the report. For example: "^(VACUUM|COMMIT)"