Page 1 of 3

how to migrate nagios from one server to another server

Posted: Thu Jul 30, 2015 2:36 pm
by sinkak
i installed
sudo apt-get install nagios-nrpe-server

sudo apt-get install nagios3 nagios-nrpe-plugin

on new server then scp all config files from old server to new server scp -r nagios3 ubuntu@newserver:/etc/nagios3

scp -r nagios_api_app ubuntu@newserver:/usr/local/

i changed password sudo htpasswd -c /etc/nagios3/htpasswd.users admin

and changed permissions

drwxr-xr-x 2 nagios nagios nagios

drwxr-x--x 4 nagios nagios nagios3

grep nag /etc/group nagios:x:111:www-data

sudo service apache2 restart

sudo /etc/init.d/nagios3 stop

sudo /etc/init.d/nagios3 start

getting error

Warning: Duplicate definition found for service 'SSH' on host 'cacheserver20.wsa. local' (config file '/etc/nagios3/conf.d/services_nagios2.cfg', starting on line
11)

Warning: Duplicate definition found for service 'HTTP' on host 'webserver01.wsa.l ocal' (config file '/etc/nagios3/conf.d/services_nagios2.cfg', starting on line 2
)

Warning: Duplicate definition found for service 'Check time offset with DC01' on host 'weblinux01.wsa.local' (config file '/etc/nagios3/conf.d/weblinux-servers/we blinuxes.cfg', starting on line 75)

Warning: Duplicate definition found for service 'SSH' on host 'monitoring02.wsa.l ocal' (config file '/etc/nagios3/conf.d/services.cfg', starting on line 30)

Warning: Duplicate definition found for service 'SSH' on host 'cacheserver23.wsa. local' (config file '/etc/nagios3/conf.d/services.cfg', starting on line 30) Warning: Duplicate definition found for service 'SSH' on host 'cacheserver11.wsa. local' (config file '/etc/nagios3/conf.d/services.cfg', starting on line 30) Warning: Duplicate definition found for service 'SSH' on host 'cacheserver10.wsa. local' (config file '/etc/nagios3/conf.d/services.cfg', starting on line 30) Warning: Duplicate definition found for service 'SSH' on host 'cacheserver21.wsa. local' (config file '/etc/nagios3/conf.d/services.cfg', starting on line 30) Warning: Duplicate definition found for service 'Check time offset with DC01' on host 'webserver09.wsa.local' (config file '/etc/nagios3/conf.d/services.cfg', sta rting on line 38)

Error: Service check command 'check_nrpe_args' specified in service 'Free memory' for host 'ips06.wsa.local' no t defined anywhere!

Error: Service check command 'check_nrpe_args' specified in service 'Swap Usage' for host 'ips06.wsa.local' not defined anywhere! Error: Service check command 'check_nrpe_args' specified in service 'Total Processes' for host 'ips06.wsa.local
' not defined anywhere! Error: Service check command 'check_nrpe_args' specified in service 'Check SYN Flood' for host 'logs.wsa.local'
not defined anywhere! Error: Service check command 'check_nrpe_args' specified in service 'Check_auditd' for host 'logs.wsa.local' no
t defined anywhere! Error: Service check command 'check_nrpe_args' specified in service 'Current Load' for host 'logs.wsa.local' not defined anywhere!

dont know why

please help

Re: how to migrate nagios from one server to another server

Posted: Thu Jul 30, 2015 3:26 pm
by jdalrymple
Sounds like you didn't grab some command definitions from your old install. Also this is clearly not a NagiosXI problem but a Core problem, can we move it to the appropriate forum?

You can find all of the included config files from your old setup by doing a

Code: Select all

[root@localhost etc]# grep ^cfg_ nagios.cfg
cfg_dir=/usr/local/nagios/etc/static
cfg_file=/usr/local/nagios/etc/contacttemplates.cfg
cfg_file=/usr/local/nagios/etc/contactgroups.cfg
cfg_file=/usr/local/nagios/etc/contacts.cfg
cfg_file=/usr/local/nagios/etc/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/commands.cfg
cfg_file=/usr/local/nagios/etc/hostgroups.cfg
cfg_file=/usr/local/nagios/etc/servicegroups.cfg
cfg_file=/usr/local/nagios/etc/hosttemplates.cfg
cfg_file=/usr/local/nagios/etc/servicetemplates.cfg
cfg_file=/usr/local/nagios/etc/servicedependencies.cfg
cfg_file=/usr/local/nagios/etc/serviceescalations.cfg
cfg_file=/usr/local/nagios/etc/hostdependencies.cfg
cfg_file=/usr/local/nagios/etc/hostescalations.cfg
cfg_file=/usr/local/nagios/etc/hostextinfo.cfg
cfg_file=/usr/local/nagios/etc/serviceextinfo.cfg
cfg_dir=/usr/local/nagios/etc/hosts
cfg_dir=/usr/local/nagios/etc/services

Re: how to migrate nagios from one server to another server

Posted: Thu Jul 30, 2015 4:39 pm
by sinkak
Sorry. Couldnt find the appropriate forum. thats y i posted here.

Re: how to migrate nagios from one server to another server

Posted: Fri Jul 31, 2015 9:07 am
by jdalrymple
That's no problem, we can move it to Core easy enough.

Was my advice useful in solving your problem? Did you find your missing command definitions?

Re: how to migrate nagios from one server to another server

Posted: Fri Jul 31, 2015 12:27 pm
by sinkak
i have problems connecting to the server.
as soon i connect i will post the result here.

Thank You

Re: how to migrate nagios from one server to another server

Posted: Fri Jul 31, 2015 12:51 pm
by jolson
Sounds good - let us know what you find out.

Re: how to migrate nagios from one server to another server

Posted: Mon Aug 03, 2015 10:12 am
by sinkak
both have same files

old server
monitoring:/etc/nagios3$ grep ^cfg_ nagios.cfg
cfg_file=/etc/nagios3/commands.cfg
cfg_dir=/etc/nagios-plugins/config
cfg_dir=/etc/nagios3/conf.d


new server
@ip-new:/etc/nagios3$ grep ^cfg_ nagios.cfg
cfg_file=/etc/nagios3/commands.cfg
cfg_dir=/etc/nagios-plugins/config
cfg_dir=/etc/nagios3/conf.d

Re: how to migrate nagios from one server to another server

Posted: Mon Aug 03, 2015 11:31 am
by jdalrymple
Well, the validation output is pretty clear about the problem:
sinkak wrote:

Code: Select all

Error: Service check command 'check_nrpe_args' specified in service 'Free memory' for host 'ips06.wsa.local' no t defined anywhere!
Can you find this command definition anywhere?

Re: how to migrate nagios from one server to another server

Posted: Mon Aug 03, 2015 1:28 pm
by sinkak
i couldnt find that command.
i gave up this method, deleted this files.
i am installing from scratch again.
may be add each host individually to config files.

Re: how to migrate nagios from one server to another server

Posted: Mon Aug 03, 2015 2:30 pm
by jdalrymple
Adding the command definition should be trivial, 4 lines. In addition if your old server still exists it should be easy to find. Unless you really really need to I wouldn't rebuild from scratch.