MySQL replication status checker daemon in docker image with Slack notification.

Overview

MySQL replication checker - Docker

MySQL replication status checker daemon in docker image with Slack notification.

Envs

Name Description
MYSQL_HOST MySQL host address (required)
MYSQL_PORT MySQL host port
MYSQL_USER MySQL user (required)
MYSQL_PASSWORD MySQL password (required)
MYSQL_DATABASE MySQL database name (required)
SLACK_URL Slack webhook message url (required)
SUCCESS_MIN_ELAPSED_TIME Min elapsed time before renotify success message (0 means disabled)
ERROR_MIN_ELAPSED_TIME Min elapsed time before renotify error message (0 means disabled)
APP_NAME App name for slack message (default MySQL)
CHECKING_SLEEP Time (sec) between two check (default 60)

Usage

  1. Build
docker build -t mysqlchecker .
  1. Run docker image
docker run -e MYSQL_HOST=127.0.0.1 -e MYSQL_USER=root -e MYSQL_PASSWORD=secret -e MYSQL_DATABASE=yourdb -e SLACK_URL=https://hooks.slack.com/services/XXXXXXX/XXXXXXX/XXXXXXX -e ERROR_MIN_ELAPSED_TIME=1800 mysqlchecker

Notification working

Sends a Slack message if:

  • First check
  • State changed (success -> error, error -> success)
  • Renotify enabled with SUCCESS_MIN_ELAPSED_TIME or ERROR_MIN_ELAPSED_TIME envs.
You might also like...
Laravel Code Generator based on MySQL Database

Laravel Code Generator Do you have a well structed database and you want to make a Laravel Application on top of it. By using this tools you can gener

A Symfony application for managing and automating regular backups of MySQL databases.
A Symfony application for managing and automating regular backups of MySQL databases.

DbSaver DbSaver is an application written by Bastien LOUGHIN allowing you to make automatic daily backups (and manual backups) for your MySQL database

TO DO LIST WITH LOGIN AND SIGN UP and LOGOUT using PHP and MySQL please do edit the _dbconnect.php before viewing the website.

TO-DO-LIST-WITH-LOGIN-AND-SIGN-UP TO DO LIST WITH LOGIN AND SIGN UP and LOGOUT using PHP and MySQL please do edit the _dbconnect.php before viewing th

Connect and work with MySQL/MariaDB database through MySQLi in PHP. This is an introductory project, If you need a simple and straightforward example that takes you straight to the point, you can check out these examples.
Connect and work with MySQL/MariaDB database through MySQLi in PHP. This is an introductory project, If you need a simple and straightforward example that takes you straight to the point, you can check out these examples.

First MySQLi PHP Connect and work with MySQL/MariaDB database through MySQLi in PHP. The above exercises are designed for students. This is an introdu

Very easy to use PDO MYSQL API. Just Include in PHP file and get it working.

CRUD-MYSQL-API Very easy to use PDO MYSQL API. Just Include in PHP file and get it working. INSTALATION Step 1: git clone https://github.com/arhex-lab

Staggered import of large and very large MySQL Dumps even through the web servers with hard runtime limit and those in safe mode.

Staggered import of large and very large MySQL Dumps (like phpMyAdmin dumps) even through the web servers with hard runtime limit and those in safe mode. | Persian Translation Version

Small script for importing the KvK (Dutch Chamber of Commerce) Open Data Set (CSV file) to a MySQL database.
Small script for importing the KvK (Dutch Chamber of Commerce) Open Data Set (CSV file) to a MySQL database.

KvK-CSV-2-SQL Small script for importing the KvK (Dutch Chamber of Commerce) Open Data Set (CSV file) to a MySQL database. Table of content KvK-CSV-2-

A Php Library For MySQL

phpSQL MySql İçin Bir Php Kütüphanesi Herhangi Bir Sorun Olursa Buradan Ulaşabilirsiniz Ayrıca Dosyada Php Documentor Kullanılmaktadır, Modern Editörl

A minimalistic PHP/MySQL anonymous bulletin-board thingy
A minimalistic PHP/MySQL anonymous bulletin-board thingy

minibord A minimalistic PHP/MySQL anonymous bulletin-board thingy mostly worked on at night It's a very basic, unthemed, table-based layout, but it wo

Comments
  • "Connection refused" not handled properly

    MySQL server is inaccessible during daemon running. I expect slack error message to be sent, but the php crashes, the container restarts. At this point only the green startup slack message appears, which is misleading.

    xyz MySQL replication working.
    
    Fatal error: Uncaught PDOException: SQLSTATE[HY000] [2002] Connection refused in /app/index.php:58
    Stack trace:
    #0 /app/index.php(58): PDO->__construct('mysql:host=10.1...', 'yyyy', 'xxxx', Array)
    #1 {main}
      thrown in /app/index.php on line 58
    
    opened by DBLaci 0
  • Implement mail notification

    Implement mail notification

    Slack notification is nice but the solution would be more generic if mail alert would be implemented too.

    Please implement smtp settings for this

    MAIL_MAILER=smtp
    MAIL_HOST=mail.xyz.com
    MAIL_PORT=465
    MAIL_ENCRYPTION=ssl
    [email protected]
    MAIL_PASSWORD=1234abcd
                                                                                                                                                                               
    [email protected]
    [email protected]
    

    use phpmailer for this

    opened by DBLaci 0
Owner
Aventail Ltd.
Aventail Ltd.
Independent query builders for MySQL, PostgreSQL, SQLite, and Microsoft SQL Server.

Aura.SqlQuery Provides query builders for MySQL, Postgres, SQLite, and Microsoft SQL Server. These builders are independent of any particular database

Aura for PHP 424 Dec 12, 2022
A web interface for MySQL and MariaDB

phpMyAdmin A web interface for MySQL and MariaDB. https://www.phpmyadmin.net/ Code status Download You can get the newest release at https://www.phpmy

phpMyAdmin 6.4k Jan 5, 2023
A validating SQL lexer and parser with a focus on MySQL dialect.

SQL Parser A validating SQL lexer and parser with a focus on MySQL dialect. Code status Installation Please use Composer to install: composer require

phpMyAdmin 368 Dec 27, 2022
PHP version of mysqldump cli that comes with MySQL

MySQLDump - PHP Requirements | Installing | Getting started | API | Settings | PDO Settings | TODO | License | Credits This is a php version of mysqld

diego torres 1.1k Jan 8, 2023
MySQL Spatial Data Extension integration with Laravel.

Laravel MySQL Spatial extension Laravel package to easily work with MySQL Spatial Data Types and MySQL Spatial Functions. Please check the documentati

Joseph Estefane 741 Jan 9, 2023
MySQL Load Data Infile Support For Laravel

Laravel Load File ?? A package to help with loading files into MySQL tables. This uses MySQL's LOAD DATA statement to load text files quickly into you

Ellis Green 64 Dec 30, 2022
A simple PHP and MySQL based internet forum that displays the messages in classical threaded view (tree structure)

my little forum my little forum is a simple PHP and MySQL based internet forum that displays the messages in classical threaded view (tree structure).

Mark Hoschek 97 Dec 29, 2022
phpMyFAQ - Open Source FAQ web application for PHP and MySQL, PostgreSQL and other databases

phpMyFAQ 3.1 What is phpMyFAQ? phpMyFAQ is a multilingual, completely database-driven FAQ-system. It supports various databases to store all data, PHP

Thorsten Rinne 547 Dec 27, 2022
A simple and extensible fixture loader for PHP 7.3+, supporting SQLite and MySQL

Flowder Flowder is a (really) simple fixture loader for PHP 7.3+, supporting SQLite and MySQL. Using Flowder in PHP 7.2 or below? Try version 1 instea

Joe Haines 6 Jan 17, 2021
A mysql database backup package for laravel

Laravel Database Backup Package This package will take backup your mysql database automatically via cron job. Installing laravel-backup The recommende

Mahedi Hasan Durjoy 20 Jun 23, 2021