Under /opt/systems I have a lot of "sys_XXX" directories - each containing a simple monitrc file with a few processes but no further include.
So basically, there are only two levels of control files - the main one and all the sys_XXX files are under it.
When reaching 512 (MAX_STACK_DEPTH) "sys_XXX" directories, Monit fails to load due to "include files are nested too deeply" error.
Apparently, the sys_XXX control files are opened in recursion instead of one by one as they are independent and they all have only one parent control file.
If, instead of the include sys* - I will add a line for each sys in the main control file it will be OK but than I will have to manage the main control file - instead of adding/deleting a directory.
This issue is very urgent for us as we counted and developed by this structure and now, just before launch, we see that it does not work as we expected.