Bug writing config files

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
gzaloprgm
Posts: 33
Joined: Mon Aug 06, 2018 8:46 am
Contact:

Bug writing config files

Post by gzaloprgm »

Hi
I've found a bug that affects the generation of certain config files. In my case it affected service groups, and caused some members of it to dissapear.

Steps to reproduce:
- Create host "host1"
- Create service with description "test100", add it to host1
- Create service with description "test10", add it to host1
- Create servicegroup, add both services to it.
- Press the "view config" button on the servicegroup (or apply config/write files)
- Inspect which members are included in the servicegroup. If the bug occurs, only one of the two services will appear as a member

Any naming of services that contains substrings might trigger the bug. For instance, calling services "Something" and "Something - extra" can trigger it. It is also dependent on the order in which they were created.

The bug seems to be caused by in includes/components/ccm/classes/config.class.php line 886:

Code: Select all

if (substr_count($value, $strHost.",".$strService) == 0) {
  $value .= $strHost.",".$strService.",";
}
As it can be seen, in order to avoid adding duplicated members to the member variable, it checks if the string "<hostName>,<serviceDescr>" exists in the string that contain the members that have already been added. This causes a bug if a service description is contained within another service description of the same host.

Thanks, Gonzalo
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Bug writing config files

Post by lmiltchev »

I was able to recreate the problem, and filed an internal bug report (task_id=14007). Thank you for reporting this issue!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked