Remote MYSQL Server and snmptt

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
pnnagios
Posts: 47
Joined: Wed Dec 14, 2011 9:48 am

Remote MYSQL Server and snmptt

Post by pnnagios »

Hello,

I have followed the following document for offloading the MYSQL database server to a remote database server.

http://assets.nagios.com/downloads/nagi ... Server.pdf

Thinking that the local MYSQL database was no longer needed, I shut it down on the local NagiosXI server.

I now see the following in the /var/log/messages log.

Code: Select all

May 30 06:25:09 nagios1 snmptt-sys[0]: MySQL error: Unable to connect to database: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
It seems that snmptt is still using the local MYSQL database. I could just turn the local MYSQL server back on, but I would rather have it use the remote database server, as well.

I have found where to change the settings in 'snmptt.ini' to point it to a remote MYSQL database server, but I am wondering where the data will go. Does it use an existing database/table(s), or do I have to export a database/table(s) from the old localhost database on the NagiosXi server? Or create a new database/tables on the new remote server?

Is there anything else, that is not mentioned in the above document, that may still be using the local MYSQL database?


Thank you,

Paul
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: Remote MYSQL Server and snmptt

Post by nscott »

If you turn logging off on snmptt it doesn't go anywhere. However, just because you disable the mysql_dbi entry in the snmptt.ini doesn't mean it isn't logging anymore. If you have you have logging turned and have a file specified in the snmptt it will log to that file.
Nicholas Scott
Former Nagios employee
pnnagios
Posts: 47
Joined: Wed Dec 14, 2011 9:48 am

Re: Remote MYSQL Server and snmptt

Post by pnnagios »

I would like to continue having it log to the MYSQL server, and just use the remote one, instead of the local one. I can change the 'snmptt.ini' file, so that it logs to the remote MYSQL database instead (which I know how to do), but I am not sure if I have to do anything to the remote MYSQL server itself. i.e. Add/export another database or table(s), or does it use a table in one of the databases (nagios, nagiosql) that were already exported to the remote server, in the document?

Thank you,

Paul
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: Remote MYSQL Server and snmptt

Post by nscott »

No it does not use a table already incorporated into nagios or nagiosql. You'll need to load the schema into your external nagios database, which is located here:

http://snmptt.sourceforge.net/docs/snmp ... base-MySQL

And then setup the host/password information in snmptt.ini
Nicholas Scott
Former Nagios employee
pnnagios
Posts: 47
Joined: Wed Dec 14, 2011 9:48 am

Re: Remote MYSQL Server and snmptt

Post by pnnagios »

snmptt is now logging on the remote MYSQL server.
Thank you for the information on the snmptt database schema.

Paul
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: Remote MYSQL Server and snmptt

Post by nscott »

Of course paul, have fun with those snmp traps ;)
Nicholas Scott
Former Nagios employee
btmikkelsen
Posts: 38
Joined: Wed Feb 23, 2011 10:29 am

Re: Remote MYSQL Server and snmptt

Post by btmikkelsen »

browsing this forum and noticed your post. I had a similar problem when I implemented the remote mysql dbs. I also found the nagios xi updates don't correctly retain the remote database setup. What I do when I'm ugrading is run 2 commands one to forward all local mysql traffic, and the other to "fake" out the portions that use the mysql socket -

ssh -Nn -o ExitOnForwardFailure=yes -o ControlMaster=yes -L 3306:localhost:3306 remoteDBserver
socat UNIX-LISTEN:/var/lib/mysql/mysql.sock,fork,user=mysql,group=mysql,mode=777 TCP:localhost:3306

by the way - the upgrades usually work correctly to retain the ndo2db.cfg nagiosxi/html/config.inc.php but have never retained QL - /var/www/html/nagiosql/config/settings.php. The commands above relieve some pressure of trying to hack it back alive after an update, though.

you could use this until you get that snmptt issue resolved. You'd have to figure out what db objects it needed and move them from local to remote.
Locked