Step-By-Step: OMS Log Analytics MySQL Linux Monitoring

Hello All!

This post is step-by-step Guide How to configure monitoring of MySQL on Linux by OMS/Log Analytics Agent.

  1. You have to install library: libmysqlclient20 – without this lib OMS Agent will NOT discover MySQL instance installed in OS
  2. (OPTIONAL) Next you need to reinstall Agent if it has been installed before step.1 in order to make Agent discover MySQL and install mysqlcim providers.
  3. Next you need to Setup creds for mysqlcim provider

 sudo su omsaget -c ‘/opt/microsoft/mysql-cimprov/bin/mycimprovauth default 127.0.0.1 <username> <password>’

Note: 

Authentication file location

The MySQL OMI Authentication File should be located in the following location and named

“mysql-auth”: /var/opt/microsoft/mysql-cimprov/auth/omsagent/mysql-auth

The file (and auth/omsagent directory) should be owned by the omsagent user.

/opt/omi/bin/service_control restart

Alternatively, you can specify the required MySQL credentials in a file, by creating the file:

/var/opt/microsoft/mysql-cimprov/auth/omsagent/mysql-auth.

USERNAME should have appropriate credential in MySQL

MySQL Permissions

To grant permissions to a MySQL monitoring user the granting user must have the ‘GRANT option’ privilege as well as the privilege being granted. *

In order for the MySQL User to return performance data the user will need access to the following queries

SHOW GLOBAL STATUS;

SHOW GLOBAL VARIABLES:

In addition to these queries the MySQL user requires SELECT access to the following default tables: information_schema, mysql. These privileges can be granted by running the following grant commands.

GRANT SELECT ON information_schema.* TO ‘monuser’@’localhost’;

GRANT SELECT ON mysql.* TO ‘monuser’@’localhost’;

4. In order to check if mysqlcim provider works fine:

sudo su omsagent -c ‘/opt/omi/bin/omicli ei root/mysql MySQL_Server’

You should see something like:

instance of MySQL_Server

{

[Key] ProductIdentifyingNumber=ubuntu-16-04:127.0.0.1:3306

[Key] ProductName=MySQL

[Key] ProductVendor=Oracle

[Key] ProductVersion=5.7.18

[Key] SystemID=0

[Key] CollectionID=Linux

ConfigurationFile=/etc/mysql/my.cnf

ErrorLogFile=/var/log/mysql/error.log

Hostname=ubuntu-16-04

BindAddress=127.0.0.1

Port=3306

SocketFile=/var/run/mysqld/mysqld.sock

DataDirectory=/var/lib/mysql/

OperatingStatus=OK

}

5. In OMS Workspace you should Enable Performance metrics to collect:

 

Then after some time you should able to see that omsagent.conf file has been updated and new Performance metrics have been added

 

In order to apply you need to restart Agent:

sudo /opt/microsoft/omsagent/bin/service_control restart

 

Happy Monitoring!

THE USE OF THE WEBPAGES OF artempro.ru IS ON YOUR OWN RISK. THE INFORMATION IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND INCLUDING ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, COURSE OF DEALING OR USAGE OF TRADE. artempro.ru AG IS NOT LIABLE FOR ANY WARRANTY CLAIMS OR DAMAGES, IRRESPECTIVE OF THE LEGAL CAUSE, WHETHER IN CONTRACT, WARRANTY, FAILURE OF A REMEDY TO ACHIEVE ITS INTENDED OR ESSENTIAL PURPOSES, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY, INDEMNITY OR ANY OTHER LEGAL THEORY AND IN PARTICULAR SHALL NOT BE LIABLE FOR DAMAGES INCURRED AS A RESULT OF CONSULTATION, ASSISTANCE IN SETTING-UP PROCEDURES, BUSINESS INTERRUPTION OR SOFTWARE DEFECTS, EXCEPT WHERE LIABILITY IS MANDATORY FOR DAMAGES TO PRIVATELY USED PROPERTY OR BECAUSE OF VIOLATION OF CARDINAL CONTRACTUAL OBLIGATIONS OR DUE TO INTENT, GROSS NEGLIGENCE OR FAILURE TO CONFORM TO EXPRESS WARRANTIES. HOWEVER, LIABILITY FOR DAMAGES ARISING FROM THE VIOLATION OF CARDINAL CONTRACTUAL OBLIGATIONS SHALL BE LIMITED TO THE FORESEEABLE DAMAGE NORMALLY COVERED BY A CONTRACT EXCEPT IN CASES OF WILFUL MISCONDUCT OR GROSS NEGLIGENCE.

 

Leave a Reply

Your email address will not be published. Required fields are marked *