Page 1 of 2

monitor mysq failed

Posted: Fri Jul 06, 2018 11:21 am
by smapple
Hi Team,

I am trying to monitor mysql. I am facing the following error:

CRITICAL - cannot connect to <Database>. Access denied for user 'nagios'@'nagios3.apple.com' (using password: YES)

I have granted access in the mysql database.

Is there anything I am missing?

Thanks!

Re: monitor mysq failed

Posted: Fri Jul 06, 2018 11:37 am
by lmiltchev
Can you show us an example of the check that you are running? Is mysql db local or on a remote server?

Can you log into the mysql database, and verify the grants by running the command below?

Code: Select all

SHOW GRANTS FOR '<user>'@'<server>';
Example:

Code: Select all

MariaDB [(none)]> show grants for 'nagiosxi'@'localhost';
+-----------------------------------------------------------------------------------------------------------------+
| Grants for nagiosxi@localhost                                                                                   |
+-----------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'nagiosxi'@'localhost' IDENTIFIED BY PASSWORD '*244733929909A95DDF1A7F78DD067589B4092EE7' |
| GRANT ALL PRIVILEGES ON `nagiosxi`.* TO 'nagiosxi'@'localhost'                                                  |
+-----------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

Re: monitor mysq failed

Posted: Fri Jul 06, 2018 11:52 am
by smapple
SHOW GRANTS FOR [email protected]
-> ;
+------------------------------------------------------------------+
| Grants for [email protected] |
+------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'nagios'@'nagios3.apple.com' |
| GRANT ALL PRIVILEGES ON `ctbx`.* TO 'nagios'@'nagios3.apple.com' |
| GRANT SELECT ON `mysql`.* TO 'nagios'@'nagios3.apple.com' |
+------------------------------------------------------------------+

This is the grants on nagios3

Re: monitor mysq failed

Posted: Fri Jul 06, 2018 11:56 am
by smapple
Im trying to run check_mysql uptime and other modes. Can you share the syntax for this?

Re: monitor mysq failed

Posted: Fri Jul 06, 2018 11:58 am
by lmiltchev
Is mysql db local or on a remote server?

Can you show us an example of the check that you are running, along with the output of it?

Code: Select all

CCM > Services > <your service> > Run Check Command

Re: monitor mysq failed

Posted: Fri Jul 06, 2018 12:01 pm
by lmiltchev
Sorry, I just saw your last post. Here's an example of the syntax for uptime mode:

Code: Select all

/usr/local/nagios/libexec/check_mysql_health --hostname=x.x.x.x --port=3306 --username=root --password="nagiosxi" --database=information_schema --mode uptime --warning 10: --critical 5:
OK - database is up since 26108 minutes | uptime=1566513s

Re: monitor mysq failed

Posted: Fri Jul 06, 2018 1:49 pm
by smapple
Thanks! I will check

Re: monitor mysq failed

Posted: Fri Jul 06, 2018 2:18 pm
by lmiltchev
Sure, let us know if you have any more questions. We will keep the topic open for the time being.

Re: monitor mysq failed

Posted: Mon Jul 09, 2018 3:10 pm
by smapple
Im done with this.

I am planning to upgrade nagios from 5.4.13 to recent.

Can you please let me know the procedure to do it?

I am facing this issue:

---- Starting Nagios XI Backup ----
No entry for terminal type "unknown";
using dumb terminal settings.
Running configuration check...
Stopping nagios:. done.
Starting nagios: done.
Backing up Core Config Manager (NagiosQL)...
tar: Removing leading `/' from member names
tar: Removing leading `/' from member names
Backing up Nagios Core...
tar: Removing leading `/' from member names
tar: /usr/local/nagios/var/ndo.sock: socket ignored
tar: /usr/local/nagios/var/rw/nagios.qh: socket ignored
tar: /usr/local/nagios/var: file changed as we read it
Backing up Nagios XI...
tar: Removing leading `/' from member names
Backing up MRTG...
tar: Removing leading `/' from member names
Backing up NRDP...
tar: Removing leading `/' from member names
Backing up Nagvis...
tar: Removing leading `/' from member names
Backing up MySQL databases...
mysqldump: Got error: 144: Table './nagios/nagios_logentries' is marked as crashed and last (automatic?) repair failed when using LOCK TABLES
Error backing up MySQL database 'nagios' - check the password in this script!

Re: monitor mysq failed

Posted: Mon Jul 09, 2018 3:41 pm
by smapple
HI Should I raise a new ticket for this?