Manually restore the nagios(xi)db(s)

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
benhank
Posts: 1264
Joined: Tue Apr 12, 2011 12:29 pm

Manually restore the nagios(xi)db(s)

Post by benhank »

hey fellas!
i need to figure export Nagios's DB and restore it to another. I saw documentation that detailed this a while ago, but cant find it now. I'm trying to do this on 2014 version.
Proudly running:
NagiosXI 5.4.12 2 node Prod Env 2500 hosts, 13,000 services
Nagiosxi 5.5.7(test env) 2500 hosts, 13,000 services
Nagios Logserver 2 node Prod Env 500 objects sending
Nagios Network Analyser
Nagios Fusion
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Manually restore the nagios(xi)db(s)

Post by rkennedy »

Just to make sure, do you know if the server is actually utilizing MySQL? I believe 2014 still used Postgres.
Former Nagios Employee
User avatar
benhank
Posts: 1264
Joined: Tue Apr 12, 2011 12:29 pm

Re: Manually restore the nagios(xi)db(s)

Post by benhank »

Yeah I think it uses both
Proudly running:
NagiosXI 5.4.12 2 node Prod Env 2500 hosts, 13,000 services
Nagiosxi 5.5.7(test env) 2500 hosts, 13,000 services
Nagios Logserver 2 node Prod Env 500 objects sending
Nagios Network Analyser
Nagios Fusion
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Manually restore the nagios(xi)db(s)

Post by ssax »

To backup MySQL to file:

Code: Select all

mysqldump -uroot -pnagiosxi --add-drop-database nagios > /tmp/nagios_export.sql
mysqldump -uroot -pnagiosxi --add-drop-database nagiosql > /tmp/nagiosql_export.sql
To restore MySQL from file:

Code: Select all

mysql -uroot -pnagiosxi nagios < /tmp/nagios_export.sql
mysql -uroot -pnagiosxi nagiosql < /tmp/nagiosql_export.sql
To backup PostgreSQL to file:

Code: Select all

pg_dump -c -U nagiosxi nagiosxi > /tmp/nagiosxi_export.sql
To restore PostgreSQL from file:

Code: Select all

psql nagiosxi nagiosxi < /tmp/nagiosxi_export.sql
User avatar
benhank
Posts: 1264
Joined: Tue Apr 12, 2011 12:29 pm

Re: Manually restore the nagios(xi)db(s)

Post by benhank »

ok thanks ! dont lock it till I test ok?
Proudly running:
NagiosXI 5.4.12 2 node Prod Env 2500 hosts, 13,000 services
Nagiosxi 5.5.7(test env) 2500 hosts, 13,000 services
Nagios Logserver 2 node Prod Env 500 objects sending
Nagios Network Analyser
Nagios Fusion
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Manually restore the nagios(xi)db(s)

Post by hsmith »

Sounds good. :)
Former Nagios Employee.
me.
User avatar
benhank
Posts: 1264
Joined: Tue Apr 12, 2011 12:29 pm

Re: Manually restore the nagios(xi)db(s)

Post by benhank »

ok cool the export worked thanks guys!
Proudly running:
NagiosXI 5.4.12 2 node Prod Env 2500 hosts, 13,000 services
Nagiosxi 5.5.7(test env) 2500 hosts, 13,000 services
Nagios Logserver 2 node Prod Env 500 objects sending
Nagios Network Analyser
Nagios Fusion
Locked