Opsview Knowledge Center

Database - MySQL Server

An overview of the MySQL Server Opspack for Opsview Monitor

Prerequisites

Network Dependencies

You will need to open port tcp/3306 from the Opsview Monitor server to the MySQL server host. See your operating system/firewall documentation for information on how to do this if your host is running a local firewall.

Installation

On the MySQL server to be monitored:

  1. Install the Opsview Agent - see [Opsview Agents] (doc:opsview-agents)
  2. Enable remote connections in MySQL (see http://dev.mysql.com/doc/refman/5.7/en/server-options.html) but ensure you have set a MySQL root password for security reasons ('mysql_secure_installation' may be available on your system to secure MySQL)
  3. Create a dedicated user within MySQL for use by monitoring (see http://dev.mysql.com/doc/refman/5.5/en/adding-users.html for more information). Suitable SQL to create an 'opsview' user might be (NOTE: set the <opsview server IP address> and <password> accordingly):
    mysql> CREATE USER 'opsview'@'<opsview server IP address>' IDENTIFIED BY '<password>';
    mysql> FLUSH PRIVILEGES;

Configuration

In the Opsview Monitor UI:

  1. Create a new host within "Menu => Settings => Host Settings" for your MySQL database server.
  2. Add the Host Template "OS - Opsview Agent"
  3. Add the Host Template "Database - MySQL Server"
  4. On the 'Variables' tab add in 'MYSQLCREDENTIALS' with a value set to 'credentials'. In the lower pane override the username and password for the account you created in MySQL
  5. Submit Changes
  6. Perform a configuration reload by using "Menu => Settings => Reload"

Troubleshooting

If you see the below output:

$ /usr/local/nagios/libexec/check_mysql_performance -H localhost -u opsview -p PASSWORD --metricname=Connections -w 20 -c 30
MONITORED BY: master
RETURN CODE: 255
ERROR: DBI connect('host=localhost','opsview',...) failed: Access denied for user 'opsview'@'localhost' (using password: YES) at /usr/local/nagios/libexec/check_mysql_performance line 463.

This means that the username we are using is not set up in the database we are trying to monitor (see the "Installation..." section above).

Database - MySQL Server

An overview of the MySQL Server Opspack for Opsview Monitor