"Error connecting to database" When I open Nagios CCM 1.03
"Error connecting to database" When I open Nagios CCM 1.03
I get this error: "Error connecting to database." when I try to open Nagios CCM. Nagios in itself does not report any errors on the console and it's working fine. What can be the cause of this and how do I fix it ?
Thanks for any help
Thanks for any help
Last edited by dwhitfield on Thu Feb 02, 2017 12:47 pm, edited 1 time in total.
Reason: marking with green check mark
Reason: marking with green check mark
Re: "Error connecting to database" When I open Nagios CCM 1.
Are you using Nagios XI? The Nagios Core Pro VM? Did you install the CCM yourself?
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: "Error connecting to database" When I open Nagios CCM 1.
Hi,
Thanks for your reply to my question.
I am using the pro Version 3.5.0 which we bought on a VM on CentOS
Thanks for your reply to my question.
I am using the pro Version 3.5.0 which we bought on a VM on CentOS
Re: "Error connecting to database" When I open Nagios CCM 1.
Can you share the outputs of the following commands executed from the CLI of your Nagios Core machine:
Code: Select all
cat /var/www/html/ccm/config.inc.php
echo "SELECT count(*) FROM tbl_info;" | mysql -unagiosql -pn@gweb nagiosql
service mysqld status
tail -n 30 /var/log/mysqld.log
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: "Error connecting to database" When I open Nagios CCM 1.
Hi,
Here are the result from the 4 commands:
cat /var/www/html/ccm/config.inc.php:
echo "SELECT count(*) FROM tbl_info;" | mysql -unagiosql -pn@gweb nagiosql:
service mysqld status:
tail -n 30 /var/log/mysqld.log:
Here are the result from the 4 commands:
cat /var/www/html/ccm/config.inc.php:
Code: Select all
<?php //config.inc.php
//global configuration options for Nagios CCM
$CFG = array();
if(ENVIRONMENT=='nagiosxi') {
//use XI's generated config
require_once('/usr/local/nagiosxi/etc/components/ccm_config.inc.php');
$CFG['audit_send'] = '/usr/local/nagiosxi/scripts/send_to_auditlog.php';
}
else { //nagioscore
//nagios file locations
$CFG['plugins_directory'] = '/usr/local/nagios/libexec';
$CFG['command_file'] = '/usr/local/nagios/var/rw/nagios.cmd';
$CFG['lock_file'] = '/usr/local/nagios/var/nagios.lock';
$CFG['audit_send'] = '/dev/null';
//mysql database connection info
$CFG['db'] = array(
'server' => 'localhost',
'port' => '3306',
'database' => 'nagiosql',
'username' => 'nagiosql',
'password' => 'n@gweb',
);
}
//misc global settings
$CFG['common']['install'] = 'passed';
$CFG['domain'] = 'localhost';
$CFG['default_pagelimit'] = 15;
$CFG['lock_file'] = '/usr/local/nagios/var/nagios.lock';
$CFG['pear_include'] = '/usr/share/pear/HTML/Template/IT.php';
?>
Code: Select all
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
Code: Select all
mysqld is stopped
Code: Select all
Version: '5.1.71' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
160506 15:39:37 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
160506 15:39:38 InnoDB: Initializing buffer pool, size = 8.0M
160506 15:39:38 InnoDB: Completed initialization of buffer pool
160506 15:39:39 InnoDB: Started; log sequence number 0 44233
160506 15:39:39 [Note] Event Scheduler: Loaded 0 events
160506 15:39:39 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.71' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
161201 13:08:08 [Note] /usr/libexec/mysqld: Normal shutdown
161201 13:08:08 [Note] Event Scheduler: Purging the queue. 0 events
161201 13:08:09 InnoDB: Starting shutdown...
161201 13:08:11 InnoDB: Shutdown completed; log sequence number 0 44233
161201 13:08:11 [Note] /usr/libexec/mysqld: Shutdown complete
161201 13:08:11 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
161201 13:09:36 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
161201 13:09:36 InnoDB: Initializing buffer pool, size = 8.0M
161201 13:09:36 InnoDB: Completed initialization of buffer pool
161201 13:09:37 InnoDB: Started; log sequence number 0 44233
161201 13:09:37 [Note] Event Scheduler: Loaded 0 events
161201 13:09:37 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.71' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
170103 11:30:58 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
170103 11:30:59 InnoDB: Initializing buffer pool, size = 8.0M
170103 11:30:59 InnoDB: Completed initialization of buffer pool
170103 11:30:59 InnoDB: Started; log sequence number 0 44233
170103 11:30:59 [Note] Event Scheduler: Loaded 0 events
170103 11:30:59 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.71' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
Re: "Error connecting to database" When I open Nagios CCM 1.
Hmm, it doesn't look like the mysql server is running. There's a couple more commands I would like to see the output of in light of the new information:
Code: Select all
service mysqld restart
tail -n 30 /var/log/mysqld.log
service mysql status
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: "Error connecting to database" When I open Nagios CCM 1.
Hi, thanks for the reply,
Here is the info you asked for:
service mysqld restart:
tail -n 30 /var/log/mysqld.log:
service mysql status :
Thanks for your help!
Here is the info you asked for:
service mysqld restart:
Code: Select all
Stopping mysqld: [60G[[0;32m OK [0;39m]
Another MySQL daemon already running with the same unix socket.
Starting mysqld: [60G[[0;31mFAILED[0;39m]
Code: Select all
Version: '5.1.71' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
160506 15:39:37 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
160506 15:39:38 InnoDB: Initializing buffer pool, size = 8.0M
160506 15:39:38 InnoDB: Completed initialization of buffer pool
160506 15:39:39 InnoDB: Started; log sequence number 0 44233
160506 15:39:39 [Note] Event Scheduler: Loaded 0 events
160506 15:39:39 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.71' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
161201 13:08:08 [Note] /usr/libexec/mysqld: Normal shutdown
161201 13:08:08 [Note] Event Scheduler: Purging the queue. 0 events
161201 13:08:09 InnoDB: Starting shutdown...
161201 13:08:11 InnoDB: Shutdown completed; log sequence number 0 44233
161201 13:08:11 [Note] /usr/libexec/mysqld: Shutdown complete
161201 13:08:11 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
161201 13:09:36 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
161201 13:09:36 InnoDB: Initializing buffer pool, size = 8.0M
161201 13:09:36 InnoDB: Completed initialization of buffer pool
161201 13:09:37 InnoDB: Started; log sequence number 0 44233
161201 13:09:37 [Note] Event Scheduler: Loaded 0 events
161201 13:09:37 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.71' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
170103 11:30:58 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
170103 11:30:59 InnoDB: Initializing buffer pool, size = 8.0M
170103 11:30:59 InnoDB: Completed initialization of buffer pool
170103 11:30:59 InnoDB: Started; log sequence number 0 44233
170103 11:30:59 [Note] Event Scheduler: Loaded 0 events
170103 11:30:59 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.71' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
Code: Select all
mysqld is stopped
Re: "Error connecting to database" When I open Nagios CCM 1.
What is the full output of ps -ef | grep mysql? It appears there may be a runaway process as it seems to continue to run.
Former Nagios Employee
Re: "Error connecting to database" When I open Nagios CCM 1.
The result of the command is:
root 11945 11310 0 16:57 tty1 00:00:00 grep mysql
root 11945 11310 0 16:57 tty1 00:00:00 grep mysql
Re: "Error connecting to database" When I open Nagios CCM 1.
Have you tried completely restarting this server? The mysql process is thoroughly stuck and does not seem to want to free up the socket file.
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/