Monitoring MySQL

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Monitoring MySQL

Post by dwhitfield »

You might be working on it, but you might have missed it. Can you post the full output of /usr/local/nagios/libexec/check_nrpe -H X.X.X.X where X.X.X.X is your IP address. Thanks!
Cristhian_Plaza
Posts: 62
Joined: Thu Oct 27, 2016 2:43 pm

Re: Monitoring MySQL

Post by Cristhian_Plaza »

avandemore wrote:Please show the full command and output as it relates to your error. Example:

Code: Select all

[root@avandemore-centos7 etc]# /usr/local/nagios/libexec/check_nrpe -H 192.168.3.156
I (0.4.4.19 2015-12-08) seem to be doing fine...

Code: Select all

[ec2-user@ip-172-31-51-197 ~]$ /usr/local/nagios/libexec/check_mysql_counters_55 -H 54.196.226.111
UNKNOWN: usage: check_mysql_counters -H host -P port -u mysqluser -p mysqlpassword
[ec2-user@ip-172-31-51-197 ~]$ cd /usr/lcal/nagios/libexec
-bash: cd: /usr/lcal/nagios/libexec: No such file or directory

Code: Select all

[ec2-user@ip-172-31-51-197 libexec]$ /usr/local/nagios/libexec/check_mysql_counters_55 -H 54.196.226.111 -P 3066 -u x -p x
PHP Fatal error:  Class 'PDO' not found in /usr/local/nagios/libexec/check_mysql_counters_55 on line 508
Cristhian_Plaza
Posts: 62
Joined: Thu Oct 27, 2016 2:43 pm

Re: Monitoring MySQL

Post by Cristhian_Plaza »

dwhitfield wrote:You might be working on it, but you might have missed it. Can you post the full output of /usr/local/nagios/libexec/check_nrpe -H X.X.X.X where X.X.X.X is your IP address. Thanks!
Ok, but it isn't working by NRPE.

Code: Select all

[ec2-user@ip-172-31-51-197 libexec]$ /usr/local/nagios/libexec/check_nrpe -H 54.196.226.111
NRPE v2.15
jasonholtzapple
Posts: 4
Joined: Wed Nov 30, 2016 3:14 pm

Re: Monitoring MySQL

Post by jasonholtzapple »

Your nagios server needs the PHP PDO package installed. Which package you need depends on the OS, check for the php-mysql package.
Cristhian_Plaza
Posts: 62
Joined: Thu Oct 27, 2016 2:43 pm

Re: Monitoring MySQL

Post by Cristhian_Plaza »

jasonholtzapple wrote:Your nagios server needs the PHP PDO package installed. Which package you need depends on the OS, check for the php-mysql package.
Ok, I installed the package, now what?

Code: Select all

[ec2-user@ip-172-31-51-197 libexec]$ /usr/local/nagios/libexec/check_mysql_counters_55 -H 54.196.226.111 -P 3066 -u x-p x
SQLSTATE[HY000] [2003] Can't connect to MySQL server on '54.196.226.111' (111)
jasonholtzapple
Posts: 4
Joined: Wed Nov 30, 2016 3:14 pm

Re: Monitoring MySQL

Post by jasonholtzapple »

That message is pretty clear. Your nagios server can't connect to the database. Check your firewalls. Also you are using a non-standard mysql port, that might be a typo.
Cristhian_Plaza
Posts: 62
Joined: Thu Oct 27, 2016 2:43 pm

Re: Monitoring MySQL

Post by Cristhian_Plaza »

jasonholtzapple wrote:That message is pretty clear. Your nagios server can't connect to the database. Check your firewalls. Also you are using a non-standard mysql port, that might be a typo.
Ok, I had a little mistake, but now what??? what does that message mean?

Code: Select all

[ec2-user@ip-172-31-51-197 objects]$ /usr/local/nagios/libexec/check_mysql_counters_55 -H 54.196.226.111 -P 3306 -u x -p x
SQLSTATE[HY000] [1130] Host '54.166.49.89' is not allowed to connect to this MariaDB server[ec2-user@ip-172-31-51-197 objects]$
jasonholtzapple
Posts: 4
Joined: Wed Nov 30, 2016 3:14 pm

Re: Monitoring MySQL

Post by jasonholtzapple »

Unfortunately this plugin is probably not going to work well with MariaDB, unless the status variables returned by MariaDB are exactly the same as the Oracle MySQL version. If you do get it to work, report back and I'll add MariaDB to the list of supported flavors.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Monitoring MySQL

Post by rkennedy »

jasonholtzapple wrote:Unfortunately this plugin is probably not going to work well with MariaDB, unless the status variables returned by MariaDB are exactly the same as the Oracle MySQL version. If you do get it to work, report back and I'll add MariaDB to the list of supported flavors.
Thank you for your contribution here. :)
Cristhian_Plaza wrote:
jasonholtzapple wrote:That message is pretty clear. Your nagios server can't connect to the database. Check your firewalls. Also you are using a non-standard mysql port, that might be a typo.
Ok, I had a little mistake, but now what??? what does that message mean?

Code: Select all

[ec2-user@ip-172-31-51-197 objects]$ /usr/local/nagios/libexec/check_mysql_counters_55 -H 54.196.226.111 -P 3306 -u x -p x
SQLSTATE[HY000] [1130] Host '54.166.49.89' is not allowed to connect to this MariaDB server[ec2-user@ip-172-31-51-197 objects]$
Based on this, I would look at talking to your database administrator to allow 54.166.49.89 to access the MariaDB. You can find instructions here - http://stackoverflow.com/questions/1559 ... sql-server - this may not work though as @jasonholtzapple mentioned.

One more thing to note @Cristhian_Plaza - you had previously posted your root mysql username / password here, which I modified - in the future you may want to sanitize what you're posting to avoid posting sensitive credentials to a WAN facing server.
Former Nagios Employee
Cristhian_Plaza
Posts: 62
Joined: Thu Oct 27, 2016 2:43 pm

Re: Monitoring MySQL

Post by Cristhian_Plaza »

rkennedy wrote:
jasonholtzapple wrote:Unfortunately this plugin is probably not going to work well with MariaDB, unless the status variables returned by MariaDB are exactly the same as the Oracle MySQL version. If you do get it to work, report back and I'll add MariaDB to the list of supported flavors.
Thank you for your contribution here. :)
Cristhian_Plaza wrote:
jasonholtzapple wrote:That message is pretty clear. Your nagios server can't connect to the database. Check your firewalls. Also you are using a non-standard mysql port, that might be a typo.
Ok, I had a little mistake, but now what??? what does that message mean?

Code: Select all

[ec2-user@ip-172-31-51-197 objects]$ /usr/local/nagios/libexec/check_mysql_counters_55 -H 54.196.226.111 -P 3306 -u x -p x
SQLSTATE[HY000] [1130] Host '54.166.49.89' is not allowed to connect to this MariaDB server[ec2-user@ip-172-31-51-197 objects]$
Based on this, I would look at talking to your database administrator to allow 54.166.49.89 to access the MariaDB. You can find instructions here - http://stackoverflow.com/questions/1559 ... sql-server - this may not work though as @jasonholtzapple mentioned.

One more thing to note @Cristhian_Plaza - you had previously posted your root mysql username / password here, which I modified - in the future you may want to sanitize what you're posting to avoid posting sensitive credentials to a WAN facing server.
OK... It is working now¡ with the last post... I created an account and I can see, I think the check's definitions, I don't know how to use call this definition one by one on commands.cfg

Code: Select all

MYSQL_COUNTERS OK | 'ABORTED_CLIENTS'=0c 'ABORTED_CONNECTS'=90c 'BINLOG_COMMITS'=0c 'BINLOG_GROUP_COMMITS'=0c 'BINLOG_CACHE_DISK_USE'=0c 'BINLOG_CACHE_USE'=0c 'BINLOG_STMT_CACHE_DISK_USE'=0c 'BINLOG_STMT_CACHE_USE'=0c 'BYTES_RECEIVED'=67900347B 'BYTES_SENT'=408555315B 'COM_ADMIN_COMMANDS'=0c 'COM_ALTER_DB'=0c 'COM_ALTER_DB_UPGRADE'=0c 'COM_ALTER_EVENT'=0c 'COM_ALTER_FUNCTION'=0c 'COM_ALTER_PROCEDURE'=0c 'COM_ALTER_SERVER'=0c 'COM_ALTER_TABLE'=4c 'COM_ALTER_TABLESPACE'=0c 'COM_ANALYZE'=0c 'COM_ASSIGN_TO_KEYCACHE'=0c 'COM_BEGIN'=0c 'COM_BINLOG'=0c 'COM_CALL_PROCEDURE'=0c 'COM_CHANGE_DB'=0c 'COM_CHANGE_MASTER'=0c 'COM_CHECK'=313c 'COM_CHECKSUM'=0c 'COM_COMMIT'=0c 'COM_CREATE_DB'=0c 'COM_CREATE_EVENT'=0c 'COM_CREATE_FUNCTION'=0c 'COM_CREATE_INDEX'=0c 'COM_CREATE_PROCEDURE'=0c 'COM_CREATE_SERVER'=0c 
This is a part of the output
Locked