Bug 1189183

Summary: Does not handle invalid hostgroup_member correctly
Product: [Fedora] Fedora EPEL Reporter: smkoch
Component: nagiosAssignee: Keiran Smith <affix>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: el6CC: affix, jose.p.oliveira.oss, lemenkov, ondrejj, redhat, shawn.starr, smooge, s
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nagios-4.3.2-5.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-07-23 02:21:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description smkoch 2015-02-04 16:07:01 UTC
Description of problem:

When you have a hostgroup with other hostgroups as a member of that group(via hostgroup_member option of a hostgroup definition), if you give it a hostgroup name that doesn't correspond to a valid hostgroup two problems occur:
1) The configuration checker(nagios -v nagios.cfg) reports the error, but does does not account for this in the total errors and returns OK. See below for example.
2) Since the configuration checker in problem 1 passes, nagios start up fine, but only populates the hostgroup with hostgroup_members up to the point of the bad hostgroup, and ignores any valid hostgroup_members that follow.

This seems trivial, but can have some nasty side affects if you depend heavily on hostgroups for monitoring which nagios appears to support.


Version-Release number of selected component (if applicable):
I am able to reproduce this in both the lastest version of the EPEL RPM nagios-3.5.1-1.el6.x86_64 and the latest 3.5.1 of vanilla nagios source. I haven't tried nagios 4.

How reproducible:
Always


Steps to Reproduce:
1. Create the following config in test.cfg
define host{
        use                     linux-server
        host_name               test1 
        alias                   test1
        address                 127.0.0.2
        }

define host{
        use                     linux-server
        host_name               test2 
        alias                   test2
        address                 127.0.0.3
        }

define hostgroup{
        hostgroup_name  test-group1
        alias           Test Group1
        members         test1
        }

define hostgroup{
        hostgroup_name  test-group2
        alias           Test Group2
        members         test2
        }

define hostgroup{
        hostgroup_name  master-group
        alias           Master Group
        hostgroup_members test-group1, bad-group,  test-group2
        }

2. Add include line in nagios.cfg to include test.cfg

3. run nagios -v nagios.cfg

4. start nagios

Actual results:

In step 3 above I get the following:

nagios -v nagios.cfg | egrep 'Error|No serious problems'
Error: Could not find member group 'bad-group' specified in hostgroup (config file '/home/koch/nagios/test/nagios/prefix/etc/objects/test.cfg', starting on line 27)
Total Errors:   0
Things look okay - No serious problems were detected during the pre-flight check

In step 4 I get a hostgroup with just test-group1's hosts:

from objects.cache(actual):
define hostgroup {
        hostgroup_name  master-group
        alias   Master Group
        members test1
        }

Expected results:

In step3 I thing this should result in the config check failing so nagios won't ever start.

In step4 I would expect to use all the valid hostgroups define(although this would not be an issue if step3 acted correctly).

from objects.cache(desired):
define hostgroup {
        hostgroup_name  master-group
        alias   Master Group
        members test1, test2
        }

Additional info:

Comment 1 Fedora Update System 2017-02-09 17:28:01 UTC
nagios-4.2.4-3.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-270f6f4375

Comment 2 Fedora Update System 2017-02-10 22:40:24 UTC
nagios-4.2.4-4.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-acd2c2af0d

Comment 3 Fedora Update System 2017-02-11 16:17:39 UTC
nagios-4.2.4-4.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-acd2c2af0d

Comment 4 Fedora Update System 2017-05-11 19:15:51 UTC
nagios-4.3.2-1.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-1f2571d162

Comment 5 Fedora Update System 2017-05-12 19:51:18 UTC
nagios-4.3.2-1.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-1f2571d162

Comment 6 Fedora Update System 2017-06-14 18:59:32 UTC
nagios-4.3.2-3.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-16880697fe

Comment 7 Fedora Update System 2017-06-15 09:46:48 UTC
nagios-4.3.2-3.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-16880697fe

Comment 8 Fedora Update System 2017-06-28 19:27:38 UTC
nagios-4.3.2-5.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-328a23d1ed

Comment 9 Fedora Update System 2017-06-30 01:16:35 UTC
nagios-4.3.2-5.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-328a23d1ed

Comment 10 Fedora Update System 2017-07-23 02:21:09 UTC
nagios-4.3.2-5.el6 has been pushed to the Fedora EPEL 6 stable repository. If problems still persist, please make note of it in this bug report.