# modules



# init_module

**Descripción**

Inicializa una plantilla de módulo con valores por defecto.

**Parámetros**

<table border="1" id="bkmrk-module-acepta-el-tip" style="width: 642px; height: 58px;"><tbody><tr style="height: 29px;"><td style="width: 117px; height: 29px;">**Nombre**</td><td style="width: 53px; height: 29px;"><div><div>**Tipo**</div></div></td><td style="width: 93px; height: 29px;"><div><div>**Requerido**</div></div></td><td style="width: 379px; height: 29px;">**Descripción**</td></tr><tr style="height: 29px;"><td style="width: 117px; height: 29px;"><div><div>default_values</div></div></td><td style="width: 53px; height: 29px;"><div><div>dict</div></div></td><td style="width: 93px; height: 29px;"><div><div>Si</div></div></td><td style="width: 379px; height: 29px;">Módulo en formato dict</td></tr></tbody></table>

**Return**

<table border="1" id="bkmrk-module_xml-m%C3%B3dulo-en" style="width: 641px;"><tbody><tr><td style="width: 75px;">**Tipo**</td><td style="width: 566px;">**Descripción**</td></tr><tr><td style="width: 75px;">dict</td><td style="width: 566px;">Módulo en formato XML</td></tr></tbody></table>

**Versión**

- 1.0.0

**Ejemplo**

```
import pandoraPlugintools as pt

# Define default values to override the template values
default_module_values = {
    "name": "HostAlive",
    "type": "generic_proc",
    "value": 1,
}

# Initialize a module template with default values
module_template = pt.modules.init_module(default_module_values)

# Print the initialized module template
print("Initialized Module Template:", module_template)
```

# print_module

**Descripción**

Devuelve el módulo en formato XML.

**Parámetros**

<table border="1" id="bkmrk-module-acepta-el-tip" style="width: 642px;"><tbody><tr><td style="width: 78px;">**Nombre**</td><td style="width: 57px;"><div><div>**Tipo**</div></div></td><td style="width: 105px;"><div><div>**Requerido**</div></div></td><td style="width: 402px;">**Descripción**</td></tr><tr><td style="width: 78px;"><div><div>module</div></div></td><td style="width: 57px;"><div><div>dict</div></div></td><td style="width: 105px;"><div><div>Si</div></div></td><td style="width: 402px;">Módulo en formato dict</td></tr><tr><td style="width: 78px;"><div><div>print_flag</div></div></td><td style="width: 57px;"><div><div>bool</div></div></td><td style="width: 105px;"><div><div>No</div></div></td><td style="width: 402px;">Con True muestra el XML del módulo en STDOUT</td></tr></tbody></table>

**Return**

<table border="1" id="bkmrk-module_xml-m%C3%B3dulo-en" style="width: 529px;"><tbody><tr><td style="width: 75px;">**Tipo**</td><td style="width: 454px;">**Descripción**</td></tr><tr><td style="width: 75px;">str</td><td style="width: 454px;">Módulo en formato XML</td></tr></tbody></table>

**Versión**

- 1.0.0

**Ejemplo**

```
import pandoraPlugintools as pt

# Define module data
module_data = {
    "name": "HostAlive",
    "type": "generic_proc",
    "value": 1,
    "desc": "Check if the host is alive",
}

# Print module data in XML format without printing to STDOUT
module_xml = pt.modules.print_module(module_data, print_flag=False)
print("Module XML:\n", module_xml)
```

# init_log_module

**Descripción**

Inicializa una plantilla de módulo de logs con valores por defecto.

**Parámetros**

<table border="1" id="bkmrk-module-acepta-el-tip" style="width: 642px; height: 58px;"><tbody><tr style="height: 29px;"><td style="width: 117px; height: 29px;">**Nombre**</td><td style="width: 53px; height: 29px;"><div><div>**Tipo**</div></div></td><td style="width: 93px; height: 29px;"><div><div>**Requerido**</div></div></td><td style="width: 379px; height: 29px;">**Descripción**</td></tr><tr style="height: 29px;"><td style="width: 117px; height: 29px;"><div><div>default_values</div></div></td><td style="width: 53px; height: 29px;"><div><div>dict</div></div></td><td style="width: 93px; height: 29px;"><div><div>Si</div></div></td><td style="width: 379px; height: 29px;">Módulo en formato dict</td></tr></tbody></table>

**Return**

<table border="1" id="bkmrk-module_xml-m%C3%B3dulo-en" style="width: 641px;"><tbody><tr><td style="width: 75px;">**Tipo**</td><td style="width: 566px;">**Descripción**</td></tr><tr><td style="width: 75px;">dict</td><td style="width: 566px;">Módulo de logs en formato XML</td></tr></tbody></table>

**Versión**

- 1.0.0

**Ejemplo**

```
import pandoraPlugintools as pt

# Define default values for the log module template
default_log_module_values = {
    "source": "System",
    "value": "The host is not accessible",
}

# Initialize a log module template with default values
log_module_template = pt.modules.init_log_module(default_log_module_values)

# Print the initialized log module template
print("Initialized Log Module Template:", log_module_template)
```

# print_log_module

**Descripción**

Devuelve el módulo de logs en formato XML.

**Parámetros**

<table border="1" id="bkmrk-module-acepta-el-tip" style="height: 58px; width: 532px;"><tbody><tr><td style="width: 94px;">**nombre**</td><td style="width: 94px;"><div><div>**tipo**</div></div></td><td style="width: 344px;">**descripción**</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 94px;"><div><div>module</div></div></td><td style="width: 94px;"><div><div>dict</div></div></td><td style="height: 29px; width: 344px;">Módulo en formato dict</td></tr><tr><td style="width: 94px;"><div><div>encoding</div></div></td><td style="width: 94px;"><div><div>str</div></div></td><td style="width: 344px;">Formato de encoding</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 94px;"><div><div>print_flag</div></div></td><td style="width: 94px;"><div><div>bool</div></div></td><td style="height: 29px; width: 344px;">Si se utiliza muestra el XML de los módulos en STDOUT</td></tr></tbody></table>

**Return**

<table border="1" id="bkmrk-module_xml-m%C3%B3dulo-en" style="width: 430px;"><tbody><tr><td style="width: 88px;">**tipo**</td><td style="width: 342px;">**descripción**</td></tr><tr><td style="width: 88px;">str</td><td style="width: 342px;">Módulo en formato XML</td></tr></tbody></table>

**Versión**

- 1.0.0

**Ejemplo**

```
import pandoraPlugintools as pt

# Define log module data
log_module_data = {
    "source": "System",
    "value": "The host is not accessible",
}

# Print the log module in XML format
log_module_xml = pt.modules.print_log_module(log_module_data,encoding="base64", print_flag=True)

# Print the generated log module XML
print("Log Module XML:\n", log_module_xml)
```