GithubHelp home page GithubHelp logo

auditmysqlhtml's Introduction

auditMysqlHTML

Script to generate a MySQL/MariaDB audit report of performances in HTML

Freely inspired from internet shares (finally Google can be your friend, reasonably used) and especially this scripts :

I would like to thank their authors for that.


This script has been evolving since I checked MySQL databases. I started to code it in the same manner as the Oracle one (https://github.com/fsoyer/auditOracleHTML). It is/will be probably not/never finished.

All ideas, contributions, propositions, fixes, updates, are welcome.

It is provided as is, use it at your own risks - but I use it since years on production databases without issues.

For a wider understanding, I'll translate parts in french to english step by step.


USAGE

Le script crée une table d'historique d'audit ("histaudit") et une ou plusieurs procédures ou fonctions. Deux solutions de connexion :

  1. en root. Rien à faire dans ce cas.
  2. avec un utilisateur "audit" :

CAS 1 : Le plus simple est de créer une base dédiée "audit" et de lui donner tous les droits dessus (en plus des droits de lectures sur les autres bases)

create database audit;
grant all privileges on audit.* to audit@'%';
grant select on *.* to audit@'%';

CAS 2 : Droits minimums

  • Si InnoDB n'est pas utilisé (statistiques inutiles) :

"audit" doit être autorisé en lecture sur les bases du serveur

grant select on *.* to audit@'%' identified by 'PASSWORD';

TODO: voir les grants spécifiques nécessaires si on doit créer des procédures ou fonctions. ALTER ? CREATE ? EXECUTE ?

grant all privileges on <audit_database>.histaudit to audit@'%' identified by 'PASSWORD';
  • Si InnoDB est utilisé et doit être audité, utiliser soit "root", soit un user qui doit avoir les droits d'administrateur
grant SUPER on *.* to audit@'%';
grant select on *.* to audit@'%'; -- parfois nécessaire après "grant super"
  1. Lancer:
mysql -h [HOST] -u[USER] -p[PWD] --skip-column-names [base_table_histaudit|mysql] < audit_mysql_html.sql > fichier.html"

NOTE : la syntaxe "< audit_mysql_html.sql" permet de quitter le script à la première erreur, alors que "-e source audit_mysql_html.sql" execute tout le script quoiqu'il arrive. Ici, la première requête étant un "create..if not exists", on est sûr de ne continuer le script que si une base (celle qui doit contenir la table histaudit) a été sélectionnée sur la ligne de commande.


Changelog

  • 10/2013 v0.1 : Creation du script, reprise et automatisation des requêtes d'audit utilisees manuellement.
  • 08/2015 v1.0 : fin phase 1 : affichage HTML des infos et ratios de base, sans InnoDB.
  • 01/2016 v1.1 : ajout stats de base InnoDB (nécessite accès root ou "ALL PRIVILEGES")
  • 09/2016 v1.2 : création table histaudit et insertion param, tailles données, taille mémoire.
  • 02/2017 v1.3 : ajout stat nombre de jointures sans indexes, ajout stats table locks
  • 01/2017 : affichage version en ORANGE si version modifiée depuis dernier audit
  • 01-12/2017 : ajout différence taille mémoire utilisée
  • 04/2018 v1.4 : ajout des différences de tailles de données depuis dernier audit
  • 10/2019 v2.0 : script now compatible with MySQL < 5.7.6 (and MariaDB) and > 8
  • 01/2020 v2.1 : some adjustements to validate script v2 with MariaDB and add ORANGE alert if INNODB_BUFFER_POOL_INSTANCES has changed
  • 01/2020 v2.2 : add users and grants informations
  • 08/2021 v2.3 : some fixes, and put INFORMATION_SCHEMA and PERFORMANCE_SCHEMA in lowercase

auditmysqlhtml's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.