Page 1 of 1
Split Nagios XI databases from application
Posted: Thu Nov 22, 2012 2:23 pm
by activenodes
Hello everyone,
I am wondering if we could split the host databases (MySQL and PostgreSQL) to another host.
Is everything hardcoded in the Nagios XI server to only look for databases at the localhost?
if not, please can anyone suggest or guide in what would be required to modify?
We just want to do two things for fine tune the setup:
Isolate the databases (MySQL and PostgreSQL)
NFS mount the /store/backups folder to keep it isolated from the host.
Can we create multiple Nagios XI servers (1-3 per license allowed) pointing to a single database (fully replicated: master and slave)?
Or is there any other 'solution' that we can use (reliable and proven) to have a proper setup?
Any help/recommendations/suggestions are welcome.

Re: Split Nagios XI databases from application
Posted: Thu Nov 22, 2012 4:28 pm
by arnab.roy
You can look at this,
Code: Select all
http://assets.nagios.com/downloads/nagiosxi/docs/Offloading_MySQL_to_Remote%20Server.pdf
Re: Split Nagios XI databases from application
Posted: Fri Nov 23, 2012 8:56 am
by scottwilkerson
Thanks Arnab.roy!
Re: Split Nagios XI databases from application
Posted: Fri Nov 23, 2012 9:10 am
by activenodes
It works great. Thanks.
We are going to now create a slave-db for replication and move the /store/backups to an hfs drive.
Any issues you think that doing so could cause?
Some in our team is suggesting to use net-backup but I think it's simpler to just do the NFS trick.
Do anyone knows what changes are to be made (and where) to the backup scripts?
The bad thing about the monitoring services for MySQL is that has hardcoded in plain-text the connection settings for the mysql-server.
Can anyone tell us if we can use a login-config to avoid placing this sensitive-data in the services commands?
It is kind of 'not a good idea' to have this like this. Do you agree?
Re: Split Nagios XI databases from application
Posted: Fri Nov 23, 2012 9:24 am
by scottwilkerson
Most people place the sensitive data in their /usr/local/nagios/etc/resources.cfg as $USERn$ variable. Then you can replace the sensitive info in your check commands with the appropriate $USERn$
Re: Split Nagios XI databases from application
Posted: Fri Nov 23, 2012 11:11 am
by activenodes
Great. Doing that right now.

Re: Split Nagios XI databases from application
Posted: Fri Nov 23, 2012 11:55 am
by activenodes
It seems that something is missing:
> cat /usr/local/nagios/etc/resource.cfg
## Path to the plugins
$USER1$=/usr/local/nagios/libexec
## Path to event handlers
#$USER2$=/usr/local/nagios/libexec/eventhandlers
## Port for NSClient++
$USER7$=***
## Password for NSClient++
$USER8$=***
## MySQL Parameter(s):
$MYSQL_HOST$=1.2.3.4
$MYSQL_PORT$=3306
$MYSQL_USER$=nagios
$MYSQL_PASSWD$="mypassword"
check_mysql_health --hostname=$MYSQL_HOST$ --port=$MYSQL_PORT$ --username=$MYSQL_USER$ --password=$MYSQL_PASSWD$ --database=information_schema --mode uptime --warning 10: --critical 5:
CRITICAL - cannot connect to information_schema. Unknown MySQL server host '$' (2)
Can anyone tell us what is required for Nagios to load these variables?
Re: Split Nagios XI databases from application
Posted: Sat Nov 24, 2012 9:33 pm
by scottwilkerson
You can only use variables in resources.cfg that are $USERn$, so you should do like this:
Code: Select all
## Path to the plugins
$USER1$=/usr/local/nagios/libexec
## Path to event handlers
#$USER2$=/usr/local/nagios/libexec/eventhandlers
## Port for NSClient++
$USER7$=***
## Password for NSClient++
$USER8$=***
## MySQL Parameter(s):
$USER3$=1.2.3.4
$USER4$=3306
$USER5$=nagios
$USER6$="mypassword"
Then, change your check_mysql_health command to
Code: Select all
check_mysql_health --hostname=$USER3$ --port=$USER4$ --username=$USER5$ --password=$USER6$ --database=information_schema --mode uptime --warning 10: --critical 5: