Page 1 of 1

Bulk Host Cloning and Import doesn't work

Posted: Fri Jul 27, 2018 10:47 pm
by hchen
Dear Support,

We are having issue with the "Bulk Host Cloning and Import" feature, it looks like the host config file generated by Nagios is incomplete. Please see below for the details.

Please advise.

Thanks

***************************************************************************************************************
Nagios Core 4.4.1
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2018-06-25
License: GPL

Website: https://www.nagios.org
Reading configuration data...
Read main config file okay...
Error: Invalid max_check_attempts value for host 'mysalt.xxx.com'
Error: Could not register host (config file '/usr/local/nagios/etc/hosts/mysalt.xxx.com.cfg', starting on line 16)
Error processing object config files!


***> One or more problems was encountered while processing the config files...

Check your configuration file(s) to ensure that they contain valid
directives and data definitions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.

***************************************************************************************************************
Incomplete host config file:

###############################################################################
#
# Hosts configuration file
#
# Created by: Nagios CCM 2.7.0
# Date: 2018-07-27 20:25:20
# Version: Nagios Core 4.x
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################

define host {
host_name mysalt.xxx.com
use generic-host
address mysalt.xxx.com
register 1
}

###############################################################################
#
# Hosts configuration file
#
# END OF FILE
#
###############################################################################





Correct host config file looks like this:

###############################################################################
#
# Host configuration file
#
# Created by: Nagios Core Config Manager 2.6.5
# Date: 2017-03-16 15:44:57
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################

define host {
host_name app10.xxx.com
use xiwizard_linuxserver_host
address app10.xxx.com
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
contact_groups admins
notification_interval 60
notification_period 24x7
notifications_enabled 1
icon_image centos.png
statusmap_image centos.png
register 1
}

###############################################################################
#
# Host configuration file
#
# END OF FILE
#
###############################################################################

Re: Bulk Host Cloning and Import doesn't work

Posted: Mon Jul 30, 2018 8:06 am
by scottwilkerson
Could you send a screenshot of the screen where you are selecting the services in the wizard?

Re: Bulk Host Cloning and Import doesn't work

Posted: Mon Jul 30, 2018 12:08 pm
by hchen
scottwilkerson wrote:Could you send a screenshot of the screen where you are selecting the services in the wizard?

Thanks for the rely, just pm you the screenshot, basically I selected all items from another host, but it doesn't matter how many items you select, it will just fail.

Thanks

Re: Bulk Host Cloning and Import doesn't work

Posted: Mon Jul 30, 2018 12:15 pm
by scottwilkerson
Based on your screenshot you did not select the Name field which is the host_name and onle entered the address field, Name is required and it is the minimum required.

I admit, that this should be documented on the page better, and will request so from out developers

Can you try again selecting the Name field in the first dropdown.

Re: Bulk Host Cloning and Import doesn't work

Posted: Mon Jul 30, 2018 3:25 pm
by hchen
I tried to add the name field from the drop down list, in this case, it's the hostname. The result is the same. We never added name field before and it worked just fine. This feature was broken for the last 3 releases. I wonder whether you are able to re-produce it on your side.

Code: Select all

Error: Invalid max_check_attempts value for host 'mysalt.xxx.com'
Error: Could not register host (config file '/usr/local/nagios/etc/hosts/mysalt.xxx.com.cfg', starting on line 16)
   Error processing object config files!

Thanks

Re: Bulk Host Cloning and Import doesn't work

Posted: Mon Jul 30, 2018 3:38 pm
by scottwilkerson
After consulting with the developers about the cause of this, we did come up with a cause and that is the file format changes slightly in the newer versions and need to be re-written to be parsed correctyl.

Lets to the following. Remove the erroneous configs for the host/services, in the CCM.

Then

CCM -> Tools -> Config File Management
Delete Files
Write Configs
Verify Files
Restart Nagios Core

This will reset the configs

Now, the Bulks Host Import Wizard should work correctly.

Re: Bulk Host Cloning and Import doesn't work [solved]

Posted: Mon Jul 30, 2018 5:03 pm
by hchen
Great! It's working now. Really appreciate it.

Re: Bulk Host Cloning and Import doesn't work [solved]

Posted: Mon Jul 30, 2018 5:10 pm
by scottwilkerson
hchen wrote:Great! It's working now. Really appreciate it.
Glad to hear it is resolved!

Locking