We are having a trouble importing host configuration file. We have created host configuration files and placed it under /usr/local/nagios/etc/import/ folder. And then we tried to run ./reconfigure_nagios.sh from /usr/local/nagiosxi/scripts/ folder. The script shows that the configuration file successfully imported and restart the nagios. But when I check the host in the Nagios XI gui and nagios database, it doesn't exist. These are new hosts (they don't exist in nagios) and we tried to import them as a bulk configuration. The problem seems to be exist in our both production and test environment.
But if we copy a existing hosts configuration file under ../etc/import and import it after making small changes to it, the changes seems to be applied in the Nagios.
I checked the logs and it doesn't give any errors where it is failing. It used to work before. But since then we have upgraded the Nagios to 2014R1.4 and mysql server to (mysql Ver 14.14 Distrib 5.6.20,)
System Details
----------------
CentOS Linux release 6.0 (Final)
Kernel \r on an \m
==================================
Nagios Virtual Machine Information
==================================
And database is on SUSE Linux Enterprise Server 11 SP1
here is the example of host configuration file:
Code: Select all
define host {
host_name kwtvmm004
use srv-test-template
alias kwtvmm004
address kwtvmm004
hostgroups srv-c-windows-test
icon_image win_server.png
parents kvmlgagx001,kvmlgagx002
register 1
}All the template, service, parent host are already defined in the nagios.
Here is the output of the ./reconfigure_nagios.sh
Code: Select all
kapnxi001:/usr/local/nagiosxi/scripts # ./reconfigure_nagios.sh
URL: http://localhost/nagiosxi/includes/components/ccm/
CMDLINE
/usr/bin/wget --save-cookies nagiosql.cookies --keep-session-cookies http://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'submit=Login&hidelog=true&loginSubmitted=true&username=nagiosxi&password=<password-defined-here>' -O nagiosql.login--2015-01-30 09:49:45-- http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: “nagiosql.login”
[ <=> ] 11,662 --.-K/s in 0.02s
2015-01-30 09:49:46 (598 KB/s) - “nagiosql.login” saved [11662]
LOGIN SUCCESSFUL!
IMPORTING CONFIG FILES...URL: http://localhost/nagiosxi/includes/components/ccm/
Array
(
[0] => kwtvmm004.cfg
)
IMPORTING [color=#BF0000]/usr/local/nagios/etc/import/kwtvmm004.cfg[/color]
CMDLINE:
/usr/bin/wget --load-cookies=nagiosql.cookies http://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'cmd=admin&type=import&importsubmitted=true&chbOverwrite=1&selImportFile[]=/usr/local/nagios/etc/import/kwtvmm004.cfg' -O nagiosql.import.monitoring
--2015-01-30 09:49:46-- http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: “nagiosql.import.monitoring”
[ <=> ] 684,901 666K/s in 1.0s
2015-01-30 09:49:47 (666 KB/s) - “nagiosql.import.monitoring” saved [684901]
SETUID ROOT OK
RESETTING PERMS
URL: http://localhost/nagiosxi/includes/components/ccm/
CMDLINE
/usr/bin/wget --save-cookies nagiosql.cookies --keep-session-cookies http://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'submit=Login&hidelog=true&loginSubmitted=true&username=nagiosxi&password=<password-defined-here>' -O nagiosql.login--2015-01-30 09:49:48-- http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: “nagiosql.login”
[ <=> ] 11,662 --.-K/s in 0.008s
2015-01-30 09:49:48 (1.36 MB/s) - “nagiosql.login” saved [11662]
LOGIN SUCCESSFUL!
URL: http://localhost/nagiosxi/includes/components/ccm/
CMDLINE:
/usr/bin/wget --load-cookies=nagiosql.cookies http://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'cmd=apply&type=writeConfig' -O nagiosql.export.monitoring
--2015-01-30 09:49:48-- http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: “nagiosql.export.monitoring”
[ <=> ] 14,514 6.13K/s in 19s
2015-01-30 09:50:07 (775 B/s) - “nagiosql.export.monitoring” saved [14514]
WRITE CONFIGS SUCCESSFUL!
OUTPUT:
Nagios Core 4.0.8
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2014
License: GPL
Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Warning: Duplicate definition found for service 'SNMP Traps' on host 'kzplnkap101' (config file '/usr/local/nagios/etc/services/fst-p-snmp-trap.cfg', starting on line 14)
Warning: Duplicate definition found for service 'SNMP Traps' on host 'kzplnkap104' (config file '/usr/local/nagios/etc/services/fst-p-snmp-trap.cfg', starting on line 14)
Warning: Duplicate definition found for service 'SNMP Traps' on host 'kzplnkap102' (config file '/usr/local/nagios/etc/services/fst-p-snmp-trap.cfg', starting on line 14)
Warning: Duplicate definition found for service 'SNMP Traps' on host 'kzplnkap103' (config file '/usr/local/nagios/etc/services/fst-p-snmp-trap.cfg', starting on line 14)
Warning: Duplicate definition found for service 'SNMP Traps' on host 'kzplnkdx001' (config file '/usr/local/nagios/etc/services/fst-p-snmp-trap.cfg', starting on line 14)
Read object config files okay...
Running pre-flight check on configuration data...
Checking objects...
Warning: Service 'Ping Dummy' on host 'kauto400' has no default contacts or contactgroups defined!
Warning: Service 'Ping Dummy' on host 'kwpkdw001' has no default contacts or contactgroups defined!
Warning: Service 'Ping Dummy' on host 'kwpkdw002' has no default contacts or contactgroups defined!
Warning: Service 'Ping Dummy' on host 'kwpkdw003' has no default contacts or contactgroups defined!
Warning: Service 'Ping Dummy' on host 'kwpkdw004' has no default contacts or contactgroups defined!
Warning: Service 'Ping Dummy' on host 'kwpkdw005' has no default contacts or contactgroups defined!
Warning: Service 'Ping Dummy' on host 'kwpkdw01' has no default contacts or contactgroups defined!
Warning: Service 'Ping Dummy' on host 'sy5' has no default contacts or contactgroups defined!
Warning: Service 'Ping Dummy' on host 'sy8' has no default contacts or contactgroups defined!
Checked 11868 services.
Warning: Host 'kauto400' has no default contacts or contactgroups defined!
Warning: Host 'kutnrc001' has no default contacts or contactgroups defined!
Warning: Host 'kvmlgrpdu14l' has no default contacts or contactgroups defined!
Warning: Host 'kvmlgrpdu22L' has no default contacts or contactgroups defined!
Warning: Host 'kwpkdw001' has no default contacts or contactgroups defined!
Warning: Host 'kwpkdw002' has no default contacts or contactgroups defined!
Warning: Host 'kwpkdw003' has no default contacts or contactgroups defined!
Warning: Host 'kwpkdw004' has no default contacts or contactgroups defined!
Warning: Host 'kwpkdw005' has no default contacts or contactgroups defined!
Warning: Host 'kwpkdw01' has no default contacts or contactgroups defined!
Warning: Host 'sy5' has no default contacts or contactgroups defined!
Warning: Host 'sy8' has no default contacts or contactgroups defined!
Checked 4876 hosts.
Checked 144 host groups.
Checked 0 service groups.
Checked 255 contacts.
Checked 48 contact groups.
Checked 152 commands.
Checked 17 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 4876 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 17 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 21
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
RET: 0
Running configuration check...done.
Stopping nagios: .done.
Starting nagios: done.Also followed the instruction give this documents, but didn't work:
http://assets.nagios.com/downloads/nagi ... ios-XI.pdf
http://assets.nagios.com/downloads/nagi ... p-Tool.pdf
We need help to find out why it is not working anymore?
I tried checking all the logs but no luck. Is there any specific logs I need to check?
How can we fix this?
Regards
Zubair