Comment 8 for bug 1986654

Revision history for this message
Paul Goins (vultaire) wrote :

I'm going to go out on a limb and suggest the problem is caused by the behavior of render_nrped_files in hooks/nrpe_utils.py. What it does is, prior to creating files for a check, it removes all "matching files" the check may have had.

That list of matching files is created in hooks/nrpe_helpers.py in SubordinateCheckDefinitions.__init__(). For each check created, a set of "matching files" is created using these patterns:

* /etc/nagios/nrpe.d/{}.cfg (direct match)
* /etc/nagios/nrpe.d/{}_*.cfg (subordinate match)

This means that, for the check_space checks, a check on /var (i.e. check_space_var), would match on files /etc/nagios/nrpe.d/check_space_var.cfg as well as the glob /etc/nagios/nrpe.d/check_space_var_*.cfg, which would also match the files used by the subdir checks.

At that point, it basically becomes a quirk of ordering. If we want this type of cleanup behavior, then we need to ensure that the checks are properly ordered so that if one check deletes the files from other checks, the other checks will then re-create them afterwards.

**I believe this is where the bug is happening:** get_partitions_to_check() is returning a set, which is inherently unordered. In order for this to work reliably, this needs to be reworked to return a list, with subordinate checks listed after the parent checks. ...If I'm not mistaken, this *may* be as simple as just wrapping the result of that function in list(sorted()).