Split Nagios xi databases from application

This support forum board is for support questions relating to Nagios xi, our flagship commercial network monitoring solution.
activenodes
Posts: 13
Joined: Thu Oct 04, 2012 10:27 am

Split Nagios xi databases from application

Post 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.
;)
User avatar
arnab.roy
Posts: 354
Joined: Sat Apr 30, 2011 10:24 am

Re: Split Nagios xi databases from application

Post by arnab.roy »

You can look at this,

Code: Select all

http://assets.nagios.com/downloads/nagiosxi/docs/Offloading_MySQL_to_Remote%20Server.pdf
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Split Nagios xi databases from application

Post by scottwilkerson »

Thanks Arnab.roy!
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
activenodes
Posts: 13
Joined: Thu Oct 04, 2012 10:27 am

Re: Split Nagios xi databases from application

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

Re: Split Nagios xi databases from application

Post 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$
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
activenodes
Posts: 13
Joined: Thu Oct 04, 2012 10:27 am

Re: Split Nagios xi databases from application

Post by activenodes »

Great. Doing that right now. ;)
activenodes
Posts: 13
Joined: Thu Oct 04, 2012 10:27 am

Re: Split Nagios xi databases from application

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

Re: Split Nagios xi databases from application

Post 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:
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart