Docker-Nagios icon indicating copy to clipboard operation
Docker-Nagios copied to clipboard

Container should fail if config is wrong

Open phreakadelle opened this issue 3 years ago • 1 comments

I am using this docker images since long time and it really helps us a lot. Thanks for the efforts you have put in.

From time to time we update our docker image and sometimes we break the config with our changes. The container is restarted automatically, but due to the broken change nagios is not working. The bad thing is, the container is not stopping. This means sometimes we don't really see that something is wrong, because nagios still reports everything as "ok" but in reallity its not working:

`Nagios Core 4.4.5 Copyright (c) 2009-present Nagios Core Development Team and Community Contributors Copyright (c) 1999-2009 Ethan Galstad Last Modified: 2019-08-20 License: GPL

Nagios Core 4.4.5
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2019-08-20
License: GPL

Website: https://www.nagios.org
Nagios 4.4.5 starting... (PID=1533)
Local time is Thu Sep 03 13:14:21 UTC 2020
wproc: Successfully registered manager as @wproc with query handler
nagios: Nagios 4.4.5 starting... (PID=1533)
nagios: Local time is Thu Sep 03 13:14:21 UTC 2020
nagios: LOG VERSION: 2.0
nagios: qh: Socket '/opt/nagios/var/rw/nagios.qh' successfully initialized
nagios: qh: core query handler registered
nagios: qh: echo service query handler registered
nagios: qh: help for the query handler registered
nagios: wproc: Successfully registered manager as @wproc with query handler
wproc: Registry request: name=Core Worker 1537;pid=1537
nagios: wproc: Registry request: name=Core Worker 1537;pid=1537
wproc: Registry request: name=Core Worker 1539;pid=1539
wproc: Registry request: name=Core Worker 1540;pid=1540
wproc: Registry request: name=Core Worker 1542;pid=1542
nagios: wproc: Registry request: name=Core Worker 1539;pid=1539
nagios: wproc: Registry request: name=Core Worker 1540;pid=1540
nagios: wproc: Registry request: name=Core Worker 1542;pid=1542
wproc: Registry request: name=Core Worker 1538;pid=1538
nagios: wproc: Registry request: name=Core Worker 1538;pid=1538
wproc: Registry request: name=Core Worker 1541;pid=1541
nagios: wproc: Registry request: name=Core Worker 1541;pid=1541
Warning: Duplicate definition found for host 'swpsci07' (config file '/opt/nagios/etc/objects/custom-services.cfg', starting on line 426)
Error: Could not add object property in file '/opt/nagios/etc/objects/custom-services.cfg' on line 428.
nagios: Warning: Duplicate definition found for host 'swpsci07' (config file '/opt/nagios/etc/objects/custom-services.cfg', starting on line 426)
nagios: Error: Could not add object property in file '/opt/nagios/etc/objects/custom-services.cfg' on line 428.
Error: Invalid max_check_attempts value for host 'esx-ci'
Error: Could not register host (config file '/opt/nagios/etc/objects/esx-ci.cfg', starting on line 1)
nagios: Error: Invalid max_check_attempts value for host 'esx-ci'
nagios: Error: Could not register host (config file '/opt/nagios/etc/objects/esx-ci.cfg', starting on line 1)
Bailing out due to one or more errors encountered in the configuration files. Run Nagios from the command line with the -v option to verify your config before restarting. (PID=1533)
nagios: Bailing out due to one or more errors encountered in the configuration files. Run Nagios from the command line with the -v option to verify your config before restarting. (PID=1533)

Shouldnt the container stop if the config is wrong?

phreakadelle avatar Sep 03 '20 13:09 phreakadelle

how are you updating your config? why not add a test pipeline

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

JakeDEvans avatar Sep 23 '20 13:09 JakeDEvans