Page 1 of 2

mysql.sock

Posted: Tue Mar 12, 2019 11:02 am
by jatindeepsharma
As i am getting error as
/usr/libexec/mysqld: Table './nagios/nagios_logentries' is marked as crashed and last (automatic?) repair failed
i have tried to repair this table several times but i is getting crashed again .
I have checked size of this table & it is about

/home/mysql/mysql/nagios
12K nagios_logentries.frm
92G nagios_logentries.MYD
65G nagios_logentries.MYI

i want to truncate these tables after bacup it up. but when i am truncating it. i am getting error as permission denied for mysql.sock.
this file is having sudo rights,how can i change those rights?
srwxrwxrwx 1 mysql mysql 0 Mar 12 09:57 mysql.sock

thanks
JD

Re: mysql.sock

Posted: Tue Mar 12, 2019 11:33 am
by lmiltchev
These seemed like the correct permissions... What happens when you run the command below?

Code: Select all

mysql -u ndoutils -pn@gweb nagios -e 'TRUNCATE TABLE nagios_logentries'
Does it work for you?

Re: mysql.sock

Posted: Tue Mar 12, 2019 12:57 pm
by jatindeepsharma
Hello Dear

Sorry for late reply.. yes i have tried this command... but it is giving me output as:
ERROR 1045 (28000): Access denied for user 'ndoutils'@'localhost' (using password: YES)

Re: mysql.sock

Posted: Tue Mar 12, 2019 1:01 pm
by scottwilkerson
you would need to change the password to the password you see when running this command

Code: Select all

grep ndoutils -5  /usr/local/nagiosxi/html/config.inc.php |grep pwd

Re: mysql.sock

Posted: Tue Mar 12, 2019 1:06 pm
by jatindeepsharma
scottwilkerson wrote:you would need to change the password to the password you see when running this command

Code: Select all

grep ndoutils -5  /usr/local/nagiosxi/html/config.inc.php |grep pwd
Hi scottwilkerson
After running above command, i am getting output as:

[root@NagiosSQL ~]# grep ndoutils -5 /usr/local/nagiosxi/html/config.inc.php |grep pwd
grep: /usr/local/nagiosxi/html/config.inc.php: No such file or directory

Re: mysql.sock

Posted: Tue Mar 12, 2019 1:12 pm
by jatindeepsharma
jatindeepsharma wrote:
scottwilkerson wrote:you would need to change the password to the password you see when running this command

Code: Select all

grep ndoutils -5  /usr/local/nagiosxi/html/config.inc.php |grep pwd
Hi scottwilkerson
After running above command, i am getting output as:

[root@NagiosSQL ~]# grep ndoutils -5 /usr/local/nagiosxi/html/config.inc.php |grep pwd
grep: /usr/local/nagiosxi/html/config.inc.php: No such file or directory
but when i am running same command on nagios i am getting output as :

[root@NagiosXI nagiosxi]# grep ndoutils -5 /usr/local/nagiosxi/html/config.inc.php |grep pwd
"pwd" => 'xxxxxx',

Re: mysql.sock

Posted: Tue Mar 12, 2019 1:46 pm
by lmiltchev
...but when i am running same command on nagios i am getting output as :
Where else were you running the command? It's supposed to be run on the Nagios XI server...
[root@NagiosXI nagiosxi]# grep ndoutils -5 /usr/local/nagiosxi/html/config.inc.php |grep pwd
"pwd" => 'xxxxxx',
If the password 'xxxxxx' is different than "n@gweb", use it in the command that was previously run:

Code: Select all

mysql -u ndoutils -p'xxxxxx' nagios -e 'TRUNCATE TABLE nagios_logentries'

Re: mysql.sock

Posted: Tue Mar 12, 2019 2:04 pm
by lmiltchev
One more thing - if your mysql is offloaded to a remote server, you would need to run the command on the mysql server. You could also run it on the Nagios XI server as such:

Code: Select all

mysql -h <ip address of the offloaded mysql server> -u ndoutils -p'xxxxxx' nagios -e 'TRUNCATE TABLE nagios_logentries'
Make sure that the actual username is still "ndoutils". It's possible that you changed it to "nagios" if you followed this document:

https://assets.nagios.com/downloads/nag ... Server.pdf

It's always a good idea to repair the db after truncating a table, so you could run (on the offloaded server):

Code: Select all

mysqlcheck -r -f -uroot -pnagiosxi --all-databases
Hope this helps.

Re: mysql.sock

Posted: Tue Mar 12, 2019 2:22 pm
by jatindeepsharma
lmiltchev wrote:One more thing - if your mysql is offloaded to a remote server, you would need to run the command on the mysql server. You could also run it on the Nagios XI server as such:

Code: Select all

mysql -h <ip address of the offloaded mysql server> -u ndoutils -p'xxxxxx' nagios -e 'TRUNCATE TABLE nagios_logentries'
Make sure that the actual username is still "ndoutils". It's possible that you changed it to "nagios" if you followed this document:

https://assets.nagios.com/downloads/nag ... Server.pdf

It's always a good idea to repair the db after truncating a table, so you could run (on the offloaded server):

Code: Select all

mysqlcheck -r -f -uroot -pnagiosxi --all-databases
Hope this helps.
actually my username & password for SQL is nagios but when i am running given command on nagios sql or on nagios, i am getting below output.
mysql -h <10.200.1.152> -u nagios -p nagios nagios -e 'TRUNCATE TABLE nagios_logentries' -bash: 10.200.1.152: No such file or directory

Re: mysql.sock

Posted: Tue Mar 12, 2019 2:35 pm
by lmiltchev
Try:

Code: Select all

mysql -h 10.200.1.152 -u nagios -pnagios nagios -e 'TRUNCATE TABLE nagios_logentries'
from the Nagios XI server or ssh into the offloaded mysql server, and run the command locally:

Code: Select all

mysql -u nagios -pnagios nagios -e 'TRUNCATE TABLE nagios_logentries'