LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-08-2012, 12:06 PM   #1
lce411
Member
 
Registered: Jul 2012
Posts: 50

Rep: Reputation: Disabled
Nagios/MySQL QUestions


I've posted a question on the Nagios forum, but there is much more traffic here. I'm trying to get Nagios to start using a MySQL db, so the Nagios server isn't so taxed. I can log into the MySQL server from the Nagios server, so I know the iptables exception is working. When I try to start a mysqldump, from the Nagios server I get "mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when trying to connect". That file does exist on the MySQL server, so I'm not sure why its erroring out. Does anyone have any experience with Nagios and MySQL? Or can anyone point me in the direction of documentation for doing this? I've searched but can't find anything.

I am running RHEL 5.8 and Nagios 2.12 (old version, I know). MySQL is Ver 14.14 Distrib 5.5.27, for Linux.
 
Old 11-08-2012, 12:51 PM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
The mysql_root password "may" be different than the system root_password, so some thing to check is on the mysql server are
Code:
sudo mysqldump -u <user> -p <pass> nagios_db > /path/to/nagios.sql
or
Code:
sudo mysqldump -u root -p <mysql_root_pass> nagios_db > /path/to/nagios.sql
If it's a remote host:
Code:
ssh user@host mysqldump -u user -p <userpass> nagios_db > /path/to/nagios.sql
and then check /path/to/nagios.sql on the remote host.

you can check your connection remotely using mysql like so:

Code:
mysql -h remotehost -u root -p <pass> or 
mysql -h remotehost -u user -p <pass>
if those get you into a mysql > prompt you should be good to go.

See mysqldump — A Database Backup Program for more info.

Last edited by Habitual; 11-08-2012 at 12:54 PM.
 
Old 11-08-2012, 01:02 PM   #3
lce411
Member
 
Registered: Jul 2012
Posts: 50

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Habitual View Post
The mysql_root password "may" be different than the system root_password, so some thing to check is on the mysql server are
Code:
sudo mysqldump -u <user> -p <pass> nagios_db > /path/to/nagios.sql
or
Code:
sudo mysqldump -u root -p <mysql_root_pass> nagios_db > /path/to/nagios.sql
If it's a remote host:
Code:
ssh user@host mysqldump -u user -p <userpass> nagios_db > /path/to/nagios.sql
and then check /path/to/nagios.sql on the remote host.

you can check your connection remotely using mysql like so:

Code:
mysql -h remotehost -u root -p <pass> or 
mysql -h remotehost -u user -p <pass>
if those get you into a mysql > prompt you should be good to go.

See mysqldump — A Database Backup Program for more info.
Thanks for the response. The only command I could get to work was: mysql -h remotehost -u user -p <pass>. That got me the 'mysql' prompt, from the Nagios server. I have the root passwords for both the systems and mysql, so I'm not sure why I can't get there as root. I could only get user nagios to connect.
 
Old 11-08-2012, 01:21 PM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Then you should be able to dump the nagios_db as the nagios user using
Code:
mysqldump -h remotehost -u nagios -p <pass> nagios_db > /path/to/nagios.sql
"/path/to/nagios.sql" must be writable by the nagios user, if in doubt, use
Code:
mysqldump -h remotehost -u nagios -p <pass> nagios_db >/tmp/nagios.sql
After the dump what happens is up to you.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Installing Nagios 3.3.2 - MySQL error dazdaz Linux - General 2 05-12-2012 11:33 AM
Nagios::Advanced notifications configuration questions jdomingo Linux - Server 1 10-30-2010 08:52 AM
questions to ask regarding nagios s0tGaL Linux - Newbie 10 07-30-2010 06:22 AM
Monitoring mysql with nagios el_tedward Linux - Software 2 04-07-2010 11:08 PM
Nagios + ndoutils + MySQL bpwoods Linux - Software 4 09-10-2009 02:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration