Page 1 of 1

NagiosXI Service Dependency issue with import...

Posted: Tue Oct 16, 2018 2:14 am
by vishfx
Hi Team,

Facing the below issue :

1) Apply changes failed after : cp CFCS_sd_vms.cfg /usr/local/nagios/etc/import

Code: Select all

Error: Could not expand dependent service(s) (at config file '/usr/local/nagios/etc/servicedependencies.cfg', starting on line 196)
2) Even after disabling the service dependencies in CCM , still apply changes fail.

3) Nagios core validation passed after : cp CFCS_sd_vms.cfg /usr/local/nagios/etc/static

Code: Select all

[nagios@localhost sd_work]$ ls -l /usr/local/nagios/etc/static/
total 148
-rw-rw-r-- 1 nagios nagios 142038 Oct 16 02:52 CFCS_sd_vms.cfg
-rwxrwxr-x 1 apache nagios    878 Mar 13  2018 xiobjects.cfg
-rwxrwxr-x 1 apache nagios   4002 Mar 13  2018 xitemplates.cfg
-rwxrwxr-x 1 apache nagios      0 Mar 13  2018 xitest.cfg

[nagios@localhost sd_work]$ /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Nagios Core 4.2.4
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 12-07-2016
License: GPL
Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
        Checked 6183 services.
Warning: Host 'CFCS_PROMETHEUS_NODE1' has no default contacts or contactgroups defined!
        Checked 56 hosts.
        Checked 14 host groups.
        Checked 6 service groups.
        Checked 3 contacts.
        Checked 3 contact groups.
        Checked 145 commands.
        Checked 8 time periods.
        Checked 0 host escalations.
        Checked 0 service escalations.
Checking for circular paths...
        Checked 56 hosts
        Checked 2476 service dependencies
        Checked 0 host dependencies
        Checked 8 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 1
Total Errors:   0

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

Re: NagiosXI Service Dependency issue with import...

Posted: Tue Oct 16, 2018 9:38 am
by lmiltchev
What is your objective? Do you want to manage these hosts/services in the CCM or you want to manage them "manually" (keep them in the static directory)? If you imported them to the DB, then you would need to remove them from the static...

Do you see any errors in the GUI, when you try to write configs, and verify files?

CCM > Tools > Config File Management > Write Configs > Verify Files

Re: NagiosXI Service Dependency issue with import...

Posted: Wed Oct 17, 2018 10:28 am
by vishfx
The objective is to maintain some files like service dependency manually.

Below is the output from writeconfig:

Code: Select all

Write host configurations ...
Host configuration files successfully written!

Write service configurations ...
Service configuration files successfully written!

Configuration file: hostgroups.cfg successfully written!
Configuration file: servicegroups.cfg successfully written!
Configuration file: hosttemplates.cfg successfully written!
Configuration file: servicetemplates.cfg successfully written!
Configuration file: timeperiods.cfg successfully written!
Configuration file: commands.cfg successfully written!
Configuration file: contacts.cfg successfully written!
Configuration file: contactgroups.cfg successfully written!
Configuration file: contacttemplates.cfg successfully written!
Configuration file: servicedependencies.cfg successfully written!
Configuration file: hostdependencies.cfg successfully written!
Configuration file: serviceescalations.cfg successfully written!
Configuration file: hostescalations.cfg successfully written!
Configuration file: serviceextinfo.cfg successfully written!
Configuration file: hostextinfo.cfg successfully written!



Below is the output from verify config :

Code: Select all

Nagios Core 4.2.4 
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors 
Copyright (c) 1999-2009 Ethan Galstad 
Last Modified: 12-07-2016 
License: GPL 

Website: https://www.nagios.org 
Reading configuration data... 
Read main config file okay... 
Read object config files okay... 

Running pre-flight check on configuration data... 

Checking objects... 
Checked 6210 services. 
Warning: Host 'CFCS_PROMETHEUS_NODE1' has no default contacts or contactgroups defined! 
Checked 58 hosts. 
Checked 16 host groups. 
Checked 6 service groups. 
Checked 3 contacts. 
Checked 3 contact groups. 
Checked 145 commands. 
Checked 8 time periods. 
Checked 0 host escalations. 
Checked 0 service escalations. 
Checking for circular paths... 
Checked 58 hosts 
Checked 2476 service dependencies 
Checked 0 host dependencies 
Checked 8 timeperiods 
Checking global event handlers... 
Checking obsessive compulsive processor commands... 
Checking misc settings... 

Total Warnings: 1 
Total Errors: 0 

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

Re: NagiosXI Service Dependency issue with import...

Posted: Wed Oct 17, 2018 10:46 am
by lmiltchev
You do not have any config errors, so you should be able to apply configuration successfully. Are you having any issues with applying configuration at the moment?

Re: NagiosXI Service Dependency issue with import...

Posted: Wed Oct 17, 2018 7:12 pm
by vishfx
Yes, the issue am facing is that if the dependency file is kept under "static" folder no errors :

Code: Select all

Nagios Core 4.2.4 
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors 
Copyright (c) 1999-2009 Ethan Galstad 
Last Modified: 12-07-2016 
License: GPL 

Website: https://www.nagios.org 
Reading configuration data... 
Read main config file okay... 
Read object config files okay... 

Running pre-flight check on configuration data... 

Checking objects... 
Checked 6210 services. 
Checked 58 hosts. 
Checked 16 host groups. 
Checked 6 service groups. 
Checked 3 contacts. 
Checked 3 contact groups. 
Checked 145 commands. 
Checked 8 time periods. 
Checked 0 host escalations. 
Checked 0 service escalations. 
Checking for circular paths... 
Checked 58 hosts 
Checked 2356 service dependencies 
Checked 0 host dependencies 
Checked 8 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
However when the same file is kept in "import" folder I get the below error :
But nothing seems to have been added yet in /usr/local/nagios/etc/servicedependencies.cfg

Error: Could not expand dependent service(s) (at config file '/usr/local/nagios/etc/servicedependencies.cfg', starting on line 184)

Re: NagiosXI Service Dependency issue with import...

Posted: Thu Oct 18, 2018 10:28 am
by lmiltchev
You shouldn't be putting these configs in the import directory... You said:
The objective is to maintain some files like service dependency manually.
If you are planning to manage service dependencies manually (keep configs in the static), then you would need to remove them from the CCM...

CCM > Advanced > Service Dependencies > <dependency> > Delete > Apply Configuration

Note: Make sure you delete all of the service dependencies from the CCM before applying configuration.

Re: NagiosXI Service Dependency issue with import...

Posted: Wed Oct 24, 2018 10:28 pm
by vishfx
The whole idea of putting service dependencies in import was they could be managed from CCM ( modify/delete ) etc...

Logically it doesn't make sense if static works , why would import fail ?

Regards,
Vish.

Re: NagiosXI Service Dependency issue with import...

Posted: Thu Oct 25, 2018 9:38 am
by lmiltchev
My understanding was that you didn't want to manage service dependencies in the CCM, but rather "manually". Anyway, if the import is failing, this means that you have something in the DB that is causing the issue.

Go to the CCM > Tools Config File Management, and click on "Delete Files", "Write Configs", and "Verify Files" in exact same order, and check for config errors. Are you seeing the same error as before?
Error: Could not expand dependent service(s) (at config file '/usr/local/nagios/etc/servicedependencies.cfg', starting on line 184)
What do you have on line 184 in the servicedependencies.cfg?

If you are not able to figure this out by reviewing the errors in the output, I would recommend that you open a support ticket via our support center here: https://support.nagios.com/tickets/, and provide your latest profile in the ticket.

Admin > System Config > System Profile > Download Profile

Re: NagiosXI Service Dependency issue with import...

Posted: Mon Oct 29, 2018 10:39 pm
by vishfx
I'll stick to keeping servicedependencies in static.

you can close this ticket.

Thanks for the support.

Regards,
Vish.