Dependies with multi config files

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Dependies with multi config files

Postby MINT » Mon Nov 06, 2017 10:54 am

Hello,

First of all I am pretty new to nagios and really like the product.
My System is working as expected but I have one issue with testing the dependencies.

I took the servicedependency from the documentation and configured as described.
Code: Select all
define servicedependency{
   host_name         TRUNK
   service_description      check-host-alive
   dependent_host_name      Database
   dependent_service_description   Unprocessed_queued_alerts
   execution_failure_criteria   c
   notification_failure_criteria   w,u,c,p
   }


This is configured in TRUNK.cfg and the DATABASE Configuration is stored in DATABASE.cfg to have a better overview and usage of the config files.


I get the Error Message:
referenced host 'DATABASE' does not exist in TRUNK.cfg:11

This makes sense because DATABASE is defined in a different config file.
Is there a solution for this to use service dependency with multi config files?
In other words:
Is there a way to use the host "DATABASE" which is configured in DATABASE.cfg in the config file TRUNK.cfg?
MINT
 
Posts: 3
Joined: Mon Nov 06, 2017 10:02 am

Re: Dependies with multi config files

Postby mcapra » Mon Nov 06, 2017 12:24 pm

MINT wrote:I get the Error Message:
referenced host 'DATABASE' does not exist in TRUNK.cfg:11


What is the exact command you are running that is producing this error?

Can you also share your main Nagios configuration file? It's typically found here:
Code: Select all
/usr/local/nagios/etc/nagios.cfg
Former Nagios employee
http://www.mcapra.com/
User avatar
mcapra
 
Posts: 2892
Joined: Thu May 05, 2016 3:54 pm

Re: Dependies with multi config files

Postby dwhitfield » Mon Nov 06, 2017 1:57 pm

@MINT, if you could provide the info @mcapra is asking for, that would be great. If you don't want it public, feel free to PM me.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
dwhitfield
The Doctor
 
Posts: 3956
Joined: Wed Sep 21, 2016 10:29 am
Location: Nagios Enterprises, LLC

Re: Dependies with multi config files

Postby MINT » Wed Nov 08, 2017 4:31 am

Thanks for your investigation.
nagios.cfg is empty at the moment. I am still at testing.
The problem is caused because I use more then one service file to define services.
I define the services for each host in a single .cfg file.

Here is the full command: (changed some parts I don't want to share)
ca2.cfg:
Code: Select all
define service {
  service_description            Unprocessed_queued_alerts
  host_name                      CA2
  use                            generic-service-intervall15
  check_command                  check_oracle_count_of_stuck!PublicIPSlave!PrivatIpServer!nameoftheschema!SQLstatementtocheckalerts
  icon_image                     oracle.jpg
  process_perf_data              1
}
#dependency
define servicedependency{
   host_name         TRUNK/US11
   service_description      check-host-alive
   dependent_host_name      CA2
   dependent_service_description   Unprocessed_queued_alerts
   execution_failure_criteria   c
   notification_failure_criteria   w,u,c,p
   }


US11.cfg:
Code: Select all
define host {
  host_name                      US11
  alias                          TRUNK/US11
  address                        52.6.132.96
  parents                        US-DB
  use                            windows-server
  display_name                   US11
  icon_image                     file_server.jpg
  process_perf_data              1
  statusmap_image                file_server.jpg
}

define service {
  service_description            check-host-alive
  host_name                      TRUNK/US11
  use                            generic-service
  check_command                  check-host-alive
  icon_image                     Thumb-up-icon.png
}


When I commit ca2.cfg the config check alerts:
Code: Select all
referenced host 'TRUNK/US11' does not exist in ca2.cfg:11

Of course it does not exist in ca2.cfg because this definition:
Code: Select all
define servicedependency{
   host_name         TRUNK/US11

is defined here: us11.cfg

Thanks for your help.
MINT
 
Posts: 3
Joined: Mon Nov 06, 2017 10:02 am

Re: Dependies with multi config files

Postby dwhitfield » Wed Nov 08, 2017 4:08 pm

MINT wrote:nagios.cfg is empty at the moment. I am still at testing.


Well, once you get a nagios.cfg, but the following in it so nagios know where your configs are:

cfg_dir=<directory_name>

You can read more about the config options at https://assets.nagios.com/downloads/nag ... gmain.html


What version of Core are you using? Was it compiled from source or installed from distro repos? On what OS/version is nagios running? cat /etc/*-release may be of use. Those questions will help us determine file paths/names so that we can help you.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
dwhitfield
The Doctor
 
Posts: 3956
Joined: Wed Sep 21, 2016 10:29 am
Location: Nagios Enterprises, LLC

Re: Dependies with multi config files

Postby MINT » Thu Nov 09, 2017 11:23 am

Hi dwhitfield,

I did a stupid mistake. I am sorry, :oops: used the alias and not the host name in the dependency.
You can the this in my second post.
Nice product, works as expected!

Thank you for the investigation.
MINT
 
Posts: 3
Joined: Mon Nov 06, 2017 10:02 am

Re: Dependies with multi config files

Postby npolovenko » Thu Nov 09, 2017 1:00 pm

@MINT, Nice! I will close this thread as resolved then. But if you encounter any other issues feel free to open a new one.
User avatar
npolovenko
 
Posts: 367
Joined: Mon May 15, 2017 5:00 pm


Return to Nagios Core

Who is online

Users browsing this forum: No registered users and 15 guests