Server Monitoring2 min read

    How to Monitor MariaDB Database

    Share

    Overview

    MariaDB is a popular open-source relational database and a community-driven fork of MySQL. Xitoring's MariaDB integration monitors query performance, connection states, replication health, and resource usage — helping you keep your databases running at peak performance.

    Since MariaDB is wire-compatible with MySQL, the integration follows a similar setup process using performance_schema and a dedicated monitoring user.

    What Can It Monitor?

    • CPU Usage — Database server CPU utilization
    • Memory Usage — RAM consumed by MariaDB processes
    • Connections — Active and total connection counts
    • Queries per Second — Rate of SELECT, INSERT, UPDATE, DELETE operations
    • Slow Queries — Queries exceeding the slow query threshold
    • Replication Lag — Seconds behind primary in replica setups
    • InnoDB Buffer Pool — Hit ratio and usage statistics
    • Table Locks — Lock wait times and deadlock detection
    • Uptime — How long the MariaDB server has been running

    Prerequisites

    1. Enable Performance Schema

    Add the following to your MariaDB configuration under the [mysqld] block:

    [mysqld]
    performance_schema=ON
    

    Restart MariaDB:

    sudo systemctl restart mariadb
    

    Verify it is enabled:

    SHOW VARIABLES LIKE 'performance_schema';
    

    2. Create a Monitoring User

    Create a dedicated user for Xitogent (do not use root):

    CREATE USER 'xitoring'@'%' IDENTIFIED BY '{your_password}';
    

    3. Grant Required Privileges

    GRANT REPLICATION CLIENT ON *.* TO 'xitoring'@'%';
    GRANT PROCESS ON *.* TO 'xitoring'@'%';
    GRANT SELECT ON performance_schema.* TO 'xitoring'@'%';
    

    Verify the user can connect:

    mysql -u xitoring --password={your_password} -e "show status" | \
    grep Uptime && echo "MariaDB user - OK" || echo "Cannot connect to MariaDB"
    

    How to Activate the Integration

    Run the Xitogent CLI:

    xitogent integrate
    

    Select MySQL/MariaDB from the list. When prompted, provide:

    • Host (typically 127.0.0.1)
    • Port (default: 3306)
    • Username and password for the monitoring user

    The config file is created at /etc/xitogent/integrations/mysql_integration.conf.

    Setting Up Triggers

    Available trigger parameters:

    • CPU Usage / Memory Usage
    • Connections / Queries per Second
    • Slow Queries / Replication Lag
    • InnoDB Buffer Pool metrics
    • Table Locks / Uptime

    Navigate to Triggers on your server page, select the database integration, choose a metric, set your threshold, and configure notification channels.

    Tips

    • MariaDB uses the same integration path as MySQL in Xitogent
    • Always create a dedicated monitoring user with minimal privileges
    • Enable performance_schema for comprehensive metrics
    • Monitor Slow Queries to catch inefficient queries early
    • Use Replication Lag alerts in primary-replica setups
    • Works on both Linux and Windows servers