MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

icinga tutorials: How to monitor Mysql server using icinga agent

To monitor MySQL on an Ubuntu server where an Icinga agent is installed, you’ll need to configure both the agent and the Icinga server to handle the monitoring tasks. Here’s a detailed step-by-step guide:

Step 1: Install MySQL Monitoring Plugins

On the Icinga Agent Server: Install the nagios-plugins package, which includes the check for MySQL. Execute:

sudo apt-get update
sudo apt-get install monitoring-plugins
Code language: JavaScript (javascript)

Install mySql Server

Step 2: Configure MySQL for Monitoring

Create a MySQL User for Monitoring:
Log into your MySQL server:

mysql -u root -p

Create a user specifically for monitoring purposes:

CREATE USER 'icinga'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT PROCESS, REPLICATION CLIENT ON *.* TO 'icinga'@'localhost';
FLUSH PRIVILEGES;
EXIT;Code language: PHP (php)

Step 3: Configure Icinga Agent

Add MySQL Check Command to Icinga Agent:
Edit or create a new command configuration file:

sudo nano /etc/icinga2/conf.d/commands.conf

Add the MySQL check command:

object CheckCommand "check_mysql" {
    import "plugin-check-command"
    command = [ PluginDir + "/check_mysql" ]

    arguments = {
        "-H" = {
            value = "$mysql_address$"
            description = "IP address or hostname of the MySQL server"
        }
        "-u" = {
            value = "$mysql_user$"
            description = "Username for MySQL login"
        }
        "-p" = {
            value = "$mysql_password$"
            description = "Password for MySQL login"
        }
    }
}Code language: JavaScript (javascript)

Step 4: Configure Icinga Server

Define Host Object:

Define or ensure that the host object for your MySQL server exists in your Icinga configuration:

object Host "mysql-server" {
    import "generic-host"
    address = "mysql-agent-ip"  // Replace with the actual IP address of your MySQL server
    check_command = "hostalive"
}

Define Service for MySQL Monitoring:

Create a service definition to check MySQL:

apply Service "mysql-service" {
    import "generic-service"
    check_command = "check_mysql"
    vars.mysql_address = "localhost"
    vars.mysql_user = "icinga"
    vars.mysql_password = "yourpassword"
    assign where host.name == "mysql-server"
}
Reload Icinga 2:

After making these changes, reload Icinga 2 to apply them:

sudo systemctl reload icinga2Code language: JavaScript (javascript)

Step 5: Verify the Configuration

  1. Icinga Web 2: Log into Icinga Web 2 and navigate to the ‘Services’ section. Check if the new service for monitoring MySQL is displayed and showing correct status information.
  2. Troubleshooting:
    • If the service shows errors, check the Icinga 2 logs for any detailed error messages (/var/log/icinga2/icinga2.log).
    • Ensure that the MySQL user permissions and network connections between the Icinga agent and server are correctly configured.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

icinga tutorials: How to monitor Docker using icinga agent

Monitoring Docker containers on an Ubuntu server using Icinga involves setting up the Icinga agent to execute Docker-specific monitoring checks and configuring the Icinga server to process…

Read More

icinga tutorials: How to monitor Apache2 using icinga agent

To monitor Apache2 on an Ubuntu server where Icinga agent is installed, while Icinga server is installed on another Ubuntu server, you can follow these step-by-step instructions….

Read More

How to Install Helix Core (Perforce Server)

To install Helix Core (the Perforce server, p4d) on Ubuntu, add the official Perforce APT repository and install the helix-p4d package. Then run the bundled configure-helix-p4d.sh script…

Read More

How to install Kapitan in Windows using wsl?

Kapitan is a Python-based configuration management tool, and on Windows it runs best inside the Windows Subsystem for Linux (WSL). This guide fills in the commands the…

Read More

Install and Configure Gerrit on CentOS and Ubuntu (MySQL + Apache Reverse Proxy)

A practical, step-by-step guide to installing Gerrit for code review on CentOS/RHEL and Ubuntu/Debian. Includes package command comparisons, setup workflow, Apache proxy configuration, and verification checks.

Read More

How to Install Nagios XI from Tarball and Set Up Client Monitoring Paths

This revised guide walks through a practical Nagios XI server installation using the tarball/fullinstall method from the original post, then shows how to validate access and plan client monitoring. It also adds a clear workflow diagram, command examples, and a comparison of common client check methods.

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x