You are here

Opsview-web service not starting

11 posts / 0 new
Last post
myousufali
myousufali's picture
Opsview-web service not starting

I am facing the below error please help.

service opsview-web start

Starting opsview-web: Use of uninitialized value $mysql_ver in pattern match (m//) at /usr/local/nagios/perl/lib/DBIx/Class/Storage/DBI/mysql.pm line 62, <DATA> line 1000.
DBIx::Class::ResultSet::find(): DBI Connection failed: DBI connect('database=opsview;host=localhost','opsview',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) at /usr/local/nagios/perl/lib/DBIx/Class/Storage/DBI.pm line 1275. at /usr/local/opsview-web/script/../lib/Opsview/Web.pm line 524
Compilation failed in require at /usr/local/nagios/perl/lib/Module/Runtime.pm line 317, <DATA> line 1000. at /usr/local/nagios/perl/lib/Catalyst/ScriptRunner.pm line 50.
...done

 

 

Duncan Ferguson
dferguson's picture
Can't connect to local MySQL
Can't connect to local MySQL server through socket

Can you make sure MySQL is running on your server?

Duncs
myousufali
myousufali's picture
MySQL service is running.

MySQL service is running.

 ps aux | grep mysql
root      30781  0.0  0.0 108336  1500 pts/0    S    Apr13   0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/d/mysql/mysql --socket=/d/mysql/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql
mysql     31111  0.0  0.7 541140 45568 pts/0    Sl   Apr13   0:15 /usr/libexec/mysqld --basedir=/usr --datadir=/d/mysql/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --open-files-limit=65535 --pid-file=/var/run/mysqld/mysqld.pid --socket=/d/mysql/mysql/mysql.sock

 

Duncan Ferguson
dferguson's picture
Is MySQL set up and running

Is MySQL set up and running on the same server as Opsview Monitor?  The error output suggests it should be.

Does /var/lib/mysql/mysql.sock exist and can the nagios user 'see' the file

Does using a normal mysql client work (mysql -u nagios -p)

  Duncs

myousufali
myousufali's picture
MySQL setup is running on the

MySQL setup is running on the same server as opsview.

ls -la /var/lib/mysql/*.sock
-rwxrwxrwx 1 mysql mysql 0 Apr 13 15:42 /var/lib/mysql/mysql.sock

mysql -u nagios -p  ( Not working....)
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Duncan Ferguson
dferguson's picture
So this suggests there is a

So this suggests there is a problem with the database.  Can you restart MySQL without issue?  Are there any errors in the MySQL log files?

  Duncs

myousufali
myousufali's picture
I can restart MySQL service.

I can restart MySQL service.

service mysqld restart
Stopping mysqld:                                        [  OK  ]
Starting mysqld:                                          [  OK  ]

Below are the sample from log file.

160414 12:21:32 [Note] /usr/libexec/mysqld: Normal shutdown

160414 12:21:32 [Note] Event Scheduler: Purging the queue. 0 events
160414 12:21:32  InnoDB: Starting shutdown...
160414 12:21:33  InnoDB: Shutdown completed; log sequence number 1595675
160414 12:21:33 [Note] /usr/libexec/mysqld: Shutdown complete

160414 12:21:33 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
160414 12:21:33 mysqld_safe Starting mysqld daemon with databases from /d/mysql/mysql
160414 12:21:33 [Note] libgovernor.so not found
160414 12:21:33 [Note] /usr/libexec/mysqld (mysqld 5.5.47-cll-lve) starting as process 126851 ...
160414 12:21:33 [Note] Plugin 'FEDERATED' is disabled.
160414 12:21:33 InnoDB: The InnoDB memory heap is disabled
160414 12:21:33 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160414 12:21:33 InnoDB: Compressed tables use zlib 1.2.3
160414 12:21:33 InnoDB: Using Linux native AIO
160414 12:21:33 InnoDB: Initializing buffer pool, size = 128.0M
160414 12:21:33 InnoDB: Completed initialization of buffer pool
160414 12:21:33 InnoDB: highest supported file format is Barracuda.
160414 12:21:33  InnoDB: Waiting for the background threads to start
160414 12:21:34 InnoDB: 5.5.47 started; log sequence number 1595675
160414 12:21:34 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
160414 12:21:34 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
160414 12:21:34 [Note] Server socket created on IP: '0.0.0.0'.
160414 12:21:34 [Note] Event Scheduler: Loaded 0 events
160414 12:21:34 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.47-cll-lve'  socket: '/d/mysql/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL) by Atomicorp

 

Duncan Ferguson
dferguson's picture
Does 'mysql -u root -p' now

Does 'mysql -u root -p' now work as the nagios user?

If not, does it work as the 'root' user?  If so, this suggests the problem is permissions getting to the socker file mentioned earlier

  Duncs

myousufali
myousufali's picture
I tried the default passwords

I tried the default passwords its not working. Even try to reset the root password for MySQL not working.

service mysqld stop

Stopping mysqld: [ OK ]

# mysqld_safe --skip-grant-tables &
[1] 121382
# 160414 11:43:26 mysqld_safe Logging to '/var/log/mysqld.log'.
160414 11:43:26 mysqld_safe Starting mysqld daemon with databases from /d/mysql/mysql

# mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

# mysql -u nagios
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

How to set the permission on socker file

Duncan Ferguson
dferguson's picture
From the output you have

From the output you have pasted, you are running the commands as root so you have file access to the socket, which suggests this is down to MySQL configuration.

There are plenty of resources in Google to help track down what the problem is - without having access to your system to trace the fault, there is little I can do. 

https://www.google.co.uk/search?q=mysql+Can%27t+connect+to+local+MySQL+server+through+socket+%27%2Fvar%2Flib%2Fmysql%2Fmysql.sock%27+

If you are a customer of ours then raise a support ticket and I can investigate this further.

  Duncs

myousufali
myousufali's picture
Thanks for your great support

Thanks for your great support Duncs.