monitor mysq failed

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
smapple
Posts: 81
Joined: Fri Apr 08, 2016 11:43 pm

monitor mysq failed

Post 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!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: monitor mysq failed

Post 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)
Be sure to check out our Knowledgebase for helpful articles and solutions!
smapple
Posts: 81
Joined: Fri Apr 08, 2016 11:43 pm

Re: monitor mysq failed

Post 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
smapple
Posts: 81
Joined: Fri Apr 08, 2016 11:43 pm

Re: monitor mysq failed

Post by smapple »

Im trying to run check_mysql uptime and other modes. Can you share the syntax for this?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: monitor mysq failed

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: monitor mysq failed

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
smapple
Posts: 81
Joined: Fri Apr 08, 2016 11:43 pm

Re: monitor mysq failed

Post by smapple »

Thanks! I will check
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: monitor mysq failed

Post by lmiltchev »

Sure, let us know if you have any more questions. We will keep the topic open for the time being.
Be sure to check out our Knowledgebase for helpful articles and solutions!
smapple
Posts: 81
Joined: Fri Apr 08, 2016 11:43 pm

Re: monitor mysq failed

Post 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!
smapple
Posts: 81
Joined: Fri Apr 08, 2016 11:43 pm

Re: monitor mysq failed

Post by smapple »

HI Should I raise a new ticket for this?
Locked