Skip to content

Commit

Permalink
be more specific when unloading a neb module
Browse files Browse the repository at this point in the history
Print the current and expected api version number along with the error.
This gives a hint about wether the neb module is too new or too old.
  • Loading branch information
sni committed Aug 31, 2023
1 parent 7558c98 commit 59f73c0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/naemon/nebmods.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,11 @@ int neb_load_module(nebmodule *mod)

/* check the module API version */
if (module_version_ptr == NULL || ((*module_version_ptr) != CURRENT_NEB_API_VERSION)) {

nm_log(NSLOG_RUNTIME_ERROR, "Error: Module '%s' is using an old or unspecified version of the event broker API. Module will be unloaded.\n", mod->filename);

if (module_version_ptr == NULL) {
nm_log(NSLOG_RUNTIME_ERROR, "Error: Module '%s' did not specify a version of the event broker API. Module will be unloaded.\n", mod->filename);
} else {
nm_log(NSLOG_RUNTIME_ERROR, "Error: Module '%s' is using an incompatible version (v%d) of the event broker API (current version: v%d). Module will be unloaded.\n", mod->filename, *module_version_ptr, CURRENT_NEB_API_VERSION);
}
neb_unload_module(mod, NEBMODULE_FORCE_UNLOAD, NEBMODULE_ERROR_API_VERSION);

return ERROR;
Expand Down

0 comments on commit 59f73c0

Please sign in to comment.