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.

 

OMS Log Analytics Ubuntu 16.04 on-boarding undefined symbol: SSLv3_method

Hello All,

Just short post about issue during Ubuntu 16.04 on-boarding to OMS (Log Analytics).

First of all check this Microsoft/OMS-Agent-for-Linux – on this page you can find list of supported versions of Linux Operating Systems and links to many useful resources regarding OMS Agent on Linux.

Second if you try to on-board your Azure Ubuntu 16.04 VM to OMS right out-of-the-box – everything with work fine.

Third…here comes an error

But assume that you have installed PHP 5.6 from added repository as described here: this involves adding repository which contains OpenSSL build without SSLv3 support.

This will lead to following error during install of OMS Linux Agent

Configuring OMI service …
Created symlink from /etc/systemd/system/multi-user.target.wants/omid.service to /lib/systemd/system/omid.service.
Setting up scx (1.6.3.48) …
Setting up omsagent (1.2.0.148) …
-e info Reading onboarding params from: /etc/omsagent-onboard.conf
-e info Reusing previous agent GUID
/opt/microsoft/omsagent/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require’: /opt/microsoft/omsagent/ruby/lib/ruby/2.2.0/x86_64-linux/openssl.so: undefined symbol: SSLv3_method – /opt/microsoft/omsagent/ruby/lib/ruby/2.2.0/x86_64-linux/openssl.so (LoadError)
from /opt/microsoft/omsagent/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require’
from /opt/microsoft/omsagent/ruby/lib/ruby/2.2.0/openssl.rb:17:in `<top (required)>’
from /opt/microsoft/omsagent/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require’
from /opt/microsoft/omsagent/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require’
from /opt/microsoft/omsagent/bin/auth_key.rb:2:in `<main>’

OR it will lead to failure IF you upgrade OpenSSL package with

apt-get update

apt-get upgrade

And here is how we could solve issue:

  • if you have OMS Agent installed and upgraded OpenSSL to one from repository – > Agent fail to start

Downgrade to previous version of OpenSSL:

#Check installed and previous version

apt-cache policy openssl
openssl:
Installed: 1.0.2j-1+deb.sury.org~xenial+1
Candidate: 1.0.2j-1+deb.sury.org~xenial+1
Version table:
*** 1.0.2j-1+deb.sury.org~xenial+1 500
500 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 Packages
100 /var/lib/dpkg/status
1.0.2g-1ubuntu4.5 500
500 http://azure.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages
1.0.2g-1ubuntu4 500
500 http://azure.archive.ubuntu.com/ubuntu xenial/main amd64 Packages

#Install OpenSSL from Ubuntu repository

apt-get install openssl=1.0.2g-1ubuntu4.5

#Restart Agent and check status

scxadmin -restart

scxadmin -status

omiserver: is running
omiagent: 1 instance running

  • IF you want to on-board but and received error after running install script:

#Uninstall OMS Agent:

sudo dpkg -P omsconfig
sudo dpkg -P omsagent
sudo /opt/microsoft/scx/bin/uninstall


#Install OpenSSL from Ubuntu repository

apt-get install openssl=1.0.2g-1ubuntu4.5

#Install OMS Agent again:

sudo sh ./omsagent-<DOWNLOADED_SCRIPT_VERSION>.sh --install -w <workspaceid> -s <shared key>

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.

SCOM Monitoring of Linux/Unix of Windows workgroup Agent with same name

Hello All!

Lets assume that for some reason you have in yours infrastructure servers which have exact same FQDNs but different IPs (sometimes it can happen with best of us). And you have question if it is possible to monitor such Objects with your SCOM. Every Entity in SCOM has its own unique HealthService GUID – according to this blog How are GUIDs in SCOM and SCSM calculated? such GUIDs calculated based on many parameter which are same inside Management Group and FQDNs for Windows  Computer and Unix/Linux Computer (which are same for our servers). So it is looks like we cannot monitor Servers with same FQDN.

Workaround available:

Imagine we have two servers deployed

– Server1

FQDN:ubuntu1.contoso.com

IP: XXX.XXX.XXX.001

– Server2

FQDN:ubuntu1.contoso.com

IP: XXX.XXX.XXX.002

On SCOM Management server we can create records in c:\Windows\System32\drivers\etc\hosts file

# Server1

#FQDN:ubuntu1.contoso.com

XXX.XXX.XXX.001 ubuntu1.contoso.com

# Server2

# FQDN:ubuntu1.contoso.com

XXX.XXX.XXX.002 ubuntu1-sec.contoso.com

Next on our “second” server we have to manually generate Certificate

/opt/microsoft/scx/bin/tools/scxsslconfig -h ubuntu1-sec.contoso.com -f -v

Now we can discover this server through SCOM Console with appropriate IP address.

Same can be done with Windows Server Computer but Certificate generated different way.

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.