Page 1 of 1
Dependies with multi config files
Posted: Mon Nov 06, 2017 10:54 am
by MINT
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?
Re: Dependies with multi config files
Posted: Mon Nov 06, 2017 12:24 pm
by mcapra
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:
Re: Dependies with multi config files
Posted: Mon Nov 06, 2017 1:57 pm
by dwhitfield
@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.
Re: Dependies with multi config files
Posted: Wed Nov 08, 2017 4:31 am
by MINT
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.
Re: Dependies with multi config files
Posted: Wed Nov 08, 2017 4:08 pm
by dwhitfield
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.
Re: Dependies with multi config files
Posted: Thu Nov 09, 2017 11:23 am
by MINT
Hi dwhitfield,
I did a stupid mistake. I am sorry,
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.
Re: Dependies with multi config files
Posted: Thu Nov 09, 2017 1:00 pm
by npolovenko
@MINT, Nice! I will close this thread as resolved then. But if you encounter any other issues feel free to open a new one.