Removal of DHCP_Leases and PiHole DB tables

This commit is contained in:
Jokob-sk
2023-08-26 12:31:49 +10:00
parent ed0276b61e
commit b114de1fd9
26 changed files with 250 additions and 226 deletions

View File

@@ -328,12 +328,12 @@ Plugin entries can be filtered based on values entered into filter fields. The `
PiAlert will take the results of the plugin execution and insert these results into a database table, if a plugin contains the property `"mapped_to_table"` in the `config.json` root. The mapping of the columns is defined in the `database_column_definitions` array.
This approach is used to implement the `DHCPLSS` plugin. The script parses all supplied "dhcp.leases" files, get's the results in the generic table format outlined in the "Column order and values" section above and takes individual values and inserts them into the `"DHCP_Leases"` database table in the PiAlert database. All this is achieved by:
This approach is used to implement the `DHCPLSS` plugin. The script parses all supplied "dhcp.leases" files, get's the results in the generic table format outlined in the "Column order and values" section above and takes individual values and inserts them into the `"CurrentScan"` database table in the PiAlert database. All this is achieved by:
> [!NOTE]
> If results are mapped to the `CurrentScan` table, the data is then included into the regular scan loop, so for example notification for devices are sent out.
1) Specifying the database table into which the results are inserted by defining `"mapped_to_table": "DHCP_Leases"` in the root of the `config.json` file as shown below:
1) Specifying the database table into which the results are inserted by defining `"mapped_to_table": "CurrentScan"` in the root of the `config.json` file as shown below:
```json
{
@@ -342,16 +342,16 @@ This approach is used to implement the `DHCPLSS` plugin. The script parses all s
...
"data_source": "script",
"localized": ["display_name", "description", "icon"],
"mapped_to_table": "DHCP_Leases",
"mapped_to_table": "CurrentScan",
...
}
```
2) Defining the target column with the `mapped_to_column` property for individual columns in the `database_column_definitions` array of the `config.json` file. For example in the `DHCPLSS` plugin, I needed to map the value of the `Object_PrimaryID` column returned by the plugin, to the `DHCP_MAC` column in the PiAlert database `DHCP_Leases` table. Notice the `"mapped_to_column": "DHCP_MAC"` key-value pair in the sample below.
2) Defining the target column with the `mapped_to_column` property for individual columns in the `database_column_definitions` array of the `config.json` file. For example in the `DHCPLSS` plugin, I needed to map the value of the `Object_PrimaryID` column returned by the plugin, to the `cur_MAC` column in the PiAlert database `CurrentScan` table. Notice the `"mapped_to_column": "cur_MAC"` key-value pair in the sample below.
```json
{
"column": "Object_PrimaryID",
"mapped_to_column": "DHCP_MAC",
"mapped_to_column": "cur_MAC",
"css_classes": "col-sm-2",
"show": true,
"type": "device_mac",
@@ -367,6 +367,29 @@ This approach is used to implement the `DHCPLSS` plugin. The script parses all s
3) That's it. PiAlert takes care of the rest. It loops thru the objects discovered by the plugin, takes the results line, by line and inserts them into the database table specified in `"mapped_to_table"`. The columns are translated from the generic plugin columns to the target table via the `"mapped_to_column"` property in the column definitions.
> [!NOTE]
> You can create a column mapping with a default value via the `mapped_to_column_data` property.
```json
{
"column": "NameDoesntMatter",
"mapped_to_column": "cur_ScanMethod",
"mapped_to_column_data": {
"value": "DHCPLSS"
},
"css_classes": "col-sm-2",
"show": true,
"type": "device_mac",
"default_value":"",
"options": [],
"localized": ["name"],
"name":[{
"language_code":"en_us",
"string" : "MAC address"
}]
}
```
#### params
The `params` array in the `config.json` is used to enable the user to change the parameters of the executed script. For example, the user wants to monitor a specific URL.

View File

@@ -327,12 +327,12 @@ Las entradas de complementos se pueden filtrar según los valores ingresados en
PiAlert tomará los resultados de la ejecución del complemento e insertará estos resultados en una tabla de base de datos, si un complemento contiene la propiedad `"mapped_to_table"` en la raíz `config.json`. El mapeo de las columnas se define en la matriz `database_column_definitions`.
Este enfoque se utiliza para implementar el complemento "DHCPLSS". El script analiza todos los archivos "dhcp.leases" proporcionados, obtiene los resultados en el formato de tabla genérica descrito en la sección "Orden y valores de las columnas" anterior y toma valores individuales y los inserta en la tabla de base de datos `"DHCP_Leases"` en PiAlert. base de datos. Todo esto se logra mediante:
Este enfoque se utiliza para implementar el complemento "DHCPLSS". El script analiza todos los archivos "dhcp.leases" proporcionados, obtiene los resultados en el formato de tabla genérica descrito en la sección "Orden y valores de las columnas" anterior y toma valores individuales y los inserta en la tabla de base de datos `"CurrentScan"` en PiAlert. base de datos. Todo esto se logra mediante:
> [!NOTE]
> Si los resultados se asignan a la tabla "CurrentScan", los datos se incluyen en el ciclo de escaneo normal, por lo que, por ejemplo, se envían notificaciones para los dispositivos.
1) Especificar la tabla de la base de datos en la que se insertan los resultados definiendo `"mapped_to_table": "DHCP_Leases"` en la raíz del archivo `config.json` como se muestra a continuación:
1) Especificar la tabla de la base de datos en la que se insertan los resultados definiendo `"mapped_to_table": "CurrentScan"` en la raíz del archivo `config.json` como se muestra a continuación:
```json
{
@@ -341,17 +341,17 @@ Este enfoque se utiliza para implementar el complemento "DHCPLSS". El script ana
...
"data_source": "script",
"localized": ["display_name", "description", "icon"],
"mapped_to_table": "DHCP_Leases",
"mapped_to_table": "CurrentScan",
...
}
```
2) Definir la columna de destino con la propiedad `mapped_to_column` para columnas individuales en la matriz `database_column_definitions` del archivo `config.json`. Por ejemplo, en el complemento `DHCPLSS`, necesitaba asignar el valor de la columna `Object_PrimaryID` devuelta por el complemento a la columna `DHCP_MAC` en la tabla `DHCP_Leases` de la base de datos PiAlert. Observe el par clave-valor `"mapped_to_column": "DHCP_MAC"` en el siguiente ejemplo.
2) Definir la columna de destino con la propiedad `mapped_to_column` para columnas individuales en la matriz `database_column_definitions` del archivo `config.json`. Por ejemplo, en el complemento `DHCPLSS`, necesitaba asignar el valor de la columna `Object_PrimaryID` devuelta por el complemento a la columna `cur_MAC` en la tabla `CurrentScan` de la base de datos PiAlert. Observe el par clave-valor `"mapped_to_column": "cur_MAC"` en el siguiente ejemplo.
```json
{
"column": "Object_PrimaryID",
"mapped_to_column": "DHCP_MAC",
"mapped_to_column": "cur_MAC",
"css_classes": "col-sm-2",
"show": true,
"type": "device_mac",

0
front/plugins/arp_scan/README_ES.md Normal file → Executable file
View File

0
front/plugins/dhcp_leases/README_ES.md Normal file → Executable file
View File

View File

@@ -14,7 +14,7 @@
],
"show_ui": true,
"localized": ["display_name", "description", "icon"],
"mapped_to_table": "DHCP_Leases",
"mapped_to_table": "CurrentScan",
"display_name" : [{
"language_code":"en_us",
"string" : "DHCP Leases (Device import)"
@@ -79,7 +79,7 @@
},
{
"column": "Object_PrimaryID",
"mapped_to_column": "DHCP_MAC",
"mapped_to_column": "cur_MAC",
"css_classes": "col-sm-2",
"show": true,
"type": "device_mac",
@@ -97,7 +97,7 @@
},
{
"column": "Object_SecondaryID",
"mapped_to_column": "DHCP_IP",
"mapped_to_column": "cur_IP",
"css_classes": "col-sm-2",
"show": true,
"type": "device_ip",
@@ -132,7 +132,7 @@
},
{
"column": "DateTimeChanged",
"mapped_to_column": "DHCP_DateTime",
"mapped_to_column": "cur_DateTime",
"css_classes": "col-sm-2",
"show": true,
"type": "label",
@@ -167,7 +167,7 @@
},
{
"column": "Watched_Value2",
"mapped_to_column": "DHCP_Name",
"mapped_to_column": "cur_Name",
"css_classes": "col-sm-2",
"show": true,
"type": "label",
@@ -250,6 +250,27 @@
"language_code":"es_es",
"string" : "Archivo DHCP leases"
}]
},
{
"column": "ScanMethod",
"mapped_to_column": "cur_ScanMethod",
"mapped_to_column_data": {
"value": "DHCPLSS"
},
"css_classes": "col-sm-2",
"show": true,
"type": "label",
"default_value":"",
"options": [],
"localized": ["name"],
"name":[{
"language_code":"en_us",
"string" : "Scan method"
},
{
"language_code":"es_es",
"string" : "Método de escaneo"
}]
},
{
"column": "Status",

0
front/plugins/dhcp_servers/README_ES.md Normal file → Executable file
View File

0
front/plugins/known_template__ignore/README_ES.md Normal file → Executable file
View File

0
front/plugins/newdev_template/README_ES.md Normal file → Executable file
View File

0
front/plugins/nmap_services/README_ES.md Normal file → Executable file
View File

0
front/plugins/pholus_scan/README_ES.md Normal file → Executable file
View File

0
front/plugins/pihole_scan/README_ES.md Normal file → Executable file
View File

View File

@@ -162,7 +162,7 @@
}] ,
"description":[{
"language_code":"en_us",
"string" : "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is IP</li><li><code>Watched_Value2</code> is Vendor</li><li><code>Watched_Value3</code> is Interface </li><li><code>Watched_Value4</code> is N/A </li></ul>"
"string" : "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is IP</li><li><code>Watched_Value2</code> is Last Query</li><li><code>Watched_Value3</code> is Name </li><li><code>Watched_Value4</code> is N/A </li></ul>"
},
{
"language_code":"es_es",
@@ -237,23 +237,33 @@
}]
},
{
"column": "Watched_Value2",
"mapped_to_column": "cur_Vendor",
"css_classes": "col-sm-2",
"show": true,
"type": "label",
"default_value":"",
"options": [],
"localized": ["name"],
"name":[{
"language_code":"en_us",
"string" : "Vendor"
},
{
"language_code":"es_es",
"string" : "Proveedor"
}]
} ,
"column": "Watched_Value2",
"mapped_to_column": "cur_LastQuery",
"css_classes": "col-sm-2",
"show": true,
"type": "label",
"default_value":"",
"options": [],
"localized": ["name"],
"name":[{
"language_code":"en_us",
"string" : "Last Query"
}]
},
{
"column": "Watched_Value3",
"mapped_to_column": "cur_Name",
"css_classes": "col-sm-2",
"show": true,
"type": "label",
"default_value":"",
"options": [],
"localized": ["name"],
"name":[{
"language_code":"en_us",
"string" : "Name"
}]
},
{
"column": "Extra",
"mapped_to_column": "cur_ScanMethod",

0
front/plugins/set_password/README_ES.md Normal file → Executable file
View File

0
front/plugins/snmp_discovery/README_ES.md Normal file → Executable file
View File

View File

@@ -14,7 +14,7 @@
],
"show_ui": true,
"localized": ["display_name", "description", "icon"],
"mapped_to_table": "DHCP_Leases",
"mapped_to_table": "CurrentScan",
"display_name" : [{
"language_code": "en_us",
"string": "SNMP discovery"
@@ -92,7 +92,7 @@
},
{
"column": "Object_PrimaryID",
"mapped_to_column": "DHCP_MAC",
"mapped_to_column": "cur_MAC",
"css_classes": "col-sm-2",
"show": true,
"type": "device_mac",
@@ -110,7 +110,7 @@
},
{
"column": "Object_SecondaryID",
"mapped_to_column": "DHCP_IP",
"mapped_to_column": "cur_IP",
"css_classes": "col-sm-2",
"show": true,
"type": "device_ip",
@@ -128,6 +128,7 @@
} ,
{
"column": "DateTimeCreated",
"mapped_to_column": "cur_DateTime",
"css_classes": "col-sm-2",
"show": true,
"type": "label",
@@ -143,27 +144,9 @@
"string" : "Creado"
}]
},
{
"column": "DateTimeChanged",
"mapped_to_column": "DHCP_DateTime",
"css_classes": "col-sm-2",
"show": true,
"type": "label",
"default_value":"",
"options": [],
"localized": ["name"],
"name":[{
"language_code":"en_us",
"string" : "Changed"
},
{
"language_code":"es_es",
"string" : "Cambiado"
}]
},
{
"column": "Watched_Value1",
"mapped_to_column": "DHCP_Name",
"mapped_to_column": "cur_Name",
"css_classes": "col-sm-2",
"show": true,
"type": "label",

0
front/plugins/undiscoverables/README_ES.md Normal file → Executable file
View File

View File

@@ -3,7 +3,7 @@
"unique_prefix": "UNDIS",
"enabled": true,
"data_source": "script",
"mapped_to_table": "DHCP_Leases",
"mapped_to_table": "CurrentScan",
"show_ui": true,
"localized": ["display_name", "description", "icon"],
@@ -55,7 +55,7 @@
"language_code":"en_us",
"string" : "When to run"
},
{
{
"language_code":"es_es",
"string" : "Cuándo ejecuta"
}],
@@ -63,7 +63,7 @@
"language_code":"en_us",
"string" : "When enabled, ONCE is the preferred option. It runs at startup and after every save of the config here.<br> Changes will only show in the devices <b> after the next scan!</b>"
},
{
{
"language_code":"es_es",
"string" : "Cuando está habilitado, ONCE es la opción preferida. Se ejecuta al inicio y después de cada guardado de la configuración aquí.<br> ¡Los cambios solo se mostrarán en los dispositivos <b> después del próximo escaneo!</b>"
}]
@@ -205,7 +205,7 @@
[
{
"column": "Watched_Value1",
"mapped_to_column": "DHCP_Name",
"mapped_to_column": "cur_Name",
"css_classes": "col-sm-2",
"show": true,
"type": "label",
@@ -223,7 +223,7 @@
},
{
"column": "Object_PrimaryID",
"mapped_to_column": "DHCP_MAC",
"mapped_to_column": "cur_MAC",
"css_classes": "col-sm-2",
"show": true,
"type": "device_mac",
@@ -241,7 +241,7 @@
},
{
"column": "Object_SecondaryID",
"mapped_to_column": "DHCP_IP",
"mapped_to_column": "cur_IP",
"css_classes": "col-sm-2",
"show": true,
"type": "device_ip",
@@ -276,7 +276,7 @@
},
{
"column": "DateTimeChanged",
"mapped_to_column": "DHCP_DateTime",
"mapped_to_column": "cur_DateTime",
"css_classes": "col-sm-2",
"show": true,
"type": "label",

0
front/plugins/unifi_import/README_ES.md Normal file → Executable file
View File

View File

@@ -14,7 +14,7 @@
}
],
"localized": ["display_name", "description", "icon"],
"mapped_to_table": "DHCP_Leases",
"mapped_to_table": "CurrentScan",
"display_name" : [{
"language_code":"en_us",
"string" : "UniFi import"
@@ -114,7 +114,7 @@
},
{
"column": "Object_PrimaryID",
"mapped_to_column": "DHCP_MAC",
"mapped_to_column": "cur_MAC",
"css_classes": "col-sm-2",
"show": true,
"type": "device_mac",
@@ -132,7 +132,7 @@
},
{
"column": "Object_SecondaryID",
"mapped_to_column": "DHCP_IP",
"mapped_to_column": "cur_IP",
"css_classes": "col-sm-2",
"show": true,
"type": "device_ip",
@@ -167,7 +167,7 @@
},
{
"column": "DateTimeChanged",
"mapped_to_column": "DHCP_DateTime",
"mapped_to_column": "cur_DateTime",
"css_classes": "col-sm-2",
"show": true,
"type": "label",
@@ -185,7 +185,7 @@
},
{
"column": "Watched_Value1",
"mapped_to_column": "DHCP_Name",
"mapped_to_column": "cur_Name",
"css_classes": "col-sm-2",
"show": true,
"type": "label",

0
front/plugins/website_monitor/README_ES.md Normal file → Executable file
View File