MariaDB Daily Check Scripts in PowerShell and SQL for Windows
This scripts are inspired from WiseSoft DBA Daily Checks Email Report.
-
CREATE DATABASE master
-
execute
event_history.sql
to make event history table. -
execute
proc_for_event_history
and make sure all event will be called in this procedure. -
Settings
In createreport.ps1
Set-Location "<path>"
The scripts root path.$ServerName = "<servername>"
MariaDB server name$ServerIP = "<serverip>"
MariaDB server IP$mysqlexe = "<mysqlexepath>"
Path to mysql.exe$FullBackupPath = "<fullbackuppath>"
Full backup path (If any)$rptuser = "<rptuser>"
Scripts runner username$rptpass = "<rptpass>"
Scripts runner password$NumDays = 3
Get 3 days checks$FreeDiskSpacePercentWarningThreshold = 15
Free disk space below 15% for warning$FreeDiskSpacePercentCriticalThreshold = 10
Free disk space below 10% for critical$MailFrom = "<mailfrom>"
Report sender$MailTo = "<rcptto>"
Report rcpts$MailServer = "<mailserverip>"
Mail server IP
In DatabaseFiles.sql
SET @CriticalThresholdPCT := 95;
More than 95% of Table size for data will be criticalSET @WarningThresholdPCT := 90;
More than 90% of Table size for data will be warning
In EventStatus.sql
SET @NumDays := 3;
Get 3 days checks
In FailEventStat.sql
SET @NumDays := 3;
Get 3 days checks
In Uptime.sql
SET @UptimeCritical := 1440;
Less then 1440 min for uptime will be criticalSET @UptimeWarning := 2880;
Less then 2880 min for uptime will be warning
powershell createreport.ps1