Page 1 of 1

Configuration verification failed.I have edit file by hand

Posted: Mon Aug 07, 2017 11:58 am
by Zagon007
Hi,
I have an error when I try to apply configuration :Configuration verification failed.

Error: Could not add object property in file '/usr/local/nagios/etc/contacts.cfg' on line 64.
Error: Service notification period 'K134_notification_times' specified for contact 'k134' is not defined anywhere!
Error: Could not register contact (config file '/usr/local/nagios/etc/contacts.cfg', starting on line 16)

I edit this file by hand and now Nagios xi give me error.

I am using the vmware nagiosxi-5.4.4-64.ova image,
How can I do for recognize/replace/recreate the contact file and time period from nagios xi?

Help me..

thank you in advance.

Walter

Re: Configuration verification failed.I have edit file by ha

Posted: Mon Aug 07, 2017 12:37 pm
by bolson
Run this command and post the result:

Code: Select all

cat /usr/local/nagios/etc/contacts.cfg

Re: Configuration verification failed.I have edit file by ha

Posted: Tue Aug 08, 2017 7:21 am
by Zagon007

Code: Select all

[root@LXRP-NAGIOSXI ~]# cat /usr/local/nagios/etc/contacts.cfg
###############################################################################
#
# Contact configuration file
#
# Created by: Nagios Core Config Manager 2.6.5
# Date:       2017-08-07 17:18:00
# 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 contact {
        contact_name                            k13486
        alias                                   Domenico Romano
        host_notifications_enabled              1
        service_notifications_enabled           1
        host_notification_period                k13486_notification_times
        service_notification_period             k13486_notification_times
        host_notification_options               d,u,r,f,s
        service_notification_options            w,u,c,r,f,s
        email                                   [email protected]
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            nagiosadmin-sed
        alias                                   Nagios Administrator Sed
        host_notifications_enabled              1
        service_notifications_enabled           1
        host_notification_period                nagiosadmin_notification_times
        service_notification_period             nagiosadmin_notification_times
        host_notification_options               d,u,r,s,
        service_notification_options            w,c,r,
        host_notification_commands              xi_host_notification_handler
        service_notification_commands           xi_service_notification_handler
        email                                   [email protected]
        address1                                nagios@localhost
        use                                     xi_contact_generic
        }

define contact {
        contact_name                            nagiosxi
        alias                                   nagiosxi
        host_notifications_enabled              1
        service_notifications_enabled           1
        host_notification_period                nagiosxi_notification_times
        service_notification_period             nagiosxi_notification_times
        host_notification_options               d,u,r,f,s,
        service_notification_options            w,u,c,r,f,s,
        email                                   [email protected]
        use                                     xi_contact_generic
        }

###############################################################################
#
# Contact configuration file
#
# END OF FILE
#
###############################################################################
When I try to apply you the changes as a result that it can not modify lines beyond the end that there are no more

Re: Configuration verification failed.I have edit file by ha

Posted: Tue Aug 08, 2017 1:07 pm
by bolson
This command should help you identify issues with your configuration:

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Re: Configuration verification failed.I have edit file by ha

Posted: Tue Aug 08, 2017 11:52 pm
by Zagon007
Hi Braian,
There are no serious mistakes.

I think my problem is due only to the fact that sql or nagios xi does not recognize the contacts.cfg file because I modified it by hand.

Is there no way to get this file back to its original state or recreate it from scratch?

I can not believe my project goes into smoke for a file :|

Reading configuration data...
Read main config file okay...
Warning: Duplicate definition found for service 'Uptime' on host 'WP-SWDIPOS-DB01' (config file '/usr/local/nagios/etc/services/WP-SWDIPOS-DB01.cfg', starting on line 95)
Warning: Duplicate definition found for service 'Ping' on host 'WP-SWDIPOS-DB01' (config file '/usr/local/nagios/etc/services/WP-SWDIPOS-DB01.cfg', starting on line 80)
Warning: Duplicate definition found for service 'Memory Usage' on host 'WP-SWDIPOS-DB01' (config file '/usr/local/nagios/etc/services/WP-SWDIPOS-DB01.cfg', starting on line 48)
Warning: Duplicate definition found for service 'Drive C: Disk Usage' on host 'WP-SWDIPOS-DB01' (config file '/usr/local/nagios/etc/services/WP-SWDIPOS-DB01.cfg', starting on line 32)
Warning: Duplicate definition found for service 'CPU Usage' on host 'WP-SWDIPOS-DB01' (config file '/usr/local/nagios/etc/services/WP-SWDIPOS-DB01.cfg', starting on line 16)
Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
Checked 67 services.
Checked 6 hosts.
Checked 3 host groups.
Checked 0 service groups.
Checked 4 contacts.
Checked 2 contact groups.
Checked 125 commands.
Checked 10 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 6 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 10 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check

Re: Configuration verification failed.I have edit file by ha

Posted: Wed Aug 09, 2017 4:53 am
by Zagon007
if I run ./reconfigure_nagios.sh

Reading configuration data...
Read main config file okay...
Warning: Duplicate definition found for contact 'xi_default_contact' (config file '/usr/local/nagios/etc/contacts.cfg', starting on line 56)
Error: Could not add object property in file '/usr/local/nagios/etc/contacts.cfg' on line 57.
Error: Service notification period 'nagiosadmin_notification_times' specified for contact 'nagiosadmin' is not defined anywhere!
Error: Could not register contact (config file '/usr/local/nagios/etc/contacts.cfg', starting on line 27)
Error processing object config files!

Re: Configuration verification failed.I have edit file by ha

Posted: Wed Aug 09, 2017 10:06 am
by bolson
If your installation files still exist in your /tmp folder, you can find the file at:

Code: Select all

/tmp/nagiosxi/subcomponents/nagioscore/nagios-4.2.4/sample-config/template-object/contacts.cfg

Re: Configuration verification failed.I have edit file by ha

Posted: Thu Aug 10, 2017 4:14 am
by Zagon007
Thanks a lot for your support,
don't find These files, but I found a handwritten backup of the contacts.cfg that I had made before the changes.
Copying or importing it however does not work the same.
what I do for work?

Re: Configuration verification failed.I have edit file by ha

Posted: Thu Aug 10, 2017 7:18 am
by Zagon007
when I apply config :
Backend login to the Core Config Manager failed

Re: Configuration verification failed.I have edit file by ha

Posted: Thu Aug 10, 2017 10:01 am
by bolson
Please run the following command and post the result.

Code: Select all

su nagios
cd /usr/local/nagiosxi/scripts
./reconfigure_nagios.sh
Also read this document regarding the error. It's likely that the NagiosXI instance is unable to resolve "localhost"

https://support.nagios.com/kb/article.php?id=532

And please post the output of this command:

Code: Select all

cat /etc/hosts