mysql.sock

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
jatindeepsharma
Posts: 70
Joined: Wed Apr 04, 2018 10:52 am

mysql.sock

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

Re: mysql.sock

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
jatindeepsharma
Posts: 70
Joined: Wed Apr 04, 2018 10:52 am

Re: mysql.sock

Post 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)
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: mysql.sock

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
jatindeepsharma
Posts: 70
Joined: Wed Apr 04, 2018 10:52 am

Re: mysql.sock

Post 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
jatindeepsharma
Posts: 70
Joined: Wed Apr 04, 2018 10:52 am

Re: mysql.sock

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

Re: mysql.sock

Post 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'
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: mysql.sock

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
jatindeepsharma
Posts: 70
Joined: Wed Apr 04, 2018 10:52 am

Re: mysql.sock

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

Re: mysql.sock

Post 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'
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked