From 191b16c21b1a3dd526b1cd367cd2d5568f0dbd51 Mon Sep 17 00:00:00 2001 From: Jean-Marie Renouard Date: Sat, 12 Feb 2022 23:33:59 +0100 Subject: [PATCH] Adding a Jinja2 Template --- mysqltuner.pl | 7 ++- templates/basic.html.j2 | 110 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 templates/basic.html.j2 diff --git a/mysqltuner.pl b/mysqltuner.pl index 999332f..44e9ea0 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -256,6 +256,7 @@ my @dblist; # Super structure containing all information my %result; $result{'MySQLTuner'}{'version'} = $tunerversion; +$result{'MySQLTuner'}{'datetime'} =`date '+%d-%m-%Y %H:%M:%S'`; $result{'MySQLTuner'}{'options'} = \%opt; # Functions that handle the print styles @@ -6639,7 +6640,7 @@ sub mysql_triggers() { # Take the two recommendation arrays and display them at the end of the output sub make_recommendations { $result{'Recommendations'} = \@generalrec; - $result{'Adjust variables'} = \@adjvars; + $result{'AdjustVariables'} = \@adjvars; subheaderprint "Recommendations"; if ( @generalrec > 0 ) { prettyprint "General recommendations:"; @@ -6665,7 +6666,9 @@ sub close_outputfile { sub headerprint { prettyprint - " >> MySQLTuner $tunerversion - Major Hayden \n" + " >> MySQLTuner $tunerversion\n" + . "\t * Jean-Marie Renouard \n". + . "\t * Major Hayden \n" . " >> Bug reports, feature requests, and downloads at http://mysqltuner.pl/\n" . " >> Run with '--help' for additional options and output filtering"; } diff --git a/templates/basic.html.j2 b/templates/basic.html.j2 new file mode 100644 index 0000000..830abab --- /dev/null +++ b/templates/basic.html.j2 @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + MySQL Tuner {{ MySQLTuner.version }} - {{ MySQLTuner.datetime | default(' ??? ') }} + + + +

MySQL Tuner {{ MySQLTuner.version }} - {{ MySQLTuner.datetime | default(' ??? ') }}

+ +
+ +
+
+

Recommendations

+ + + + + + + + {% for result in Recommendations %} + + + + {% endfor %} + +
#Recommandations
{{ loop.index }} {{ result }}
+
+ +
+

System variables

+ + + + + + + + + {% for vari in Variables %} + + + + + {% endfor %} + +
#VariableValue
{{ loop.index }} {{ vari }} {{ Variables[vari] }}
+
+
+

Status Variables

+ + + + + + + + + {% for vari in Status %} + + + + + {% endfor %} + +
#Variable de statusValue
{{ loop.index }} {{ vari }} {{ Status[vari] }}
+
+
+

Calculated variables

+ + + + + + + + + {% for vari in Calculations %} + + + + + {% endfor %} + +
#Calculated variablesValue
{{ loop.index }} {{ vari }} {{ Calculations[vari] }}
+
+
+
+ + + + + \ No newline at end of file