Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Import du code des modules depuis /var/lib/shinken/modules

Les démons vont lister les répertoires dans /var/lib/shinken/modules et vont tenter de charger chaque module.


Ceci va créer une entrée DEBUG:

Code Block
themeEmacs
[2020-07-08 16:31:36] DEBUG : [broker-master ] [modules-manager ] [MODULE-CODE-LOADING] [directory=architecture-export ] Starting to load the module code directory /var/lib/shinken/modules/architecture-export.

Quand l'import est effectué, on aura une ligne en DEBUG:

Code Block
themeEmacs
[2020-07-08 16:31:36] DEBUG : [broker-master ] [modules-manager ] [MODULE-CODE-LOADING] [directory=architecture-export ] [0.021s] Module code was loaded. Did import 10 python new librairies (PIL,PIL.Image,PIL.ImageMode,PIL._binary,_imaging,architecture-export,architecture-export.mapper,shinken.webui.bottlewebui,shinken.webui.bottlewebui.ext,shinken.webui.cherrypybackend).

Ceci donne le temps de chargement, mais également les nouvelles librairies importées.


À la fin des chargements, il y a un résumé en INFO qui est affiché:

Code Block
themeEmacs
[2020-07-08 16:31:38] INFO : [broker-master ] [modules-manager ] [MODULE-CODE-LOADING] A total of 9 Shinken Enterprise modules are available for this daemon/module (broker): broker-module-livedata, event-container, graphite-perfdata, livestatus, simple-log, sla, trending, webui, MODULE-CODE-NAME (on a total of 40, loaded in 1.844s)

Les modules éligibles à ce démon/module sont listés.


Code Block
themeEmacs
[2020-07-08 16:31:38] WARNING : [broker-master ] [modules-manager ] [MODULE-CODE-LOADING] [directory=architecture-export] Failed to load the directory [architecture-export] as a python module.

Code Block
themeEmacs
[2020-07-08 16:31:38] WARNING : [broker-master ] [modules-manager ] [MODULE-CODE-LOADING] [directory=architecture-export]  - because of missing file :[PATH_DU_FICHIER].

Code Block
themeEmacs
[2020-07-08 16:31:38] WARNING : [broker-master ] [modules-manager ] [MODULE-CODE-LOADING] [directory=architecture-export] - 'import architecture-export.my_file' will not work in your module.py file.


Code Block
themeEmacs
[2020-07-08 16:31:38] WARNING : [broker-master ] [modules-manager ] [MODULE-CODE-LOADING] [directory=architecture-export] Bad module file for FILE_NAME : missing properties dict.

Code Block
themeEmacs
[2020-07-08 16:31:38] WARNING : [broker-master ] [modules-manager ] [MODULE-CODE-LOADING] [directory=architecture-export] Importing module architecture-export: EXCEPTION.


Création des instances de modules

Une fois le code python chargé, on lui demande de créer des instances pour les modules ( les vrais objets ):

Code Block
themeEmacs
[2020-07-08 16:31:38] DEBUG : [broker-master ] [modules-manager ] [MODULE-INSTANCE-CREATION] [module type=webui ] [name=WebUI ] Start to create the module instance


Une fois créé, on a un log en INFO concernant le temps que ça a pris.

Code Block
themeEmacs
[2020-07-08 16:31:38] INFO : [broker-master ] [modules-manager ] [MODULE-INSTANCE-CREATION] [module type=webui ] [name=WebUI ] [0.046s] SUCCESS The module instance is created.


Code Block
themeEmacs
[2020-07-08 16:31:38] DEBUG : [broker-master ] [modules-manager ] [MODULE-INSTANCE-CREATION] [module type=webui ] [name=WebUI ] [0.046s] The module is not ready to start.


Code Block
themeEmacs
[2020-07-08 16:31:38] INFO : [broker-master ] [modules-manager ] [MODULE-INSTANCE-CREATION] [module type=webui ] [name=WebUI ] Trying to init module.


Code Block
themeEmacs
[2020-07-08 16:31:38] ERROR : [broker-master ] [modules-manager ] [MODULE-INSTANCE-CREATION] [module type=webui ] [name=WebUI ] The module failed to init and he raised an exception: EXCEPTION.


Code Block
themeEmacs
[2020-07-08 16:31:38] WARNING : [broker-master ] [modules-manager ] [MODULE-INSTANCE-CREATION] [module type=webui ] [name=WebUI ] The module tried to start: 5 times.


Code Block
themeEmacs
[2020-07-08 16:31:38] WARNING : [broker-master ] [modules-manager ] [MODULE-INSTANCE-CREATION] [module type=webui ] [name=WebUI ] The module will try to restart at 16:32:18.


Code Block
themeEmacs
[2020-07-08 16:31:38] INFO : [broker-master ] [modules-manager ] [MODULE-INSTANCE-CREATION] [module type=webui ] [name=WebUI ] SUCCESS The module is started.


Code Block
themeEmacs
[2020-07-08 16:31:38] ERROR : [broker-master ] [modules-manager ] [MODULE-INSTANCE-CREATION] [module type=webui ] [name=WebUI ] FAIL The module get_instance() call did not return any instance.


Code Block
themeEmacs
[2020-07-08 16:31:38] ERROR : [broker-master ] [modules-manager ] [MODULE-INSTANCE-CREATION] [module type=webui ] [name=WebUI ] [0.046s] FAIL The module creation did fail with an exception: EXCEPTION. Remove this module currently, will try to recreate it in the future.


Code Block
themeEmacs
[2020-07-08 16:31:38] DEBUG : [broker-master ] [modules-manager ] [MODULE-INSTANCE-CREATION] [module type=webui ] [name=WebUI ] Creation module instance was skipped.


Code Block
themeEmacs
[2020-07-08 16:31:38] INFO : [broker-master ] [modules-manager ] [MODULE-INSTANCE-CREATION] [module type=webui ] [name=WebUI ] Starting a worker.


Code Block
themeEmacs
[2020-07-08 16:31:38] ERROR : [broker-master ] [modules-manager ] [MODULE-INSTANCE-CREATION] [module type=webui ] [name=WebUI ] The worker failed to init.


Code Block
themeEmacs
[2020-07-08 16:31:38] INFO : [broker-master ] [modules-manager ] [MODULE-INSTANCE-CREATION] [module type=webui ] [name=WebUI ] SUCCESS The worker is created.


Code Block
themeEmacs
[2020-07-08 16:31:38] ERROR : [broker-master ] [modules-manager ] [MODULE-INSTANCE-CREATION] [module type=webui ] [name=WebUI ] The worker failed to init and he raised an exception: EXCEPTION.


Initialisation des instances de modules

Une fois les instances créées, on leur demande de se préparer ( ouvrir leurs connexions, lancer les processus pour les modules externes ou avec des workers, etc ).

Ceci sera de l'ordre de la seconde pour le cas des modules avec workers ( il faut créer les queues de connexions, lancer les processus et le manager de queue, etc ).


Code Block
themeEmacs
[2020-07-08 16:31:38] INFO : [broker-master ] [modules-manager ] [MODULE-INSTANCE-CREATION] [WebUI ] Trying to initialize module by calling it's init method.

Quand l'initialisation est finie, un log INFO est affiché.

Code Block
themeEmacs
[2020-07-08 16:31:39] INFO : [broker-master ] [modules-manager ] [MODULE-INSTANCE-CREATION] [WebUI ] [0.801s] SUCCESS The module was initialized successfully.



Rajout d'un nouveau module dans un démon


Lorsqu'un démon reçoit un nouveau module, on va avoir une entrée MODULES-CHANGE en INFO comme quoi le module est started:

Code Block
themeEmacs
[2020-07-0908 1316:2931:5839] INFOERROR : [broker-master ] [modules-manager ] [MODULES-CHANGE ] Modules did changed:
MODULE-INSTANCE-CREATION] [name=WebUI] Cannot find previous or new module definition for the module name WebUI, so cannot update it.


Code Block
themeEmacs
[2020-07-0908 1316:2931:5839] INFO : [broker-master ] [modules-manager ] [MODULES-CHANGE ] - WebUI -> started (new)

MODULE-INSTANCE-CREATION] [name=WebUI] Configuration of the module did change so we restart it.


Code Block
themeEmacs
[2020-07-0908 1316:2931:5839] INFO : [broker-master ] [modules-manager ] [MODULES-CHANGE ] - sla -> started (new)
À noter que les sous-modules d'un module seront eux affichés en DEBUG:
MODULE-INSTANCE-CREATION] [name=WebUI] Removing the module because it is remove from the configuration.


Code Block
themeEmacs
[2020-07-0908 1316:2931:5839] INFO : [broker-master ] [modules-manager ] [MODULES-CHANGE ] - WebUI -> started (new)
MODULE-INSTANCE-CREATION] [name=WebUI] Launching a new module as it was added in the daemon configuration?


Code Block
themeEmacs
[2020-07-0908 1316:2931:5839] DEBUG : [broker-master ] [modules-manager ] [MODULES-CHANGE ] * Cfg_password
MODULE-INSTANCE-CREATION] [name=WebUI] The module did change its configuration. We restart it to take the new configuration.


Code Block
themeEmacs
[2020-07-0908 1316:2931:5839] DEBUGWARNING : [broker-master ] [modules-manager ] [MODULES-CHANGE ] * sla

Suppression d'un module dans un démon

Quand un module est enlevé de la configuration d'un démon, celui-ci l'affichera avec une entrée MODULES-CHANGE en INFO comme quoi le module est stopped:
MODULE-INSTANCE-CREATION] [name=WebUI] Trying to remove the module %s but it is not found in the current instances: INSTANCES


Code Block
themeEmacs
[2020-07-0908 1316:5731:3139] INFODEBUG : [broker-master ] [modules-manager ] [MODULES-CHANGE ] Modules did changed:
MODULE-INSTANCE-CREATION] [module type=webui ] [name=WebUI] Ask stop process.


Code Block
themeEmacs
[2020-07-0908 1316:5731:3139] INFODEBUG : [broker-master ] [modules-manager ] [MODULES-CHANGE ] - Livestatus -> stopped (removed)
MODULE-INSTANCE-CREATION] [module type=webui ] [name=WebUI] Stop process done.


Suppression d'un module dans un démon

Quand un module est enlevé de la configuration d'un démon, celui-ci l'affichera avec une entrée MODULES-CHANGE en INFO comme quoi le module est stopped:


Changement de configuration d'un module (et sa relance)

[2020-07-09 13:51:49] INFO : [broker-master ] [modules-manager ] [MODULES-CHANGE ] Modules did changed: [2020-07-09 13

Quand la configuration d'un module change (ou la configuration d'un de ses sous-modules) alors le module est redémarré (et ses processus redémarrés si besoin). Ceci est loggué avec une entrée MODULES-CHANGE en INFO comme quoi le module est restarted:

Code Block
themeEmacs

:

51:49] INFO : [broker-master ] [modules-manager ] [MODULES-CHANGE ] - Livestatus -> restarted (configuration change)