Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to mount pihole database with ERROR: ATTACH DATABASE failed with SQL ERROR: database EXTERNAL_PIHOLE is already in use #513

Closed
Absoblogginlutely opened this issue Dec 2, 2023 · 19 comments
Labels
bug 🐛 Something isn't working next release/in dev image🚀 This is coming in the next release or was already released if the issue is Closed.

Comments

@Absoblogginlutely
Copy link

Describe the issue

When submitting an issue ❗enable debug❗ and have a look at the docs

Pihole database is not importing into my configuration.
Pihole is running in another container on the same host. Pihole database is mapped and visible in the pialert container with ls -al /
Same issue in non dev container - I tried the dev image to see if that would make any difference.
FYI The dev version tells me I'm up to date but the main version tells me that i'm out of date running 20231110

# ls -al /etc/pihole/pihole-FTL.db
-rw-rw-r-- 1 999 pi 16306176 Dec  2 10:04 /etc/pihole/pihole-FTL.db

As a result I just have my docker host and my router listed in the config and neither of the devices have a name listed.

Paste your pialert.conf (remove personal info)

#-----------------AUTOGENERATED FILE-----------------#
#                                                    #
#         Generated:  2023-12-02_09-47-35            #
#                                                    #
#   Config file for the LAN intruder detection app:  #
#      https://github.com/jokob-sk/Pi.Alert          #
#                                                    #
#-----------------AUTOGENERATED FILE-----------------#


# General
#---------------------------
LOG_LEVEL='debug'
LOG_LEVEL__metadata="{}"
TIMEZONE='America/New_York'
TIMEZONE__metadata="{}"
PLUGINS_KEEP_HIST=250
PLUGINS_KEEP_HIST__metadata="{}"
PIALERT_WEB_PROTECTION=True
PIALERT_WEB_PROTECTION__metadata="{}"
PIALERT_WEB_PASSWORD='e<snip>9'
PIALERT_WEB_PASSWORD__metadata="{}"
INCLUDED_SECTIONS=['new_devices','down_devices','events']
INCLUDED_SECTIONS__metadata="{}"
REPORT_DASHBOARD_URL='http://pi.alert:20211'
REPORT_DASHBOARD_URL__metadata="{}"
DIG_GET_IP_ARG='-4 myip.opendns.com @resolver1.opendns.com'
DIG_GET_IP_ARG__metadata="{}"
UI_LANG='English'
UI_LANG__metadata="{}"
UI_PRESENCE=['online','offline','archived']
UI_PRESENCE__metadata="{}"
DAYS_TO_KEEP_EVENTS=90
DAYS_TO_KEEP_EVENTS__metadata="{}"
HRS_TO_KEEP_NEWDEV=0
HRS_TO_KEEP_NEWDEV__metadata="{}"
DBCLNP_NOTIFI_HIST=100
DBCLNP_NOTIFI_HIST__metadata="{}"
API_CUSTOM_SQL='SELECT * FROM Devices WHERE dev_PresentLastScan = 0'
API_CUSTOM_SQL__metadata="{}"
NETWORK_DEVICE_TYPES=['AP','Gateway','Firewall','Hypervisor','Powerline','Switch','WLAN','PLC','Router','USB LAN Adapter','USB WIFI Adapter','Internet']
NETWORK_DEVICE_TYPES__metadata="{}"


# ARPSCAN
#---------------------------
SCAN_SUBNETS=['192.168.29.0/24 --interface=eth0']
SCAN_SUBNETS__metadata="{}"
ARPSCAN_RUN='disabled'
ARPSCAN_RUN__metadata="{\"function\": \"RUN\", \"type\": \"text.select\", \"default_value\": \"schedule\", \"options\": [\"disabled\", \"once\", \"schedule\", \"always_after_scan\", \"on_new_device\"], \"localized\": [\"name\", \"description\"], \"events\": [\"run\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"When to run\"}, {\"language_code\": \"es_es\", \"string\": \"Cuando ejecutar\"}, {\"language_code\": \"de_de\", \"string\": \"Wann ausf\\u00fchren\"}], \"description\": [{\"language_code\": \"en_us\", \"string\": \"Specify when your Network-discovery scan will run. Typical setting would be <code>schedule</code> and then you specify a cron-like schedule in the <a href=\\\"#ARPSCAN_RUN_SCHD\\\"><code>ARPSCAN_RUN_SCHD</code>setting</a> \"}, {\"language_code\": \"es_es\", \"string\": \"Especifique cu\\u00e1ndo se ejecutar\\u00e1 su an\\u00e1lisis de descubrimiento de red. La configuraci\\u00f3n t\\u00edpica ser\\u00eda <code>schedule</code> y luego se especifica una programaci\\u00f3n similar a cron en la configuraci\\u00f3n <a href=\\\"#ARPSCAN_RUN_SCHD\\\"><code>ARPSCAN_RUN_SCHD</code></a> \"}, {\"language_code\": \"de_de\", \"string\": \"Ausw\\u00e4hlen wann der Netzwerkscan laufen soll. Typischerweise wird <code>schedule</code> ausgew\\u00e4hlt und ein cron-Intervall in der <a href=\\\"#ARPSCAN_RUN_SCHD\\\"><code>ARPSCAN_RUN_SCHD</code>Einstellung</a> gesetzt.\"}]}"
ARPSCAN_CMD='python3 /home/pi/pialert/front/plugins/arp_scan/script.py userSubnets={subnets}'
ARPSCAN_CMD__metadata="{\"function\": \"CMD\", \"type\": \"readonly\", \"default_value\": \"python3 /home/pi/pialert/front/plugins/arp_scan/script.py userSubnets={subnets}\", \"options\": [], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"Command\"}, {\"language_code\": \"es_es\", \"string\": \"Comando\"}, {\"language_code\": \"de_de\", \"string\": \"Befehl\"}], \"description\": [{\"language_code\": \"en_us\", \"string\": \"Command to run. This should not be changed\"}, {\"language_code\": \"es_es\", \"string\": \"Comando para ejecutar. Esto no debe ser cambiado\"}, {\"language_code\": \"de_de\", \"string\": \"Auszuf\\u00fchrender Befehl. Dieser sollte nicht ge\\u00e4ndert werden\"}]}"
ARPSCAN_RUN_TIMEOUT=300
ARPSCAN_RUN_TIMEOUT__metadata="{\"function\": \"RUN_TIMEOUT\", \"type\": \"integer\", \"default_value\": 300, \"options\": [], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"Run timeout\"}, {\"language_code\": \"es_es\", \"string\": \"Tiempo l\\u00edmite de ejecuci\\u00f3n\"}, {\"language_code\": \"de_de\", \"string\": \"Zeitlimit\"}], \"description\": [{\"language_code\": \"en_us\", \"string\": \"Maximum time in seconds to wait for the script to finish. If this time is exceeded the script is aborted.\"}, {\"language_code\": \"es_es\", \"string\": \"Tiempo m\\u00e1ximo en segundos para esperar a que finalice el script. Si se supera este tiempo, se cancela el script.\"}, {\"language_code\": \"de_de\", \"string\": \"Maximale Zeit in Sekunden, die auf den Abschluss des Skripts gewartet werden soll. Bei \\u00dcberschreitung dieser Zeit wird das Skript abgebrochen.\"}]}"
ARPSCAN_RUN_SCHD='*/5 * * * *'
ARPSCAN_RUN_SCHD__metadata="{\"function\": \"RUN_SCHD\", \"type\": \"text\", \"default_value\": \"*/5 * * * *\", \"options\": [], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"Schedule\"}, {\"language_code\": \"es_es\", \"string\": \"Schedule\"}, {\"language_code\": \"de_de\", \"string\": \"Zeitplan\"}], \"description\": [{\"language_code\": \"en_us\", \"string\": \"Only enabled if you select <code>schedule</code> in the <a href=\\\"#ARPSCAN_RUN\\\"><code>ARPSCAN_RUN</code> setting</a>. Make sure you enter the schedule in the correct cron-like format (e.g. validate at <a href=\\\"https://crontab.guru/\\\" target=\\\"_blank\\\">crontab.guru</a>). For example entering <code>*/3 * * * *</code> will run the scan every 3 minutes. Will be run NEXT time the time passes. <br/> It's recommended to use the same schedule interval for all plugins responsible for discovering new devices.\"}, {\"language_code\": \"es_es\", \"string\": \"Solo est\\u00e1 habilitado si selecciona <code>schedule</code> en la configuraci\\u00f3n <a href=\\\"#ARPSCAN_RUN\\\"><code>ARPSCAN_RUN</code></a>. Aseg\\u00farese de ingresar la programaci\\u00f3n en el formato similar a cron correcto (por ejemplo, valide en <a href=\\\"https://crontab.guru/\\\" target=\\\"_blank\\\">crontab.guru</a>). Por ejemplo, ingresar <code>*/3 * * * *</code> ejecutar\\u00e1 el escaneo cada 3 minutos. Se ejecutar\\u00e1 la PR\\u00d3XIMA vez que pase el tiempo. <br/> Se recomienda utilizar el mismo intervalo de programaci\\u00f3n para todos los complementos que analizan su red.\"}, {\"language_code\": \"de_de\", \"string\": \"Nur aktiv, wenn <code>schedule</code> in der <a href=\\\"#ARPSCAN_RUN\\\"><code>ARPSCAN_RUN</code> Einstellung</a> ausgew\\u00e4hlt wurde. Sichergehen, dass das Intervall in einem korrekten cron-\\u00e4hnlichen Format angegeben wurde (z.B. auf <a href=\\\"https://crontab.guru/\\\" target=\\\"_blank\\\">crontab.guru</a> testen). <code>*/3 * * * *</code> w\\u00fcrde den Scan alle 3 Minuten starten. Wird erst beim N\\u00c4CHSTEN Intervall ausgef\\u00fchrt. <br/>Es wird empfohlen, das Intervall aller Plugins, welche nach neuen Ger\\u00e4ten suchen, auf den gleichen Wert zu setzen.\"}]}"
ARPSCAN_WATCH=['Watched_Value1','Watched_Value2']
ARPSCAN_WATCH__metadata="{\"function\": \"WATCH\", \"type\": \"text.multiselect\", \"default_value\": [\"Watched_Value1\", \"Watched_Value2\"], \"options\": [\"Watched_Value1\", \"Watched_Value2\", \"Watched_Value3\", \"Watched_Value4\"], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"Watched\"}, {\"language_code\": \"es_es\", \"string\": \"Watched\"}, {\"language_code\": \"de_de\", \"string\": \"\\u00dcberwacht\"}], \"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>\"}, {\"language_code\": \"es_es\", \"string\": \"Env\\u00eda una notificaci\\u00f3n si los valores seleccionados cambian. Utilice <code>CTRL + clic</code> para seleccionar/deseleccionar. <ul> <li><code>Valor_observado1</code> es IP</li><li><code>Valor_observado2</code> es Proveedor</li><li><code>Valor_observado3</code> es Interfaz </li><li><code>Valor_observado4</code> es N/A </li></ul>\"}, {\"language_code\": \"de_de\", \"string\": \"Sende eine Benachrichtigung, wenn ein ausgw\\u00e4hlter Wert sich \\u00e4ndert. <code>STRG + klicken</code> zum aus-/abw\\u00e4hlen. <ul> <li><code>Watched_Value1</code> ist die IP</li><li><code>Watched_Value2</code> ist der Hersteller</li><li><code>Watched_Value3</code> ist das Interface </li><li><code>Watched_Value4</code> ist nicht in Verwendung </li></ul>\"}]}"
ARPSCAN_REPORT_ON=['new']
ARPSCAN_REPORT_ON__metadata="{\"function\": \"REPORT_ON\", \"type\": \"text.multiselect\", \"default_value\": [\"new\"], \"options\": [\"new\", \"watched-changed\", \"watched-not-changed\", \"missing-in-last-scan\"], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"Report on\"}, {\"language_code\": \"es_es\", \"string\": \"Informar sobre\"}, {\"language_code\": \"de_de\", \"string\": \"Benachrichtige wenn\"}], \"description\": [{\"language_code\": \"en_us\", \"string\": \"When should notification be sent out.\"}, {\"language_code\": \"es_es\", \"string\": \"Cu\\u00e1ndo debe enviarse una notificaci\\u00f3n.\"}, {\"language_code\": \"de_de\", \"string\": \"Wann Benachrichtigungen gesendet werden sollen.\"}]}"
ARPSCAN_ARGS='sudo arp-scan --ignoredups --retry=6'
ARPSCAN_ARGS__metadata="{\"function\": \"ARGS\", \"type\": \"text\", \"default_value\": \"sudo arp-scan --ignoredups --retry=6\", \"options\": [], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"Arguments\"}], \"description\": [{\"language_code\": \"en_us\", \"string\": \"Arguments to run arps-scan with. Recommended and tested only with the setting: <br/> <code>sudo arp-scan --ignoredups --retry=6</code>.\"}]}"


# PIHOLE
#---------------------------
PIHOLE_RUN='schedule'
PIHOLE_RUN__metadata="{\"function\": \"RUN\", \"events\": [\"run\"], \"type\": \"text.select\", \"default_value\": \"disabled\", \"options\": [\"disabled\", \"once\", \"schedule\", \"always_after_scan\", \"on_new_device\"], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"When to run\"}, {\"language_code\": \"es_es\", \"string\": \"Cuando ejecutar\"}], \"description\": [{\"language_code\": \"en_us\", \"string\": \"Specify when your PiHole device import from the PiHole databse will run. The typical setting would be <code>schedule</code> and then you specify a cron-like schedule in the <a href=\\\"#PIHOLE_RUN_SCHD\\\"><code>PIHOLE_RUN_SCHD</code>setting</a>. If enabled, you must map the pihole db into your container to the <code>:/etc/pihole/pihole-FTL.db</code> mount path as specified in the <code>DB_PATH</code> setting.\"}, {\"language_code\": \"es_es\", \"string\": \"Especifique cu\\u00e1ndo se ejecutar\\u00e1 la importaci\\u00f3n de su dispositivo PiHole desde la base de datos de PiHole. La configuraci\\u00f3n t\\u00edpica ser\\u00eda <code>schedule</code> y luego especifica una programaci\\u00f3n similar a cron en la configuraci\\u00f3n <a href=\\\"#PIHOLE_RUN_SCHD\\\"><code>PIHOLE_RUN_SCHD</code></a>. Si est\\u00e1 habilitado, debe asignar la base de datos pihole en su contenedor a la ruta de montaje <code>:/etc/pihole/pihole-FTL.db</code> como se especifica en la configuraci\\u00f3n <code>DB_PATH</code>.\"}]}"
PIHOLE_CMD='SELECT n.hwaddr AS Object_PrimaryID, {s-quote}null{s-quote} AS Object_SecondaryID, datetime() AS DateTime, na.ip  AS Watched_Value1, n.lastQuery AS Watched_Value2, na.name AS Watched_Value3, n.macVendor AS Watched_Value4, {s-quote}null{s-quote} AS Extra, n.hwaddr AS ForeignKey FROM EXTERNAL_PIHOLE.Network AS n LEFT JOIN EXTERNAL_PIHOLE.Network_Addresses AS na ON na.network_id = n.id WHERE n.hwaddr NOT LIKE {s-quote}ip-%{s-quote} AND n.hwaddr <> {s-quote}00:00:00:00:00:00{s-quote} AND na.ip <> null;'
PIHOLE_CMD__metadata="{\"function\": \"CMD\", \"type\": \"text\", \"default_value\": \"SELECT n.hwaddr AS Object_PrimaryID, {s-quote}null{s-quote} AS Object_SecondaryID, datetime() AS DateTime, na.ip  AS Watched_Value1, n.lastQuery AS Watched_Value2, na.name AS Watched_Value3, n.macVendor AS Watched_Value4, {s-quote}null{s-quote} AS Extra, n.hwaddr AS ForeignKey FROM EXTERNAL_PIHOLE.Network AS n LEFT JOIN EXTERNAL_PIHOLE.Network_Addresses AS na ON na.network_id = n.id WHERE n.hwaddr NOT LIKE {s-quote}ip-%{s-quote} AND n.hwaddr <> {s-quote}00:00:00:00:00:00{s-quote} AND na.ip <> null;\", \"options\": [], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"SQL to run\"}, {\"language_code\": \"es_es\", \"string\": \"Consulta SQL\"}], \"description\": [{\"language_code\": \"en_us\", \"string\": \"This SQL query is used to populate the coresponding UI tables under the Plugins section. This particular one selects data from a mapped PiHole SQLite database and maps it to the corresponding Plugin columns.\"}, {\"language_code\": \"es_es\", \"string\": \"Esta consulta SQL se usa para completar las tablas de IU correspondientes en la secci\\u00f3n Complementos. Este en particular selecciona datos de una base de datos PiHole SQLite asignada y los asigna a las columnas correspondientes del complemento.\"}]}"
PIHOLE_DB_PATH='/etc/pihole/pihole-FTL.db'
PIHOLE_DB_PATH__metadata="{\"function\": \"DB_PATH\", \"type\": \"text\", \"default_value\": \"/etc/pihole/pihole-FTL.db\", \"options\": [], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"DB Path\"}, {\"language_code\": \"es_es\", \"string\": \"Ruta de la base de datos\"}], \"description\": [{\"language_code\": \"en_us\", \"string\": \"Required setting for the <code>sqlite-db-query</code> plugin type. Is used to mount an external SQLite database and execute the SQL query stored in the <code>CMD</code> setting.\"}, {\"language_code\": \"es_es\", \"string\": \"Configuraci\\u00f3n requerida para el tipo de complemento <code>sqlite-db-query</code>. Se utiliza para montar una base de datos SQLite externa y ejecutar la consulta SQL almacenada en la configuraci\\u00f3n <code>CMD</code>.\"}]}"
PIHOLE_RUN_SCHD='*/30 * * * *'
PIHOLE_RUN_SCHD__metadata="{\"function\": \"RUN_SCHD\", \"type\": \"text\", \"default_value\": \"*/30 * * * *\", \"options\": [], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"Schedule\"}, {\"language_code\": \"es_es\", \"string\": \"Programar\"}], \"description\": [{\"language_code\": \"en_us\", \"string\": \"Only enabled if you select <code>schedule</code> in the <a href=\\\"#ARPSCAN_RUN\\\"><code>ARPSCAN_RUN</code> setting</a>. Make sure you enter the schedule in the correct cron-like format (e.g. validate at <a href=\\\"https://crontab.guru/\\\" target=\\\"_blank\\\">crontab.guru</a>). For example entering <code>*/30 * * * *</code> will run the scan every 30 minutes. Will be run NEXT time the time passes. <br/> It's recommended to use the same schedule interval for all plugins responsible for discovering new devices.\"}, {\"language_code\": \"es_es\", \"string\": \"Solo est\\u00e1 habilitado si selecciona <code>schedule</code> en la configuraci\\u00f3n <a href=\\\"#ARPSCAN_RUN\\\"><code>ARPSCAN_RUN</code></a>. Aseg\\u00farese de ingresar la programaci\\u00f3n en el formato similar a cron correcto (por ejemplo, valide en <a href=\\\"https://crontab.guru/\\\" target=\\\"_blank\\\">crontab.guru</a>). Por ejemplo, ingresar <code>*/30 * * * *</code> ejecutar\\u00e1 el escaneo cada 30 minutos. Se ejecutar\\u00e1 la PR\\u00d3XIMA vez que pase el tiempo. <br/> Se recomienda utilizar el mismo intervalo de programaci\\u00f3n para todos los complementos que analizan su red.\"}]}"
PIHOLE_WATCH=['Watched_Value1','Watched_Value2']
PIHOLE_WATCH__metadata="{\"function\": \"WATCH\", \"type\": \"text.multiselect\", \"default_value\": [\"Watched_Value1\", \"Watched_Value2\"], \"options\": [\"Watched_Value1\", \"Watched_Value2\", \"Watched_Value3\", \"Watched_Value4\"], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"Watched\"}, {\"language_code\": \"es_es\", \"string\": \"Visto\"}], \"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 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\", \"string\": \"Env\\u00ede una notificaci\\u00f3n si los valores seleccionados cambian. Utilice <code>CTRL + clic</code> para seleccionar/deseleccionar. <ul> <li><code>Watched_Value1</code> es IP</li><li><code>Watched_Value2</code> es Proveedor</li><li><code>Watched_Value3</code> is es Interfaz</li><li><code>Watched_Value4</code> es N/A</li></ul>\"}]}"
PIHOLE_REPORT_ON=['new']
PIHOLE_REPORT_ON__metadata="{\"function\": \"REPORT_ON\", \"type\": \"text.multiselect\", \"default_value\": [\"new\"], \"options\": [\"new\", \"watched-changed\", \"watched-not-changed\", \"missing-in-last-scan\"], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"Report on\"}, {\"language_code\": \"es_es\", \"string\": \"Informar sobre\"}], \"description\": [{\"language_code\": \"en_us\", \"string\": \"When should notification be sent out.\"}, {\"language_code\": \"es_es\", \"string\": \"\\u00bfCu\\u00e1ndo se debe enviar la notificaci\\u00f3n?.\"}]}"


# UNDIS
#---------------------------
UNDIS_RUN='disabled'
UNDIS_RUN__metadata="{\"function\": \"RUN\", \"events\": [\"run\"], \"type\": \"text.select\", \"default_value\": \"disabled\", \"options\": [\"disabled\", \"once\", \"always_after_scan\"], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"When to run\"}, {\"language_code\": \"es_es\", \"string\": \"Cu\\u00e1ndo ejecuta\"}, {\"language_code\": \"de_de\", \"string\": \"Wann ausf\\u00fchren\"}], \"description\": [{\"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\\u00e1 habilitado, ONCE es la opci\\u00f3n preferida. Se ejecuta al inicio y despu\\u00e9s de cada guardado de la configuraci\\u00f3n aqu\\u00ed.<br> \\u00a1Los cambios solo se mostrar\\u00e1n en los dispositivos <b> despu\\u00e9s del pr\\u00f3ximo escaneo!</b>\"}, {\"language_code\": \"de_de\", \"string\": \"Wenn dieses Plugin aktiviert ist, ist <code>once</code> die bevorzugte Methode. Das Plugin wird dann bei jedem Start und nach jedem Speichern der Einstellungen ausgef\\u00fchrt.</br>\\u00c4nderungen scheinen in den Ger\\u00e4ten erst <b>nach dem n\\u00e4chsten Scan</b> auf!\"}]}"
UNDIS_CMD='python3 /home/pi/pialert/front/plugins/undiscoverables/script.py devices={devices}'
UNDIS_CMD__metadata="{\"function\": \"CMD\", \"type\": \"text\", \"default_value\": \"python3 /home/pi/pialert/front/plugins/undiscoverables/script.py devices={devices}\", \"options\": [], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"Command\"}, {\"language_code\": \"es_es\", \"string\": \"Comando\"}, {\"language_code\": \"de_de\", \"string\": \"Befehl\"}], \"description\": [{\"language_code\": \"en_us\", \"string\": \"Command to run. This can not be changed\"}, {\"language_code\": \"es_es\", \"string\": \"Comando a ejecutar. Esto no se puede cambiar\"}, {\"language_code\": \"de_de\", \"string\": \"Befehl zum Ausf\\u00fchren. Dies kann nicht ge\\u00e4ndert werden\"}]}"
UNDIS_RUN_TIMEOUT=10
UNDIS_RUN_TIMEOUT__metadata="{\"function\": \"RUN_TIMEOUT\", \"type\": \"integer\", \"default_value\": 10, \"options\": [], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"Run timeout\"}, {\"language_code\": \"es_es\", \"string\": \"Tiempo l\\u00edmite de ejecuci\\u00f3n\"}, {\"language_code\": \"de_de\", \"string\": \"Zeitlimit\"}], \"description\": [{\"language_code\": \"en_us\", \"string\": \"Maximum time in seconds to wait for the script to finish. If this time is exceeded the script is aborted.\"}, {\"language_code\": \"es_es\", \"string\": \"Tiempo m\\u00e1ximo en segundos para esperar a que finalice el script. Si se supera este tiempo, el script se cancela.\"}, {\"language_code\": \"de_de\", \"string\": \"Maximale Zeit in Sekunden, die auf den Abschluss des Skripts gewartet werden soll. Bei \\u00dcberschreitung dieser Zeit wird das Skript abgebrochen.\"}]}"
UNDIS_WATCH='[]'
UNDIS_WATCH__metadata="{\"function\": \"WATCH\", \"type\": \"readonly\", \"default_value\": [], \"options\": [], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"Watched\"}, {\"language_code\": \"es_es\", \"string\": \"Visto\"}, {\"language_code\": \"de_de\", \"string\": \"\\u00dcberwacht\"}], \"description\": [{\"language_code\": \"en_us\", \"string\": \"Undiscoverable Devices can not change their status, no watch is enabled.\"}, {\"language_code\": \"es_es\", \"string\": \"Los dispositivos no detectables no pueden cambiar su estado, ning\\u00fan reloj est\\u00e1 habilitado.\"}, {\"language_code\": \"de_de\", \"string\": \"Status von nicht erkennbaren Ger\\u00e4ten k\\u00f6nnen sich nicht \\u00e4ndern, keine \\u00dcberwachung aktiviert.\"}]}"
UNDIS_REPORT_ON='[]'
UNDIS_REPORT_ON__metadata="{\"function\": \"REPORT_ON\", \"type\": \"readonly\", \"default_value\": [], \"options\": [\"new\", \"watched-changed\", \"watched-not-changed\", \"missing-in-last-scan\"], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"Report on\"}, {\"language_code\": \"es_es\", \"string\": \"Informar sobre\"}, {\"language_code\": \"de_de\", \"string\": \"Benachrichtige wenn\"}], \"description\": [{\"language_code\": \"en_us\", \"string\": \"No notifications will be sent.\"}, {\"language_code\": \"es_es\", \"string\": \"No se enviar\\u00e1n notificaciones.\"}, {\"language_code\": \"de_de\", \"string\": \"Keine Benachrichtigungen werden versendet.\"}]}"
UNDIS_devices_to_import=['dummy_router']
UNDIS_devices_to_import__metadata="{\"function\": \"devices_to_import\", \"type\": \"list\", \"default_value\": [\"dummy_router\"], \"options\": [], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"UnDiscoverable Devices\"}, {\"language_code\": \"es_es\", \"string\": \"Dispositivo no detectable\"}, {\"language_code\": \"de_de\", \"string\": \"Nicht erkennbare Ger\\u00e4te\"}], \"description\": [{\"language_code\": \"en_us\", \"string\": \"Devices to be added to the devices list.\"}, {\"language_code\": \"es_es\", \"string\": \"Dispositivos que se a\\u00f1adir\\u00e1n a la lista de dispositivos.\"}, {\"language_code\": \"de_de\", \"string\": \"Ger\\u00e4te, welche der Ger\\u00e4teliste hinzugef\\u00fcgt werden.\"}]}"


# MAINT
#---------------------------
MAINT_RUN='schedule'
MAINT_RUN__metadata="{\"function\": \"RUN\", \"events\": [\"run\"], \"type\": \"text.select\", \"default_value\": \"schedule\", \"options\": [\"disabled\", \"once\", \"schedule\", \"always_after_scan\", \"on_new_device\"], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"When to run\"}, {\"language_code\": \"es_es\", \"string\": \"Cu\\u00e1ndo ejecutar\"}, {\"language_code\": \"de_de\", \"string\": \"Wann laufen\"}], \"description\": [{\"language_code\": \"en_us\", \"string\": \"When the maintenance tasks should run. A daily or weekly <code>SCHEDULE</code> is a good option.\"}]}"
MAINT_CMD='python3 /home/pi/pialert/front/plugins/maintenance/maintenance.py'
MAINT_CMD__metadata="{\"function\": \"CMD\", \"type\": \"readonly\", \"default_value\": \"python3 /home/pi/pialert/front/plugins/maintenance/maintenance.py\", \"options\": [], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"Command\"}, {\"language_code\": \"es_es\", \"string\": \"Comando\"}, {\"language_code\": \"de_de\", \"string\": \"Befehl\"}], \"description\": [{\"language_code\": \"en_us\", \"string\": \"Command to run. This can not be changed\"}, {\"language_code\": \"es_es\", \"string\": \"Comando a ejecutar. Esto no se puede cambiar\"}, {\"language_code\": \"de_de\", \"string\": \"Befehl zum Ausf\\u00fchren. Dies kann nicht ge\\u00e4ndert werden\"}]}"
MAINT_RUN_SCHD='0 2 * * 3'
MAINT_RUN_SCHD__metadata="{\"function\": \"RUN_SCHD\", \"type\": \"text\", \"default_value\": \"0 2 * * 3\", \"options\": [], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"Schedule\"}, {\"language_code\": \"es_es\", \"string\": \"Schedule\"}, {\"language_code\": \"de_de\", \"string\": \"Schedule\"}], \"description\": [{\"language_code\": \"en_us\", \"string\": \"Only enabled if you select <code>schedule</code> in the <a href=\\\"#MAINT_RUN\\\"><code>MAINT_RUN</code> setting</a>. Make sure you enter the schedule in the correct cron-like format (e.g. validate at <a href=\\\"https://crontab.guru/\\\" target=\\\"_blank\\\">crontab.guru</a>). For example entering <code>0 4 * * *</code> will run the scan after 4 am in the <a onclick=\\\"toggleAllSettings()\\\" href=\\\"#TIMEZONE\\\"><code>TIMEZONE</code> you set above</a>. Will be run NEXT time the time passes.\"}, {\"language_code\": \"es_es\", \"string\": \"Solo est\\u00e1 habilitado si selecciona <code>schedule</code> en la configuraci\\u00f3n <a href=\\\"#MAINT_RUN\\\"><code>MAINT_RUN</code></a>. Aseg\\u00farese de ingresar la programaci\\u00f3n en el formato similar a cron correcto (por ejemplo, valide en <a href=\\\"https://crontab.guru/\\\" target=\\\"_blank\\\">crontab.guru</a>). Por ejemplo, ingresar <code>0 4 * * *</code> ejecutar\\u00e1 el escaneo despu\\u00e9s de las 4 a.m. en el <a onclick=\\\"toggleAllSettings()\\\" href=\\\"#TIMEZONE\\\"><code>TIMEZONE</ c\\u00f3digo> que configur\\u00f3 arriba</a>. Se ejecutar\\u00e1 la PR\\u00d3XIMA vez que pase el tiempo.\"}, {\"language_code\": \"de_de\", \"string\": \"Nur aktiviert, wenn Sie <code>schedule</code> in der <a href=\\\"#CSVBCKP_RUN\\\"><code>CSVBCKP_RUN</code>-Einstellung</a> ausw\\u00e4hlen. Stellen Sie sicher, dass Sie den Zeitplan im richtigen Cron-\\u00e4hnlichen Format eingeben (z. B. validieren unter <a href=\\\"https://crontab.guru/\\\" target=\\\"_blank\\\">crontab.guru</a>). Wenn Sie beispielsweise <code>0 4 * * *</code> eingeben, wird der Scan nach 4 Uhr morgens in der <a onclick=\\\"toggleAllSettings()\\\" href=\\\"#TIMEZONE\\\"><code>TIMEZONE</ ausgef\\u00fchrt. Code> den Sie oben festgelegt haben</a>. Wird das N\\u00c4CHSTE Mal ausgef\\u00fchrt, wenn die Zeit vergeht.\"}]}"
MAINT_RUN_TIMEOUT=30
MAINT_RUN_TIMEOUT__metadata="{\"function\": \"RUN_TIMEOUT\", \"type\": \"integer\", \"default_value\": 30, \"options\": [], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"Run timeout\"}, {\"language_code\": \"es_es\", \"string\": \"Tiempo l\\u00edmite de ejecuci\\u00f3n\"}, {\"language_code\": \"de_de\", \"string\": \"Zeit\\u00fcberschreitung\"}], \"description\": [{\"language_code\": \"en_us\", \"string\": \"Maximum time in seconds to wait for the script to finish. If this time is exceeded the script is aborted.\"}, {\"language_code\": \"es_es\", \"string\": \"Tiempo m\\u00e1ximo en segundos para esperar a que finalice el script. Si se supera este tiempo, el script se cancela.\"}, {\"language_code\": \"de_de\", \"string\": \"Maximale Zeit in Sekunden, die auf den Abschluss des Skripts gewartet werden soll. Bei \\u00dcberschreitung dieser Zeit wird das Skript abgebrochen.\"}]}"
MAINT_LOG_LENGTH=250000
MAINT_LOG_LENGTH__metadata="{\"function\": \"LOG_LENGTH\", \"type\": \"integer\", \"default_value\": 250000, \"options\": [], \"localized\": [\"name\", \"description\"], \"name\": [{\"language_code\": \"en_us\", \"string\": \"Log length\"}], \"description\": [{\"language_code\": \"en_us\", \"string\": \"How many last <code>pialert.log</code> lines to keep. If <code>LOG_LEVEL</code> is set to <code>debug</code> the app generates about 10000 lines per hour, so when debugging an issue the recommended setting should cover the bug occurence timeframe. For example for a bug with a 3 day periodical appearence the value <code>1000000</code> should be sufficient. Setting this value to <code>1000000</code> generates approximatelly a 50MB <code>pialert.log</code> file. Set to <code>0</code> to disable log purging.\"}]}"


#-------------------IMPORTANT INFO-------------------#
#   This file is ingested by a python script, so if  #
#        modified it needs to use python syntax      #
#-------------------IMPORTANT INFO-------------------#

Paste your docker-compose.yml and .env (remove personal info)

docker-compose.yml

version: "3"
services:
  pialert:
    container_name: pialert
    # use the below line if you want to test the latest dev image
    # image: "jokobsk/pi.alert_dev:latest"
    image: "jokobsk/pi.alert_dev:latest"
    network_mode: "host"
    restart: unless-stopped
    volumes:
      - ./pialert/config:/home/pi/pialert/config
      - ./pialert/db:/home/pi/pialert/db
      # (optional) useful for debugging if you have issues setting up the container
      - ./pialert/logs:/home/pi/pialert/front/log
      - /home/docker/containers/pihole/etc-pihole:/etc/pihole
    environment:
      - TZ=America/New_York

.env

Not used.

Screenshots

[If applicable, add screenshots to help explain your problem.]

Paste last few lines from pialert.log

09:56:32 [MAIN] waiting to start next loop
09:56:37 [Config] No old setting names found in the file. No changes made.
09:56:37 [Import Config] checking config file
09:56:37 [Import Config] lastImportedConfFile     :1701528460.1413934
09:56:37 [Import Config] fileModifiedTime         :1701528460.1413934
09:56:37 [Import Config] skipping config file import
09:56:37 [2023-12-02 09:56:37-05:00] START Run: PIHOLE
09:56:37 [Plugins] setTyp: subnets
09:56:37 [Plugin utils] Flattening the below array
09:56:37 ['192.168.29.0/24 --interface=eth0']
09:56:37 [Plugin utils] isinstance(arr, list) : False | isinstance(arr, str) : True
09:56:37 [Plugins] Resolved value: 192.168.29.0/24 --interface=eth0
09:56:37 [Plugins] Convert to Base64: True
09:56:37 [Plugins] base64 value: b'MTkyLjE2OC4y-sniphere-0ZXJmYWNlPWV0aDA='
09:56:37 [Plugins] Timeout: 10
09:56:37 [Plugins] Executing: SELECT n.hwaddr AS Object_PrimaryID, 'null' AS Object_SecondaryID, datetime() AS DateTime, na.ip  AS Watched_Value1, n.lastQuery AS Watched_Value2, na.name AS Watched_Value3, n.macVendor AS Watched_Value4, 'null' AS Extra, n.hwaddr AS ForeignKey FROM EXTERNAL_PIHOLE.Network AS n LEFT JOIN EXTERNAL_PIHOLE.Network_Addresses AS na ON na.network_id = n.id WHERE n.hwaddr NOT LIKE 'ip-%' AND n.hwaddr <> '00:00:00:00:00:00' AND na.ip <> null;
09:56:37 [Plugins] ⚠ ERROR: DB_PATH setting (/etc/pihole/pihole-FTL.db) for plugin PIHOLE. Did you mount it correctly?
09:56:37 [Plugins] ⚠ ERROR: ATTACH DATABASE failed with SQL ERROR: database EXTERNAL_PIHOLE is already in use
09:56:37 [2023-12-02 09:56:37-05:00] END Run: PIHOLE
09:56:37 [API] Update API starting
09:56:37 [MAIN] waiting to start next loop
09:56:42 [Config] No old setting names found in the file. No changes made.
09:56:42 [Import Config] checking config file
09:56:42 [Import Config] lastImportedConfFile     :1701528460.1413934
09:56:42 [Import Config] fileModifiedTime         :1701528460.1413934
09:56:42 [Import Config] skipping config file import
09:56:42 [API] Update API starting
09:56:42 [MAIN] waiting to start next loop
@jokob-sk
Copy link
Owner

jokob-sk commented Dec 6, 2023

Hi there!

Thank you for the detailed description.

I haven't tried mounting the whole directory and I know it should not make a difference, but can you try mounting the DB file directly?

The new release bug should be fixed in the next release (#509).

Thanks in advance,
J

@jokob-sk jokob-sk added the Waiting for reply⏳ Waiting for the original poster to respond, or discussion in progress. label Dec 6, 2023
@Absoblogginlutely
Copy link
Author

Oddly enough, mounting the DB directly instead fixed the issue.
Thanks so much for the assistance.

@Absoblogginlutely
Copy link
Author

actually this didn't fix the issue so I'm reopening it (sorry). For some reason my page was cached and was appearing to show devices, but after reload this morning I'm back to just the router and docker image along with the unable to open file error in the log file -
06:34:03 [Plugins] ⚠ ERROR: DB_PATH setting (/etc/pihole/pihole-FTL.db) for plugin PIHOLE. Did you mount it correctly?
06:34:03 [Plugins] ⚠ ERROR: ATTACH DATABASE failed with SQL ERROR: database EXTERNAL_PIHOLE is already in use

@Absoblogginlutely
Copy link
Author

Did a bit of digging this morning and verified I can open the database in the docker container -
I remapped the volume so the whole directory is mapped, then ran the following.
Reloaded docker container with
docker compose up -d
launched shell
docker exec -it pi.alert sh
launched sqllite and queried database
sqlite3 /etc/pihole/pihole-FTL.db
select * from network
^d
This displayed all my devices, so I know the database can be read in docker successfully and does not have a lock.
the only thing I see is the pihole database has permissions 999:pi rather than most of the other files being root:root
The other 999:pi files are dhcp.leases, gravitydb

@jokob-sk
Copy link
Owner

I'm glad to hear that mounting the DB directly works - I'll close this issue as resolved then

@Absoblogginlutely
Copy link
Author

Mounting the db directly did not fix the issue unfortunately.

@jokob-sk jokob-sk reopened this Dec 11, 2023
@jokob-sk
Copy link
Owner

I released a new version which might have fixed this issue. Would be great if you could give it a try.

Thanks,
j

@Absoblogginlutely
Copy link
Author

Tried the new version with the same results as shown below.
The only thing I was thinking was permissions, but touching a file in /tmp gives me files running as root, so thats not an issue and the sqllite command also works successfully.

07:08:47 [Plugins] Executing: SELECT n.hwaddr AS Object_PrimaryID, 'null' AS Object_SecondaryID, datetime() AS DateTime, na.ip AS Watched_Value1, n.lastQuery AS Watched_Value2, na.name AS Watched_Value3, n.macVendor AS Watched_Value4, 'null' AS Extra, n.hwaddr AS ForeignKey FROM EXTERNAL_PIHOLE.Network AS n LEFT JOIN EXTERNAL_PIHOLE.Network_Addresses AS na ON na.network_id = n.id WHERE n.hwaddr NOT LIKE 'ip-%' AND n.hwaddr <> '00:00:00:00:00:00' AND na.ip <> null;
07:08:47 [Plugins] ⚠ ERROR: DB_PATH setting (/etc/pihole/pihole-FTL.db) for plugin PIHOLE. Did you mount it correctly?
07:08:47 [Plugins] ⚠ ERROR: ATTACH DATABASE failed with SQL ERROR: database EXTERNAL_PIHOLE is already in use
07:08:47 [2023-12-18 07:08:47-05:00] END Run: PIHOLE

cd /etc
ls -al
drwxr-xr-x 3 root root 4096 Dec 16 04:31 php
drwxrwxr-x 3 999 pi 4096 Dec 18 07:09 pihole
drwxr-xr-x 3 root root 4096 Dec 16 04:30 ppp
-rw-r--r-- 1 root root 769 Apr 10 2021 profile

cd pihole
ls -al
-rw-rw-r-- 1 999 root 176 Dec 13 12:38 pihole-FTL.conf
-rw-rw-r-- 1 999 pi 75358208 Dec 18 07:09 pihole-FTL.db
-rw-r--r-- 1 pi pi 47816704 Dec 10 06:41 pihole-FTLbak.db

~/containers/pialert/pialert/logs $ docker exec -it pialert sh

sqlite3 /etc/pihole/pihole-FTL.db

SQLite version 3.40.1 2022-12-28 14:03:47
Enter ".help" for usage hints.
sqlite> select * from network
...>

1|02:42:a3:aa:6e:10|br-72af1969fd3d|1701259680|0|0||
2|00:00:00:00:00:00|lo|1701259680|1702900800|13441|virtual interface|
3|02:42:ac:12:00:02|eth0@if9|1701259680|0|0||

This is back to mounting the directory and the live build, not the dev with the build from two days ago.

@DaCeige
Copy link

DaCeige commented Dec 18, 2023

on my build I would like to note that it appears to open the db on the first run... but not on subsequent runs.

Built on 2023-12-16
Installed version v23.12.16

Pi-hole [v5.17.2]
FTL [v5.23]
Web Interface [v5.21]

13:39:39 [MAIN] waiting to start next loop
13:39:44 [2023-12-18 13:39:44-05:00] START Run: PIHOLE
13:39:44 [Plugins] Executing: SELECT n.hwaddr AS Object_PrimaryID, 'null' AS Object_SecondaryID, datetime() AS DateTime, na.ip  AS Watched_Value1, n.lastQuery AS Watched_Value2, na.name AS Watched_Value3, n.macVendor AS Watched_Value4, 'null' AS Extra, n.hwaddr AS ForeignKey FROM EXTERNAL_PIHOLE.Network AS n LEFT JOIN EXTERNAL_PIHOLE.Network_Addresses AS na ON na.network_id = n.id WHERE n.hwaddr NOT LIKE 'ip-%' AND n.hwaddr <> '00:00:00:00:00:00' AND na.ip <> null;
13:39:44 [Plugins] No output received from the plugin PIHOLE - enable LOG_LEVEL=debug and check logs
13:39:44 [2023-12-18 13:39:44-05:00] END Run: PIHOLE
13:39:44 [MAIN] waiting to start next loop
13:39:49 [MAIN] waiting to start next loop
13:39:54 [MAIN] waiting to start next loop

Then the next time I manually launch it or it runs on a schedule:

13:40:47 [Send API] Updating notification_* files in /home/pi/pialert/front/api/
13:40:47 [Notification] Notifications changes: 6
13:40:47 [MAIN] Process: Wait
13:40:52 [2023-12-18 13:40:52-05:00] START Run: PIHOLE
13:40:52 [Plugins] Executing: SELECT n.hwaddr AS Object_PrimaryID, 'null' AS Object_SecondaryID, datetime() AS DateTime, na.ip  AS Watched_Value1, n.lastQuery AS Watched_Value2, na.name AS Watched_Value3, n.macVendor AS Watched_Value4, 'null' AS Extra, n.hwaddr AS ForeignKey FROM EXTERNAL_PIHOLE.Network AS n LEFT JOIN EXTERNAL_PIHOLE.Network_Addresses AS na ON na.network_id = n.id WHERE n.hwaddr NOT LIKE 'ip-%' AND n.hwaddr <> '00:00:00:00:00:00' AND na.ip <> null;
13:40:52 [Plugins] ⚠ ERROR: DB_PATH setting (/etc/pihole/pihole-FTL.db) for plugin PIHOLE. Did you mount it correctly?
13:40:52 [Plugins] ⚠ ERROR: ATTACH DATABASE failed with SQL ERROR: database EXTERNAL_PIHOLE is already in use
13:40:52 [2023-12-18 13:40:52-05:00] END Run: PIHOLE
13:40:52 [API] Updating table_devices.json file in /front/api
13:40:52 [API] Updating table_plugins_events.json file in /front/api
13:40:52 [API] Updating table_notifications.json file in /front/api
13:40:52 [API] Updating table_custom_endpoint.json file in /front/api
13:40:52 [MAIN] waiting to start next loop
13:40:58 [MAIN] waiting to start next loop
13:41:03 [MAIN] waiting to start next loop

I also observed that when pialert was 'attached' to the database, I could not clear the network table in pihole, it said the database was locked. (Pihole couldn't get a lock on the database either).

@helfrichmichael
Copy link

Hitting this issue also on the latest build.

I've binded the file correctly and looking within the container I see the following:

root@872538346d08:/# ls -la /etc/pihole/pihole-FTL.db 
-rw-rw-r-- 1 999 pi 145170432 Dec 20 10:33 /etc/pihole/pihole-FTL.db

I can cat the file, etc within the container also so I don't believe it's a permissions issue, but in the logs when I test this it fails consistently with:

10:31:28 [Plugins] Executing: SELECT n.hwaddr AS Object_PrimaryID, 'null' AS Object_SecondaryID, datetime() AS DateTime, na.ip  AS Watched_Value1, n.lastQuery AS Watched_Value2, na.name AS Watched_Value3, n.macVendor AS Watched_Value4, 'null' AS Extra, n.hwaddr AS ForeignKey FROM EXTERNAL_PIHOLE.Network AS n LEFT JOIN EXTERNAL_PIHOLE.Network_Addresses AS na ON na.network_id = n.id WHERE n.hwaddr NOT LIKE 'ip-%' AND n.hwaddr <> '00:00:00:00:00:00' AND na.ip <> null;
10:31:28 [Plugins] ⚠ ERROR: DB_PATH setting (/etc/pihole/pihole-FTL.db) for plugin PIHOLE. Did you mount it correctly?
10:31:28 [Plugins] ⚠ ERROR: ATTACH DATABASE failed with SQL ERROR: database EXTERNAL_PIHOLE is already in use
10:31:28 [2023-12-20 10:31:28-05:00] END Run: PIHOLE

@IamTheLoki
Copy link

IamTheLoki commented Dec 21, 2023

I have the same Problem...

01:00:33 [2023-12-21 01:00:33+01:00] START Run: PIHOLE
01:00:33 [Plugins] Executing: SELECT n.hwaddr AS Object_PrimaryID, 'null' AS Object_SecondaryID, datetime() AS DateTime, na.ip  AS Watched_Value1, n.lastQuery AS Watched_Value2, na.name AS Watched_Value3, n.macVendor AS Watched_Value4, 'null' AS Extra, n.hwaddr AS ForeignKey FROM EXTERNAL_PIHOLE.Network AS n LEFT JOIN EXTERNAL_PIHOLE.Network_Addresses AS na ON na.network_id = n.id WHERE n.hwaddr NOT LIKE 'ip-%' AND n.hwaddr <> '00:00:00:00:00:00' AND na.ip <> null;
01:00:33 [Plugins] ⚠ ERROR: DB_PATH setting (/etc/pihole/pihole-FTL.db) for plugin PIHOLE. Did you mount it correctly?
01:00:33 [Plugins] ⚠ ERROR: ATTACH DATABASE failed with SQL ERROR: database EXTERNAL_PIHOLE is already in use
01:00:33 [2023-12-21 01:00:33+01:00] END Run: PIHOLE

jokob-sk added a commit that referenced this issue Dec 21, 2023
@jokob-sk
Copy link
Owner

This should be fixed in the pi.alert_dev image after the above build finishes. Let me know if it works on your end.
Thanks,
j

@Absoblogginlutely
Copy link
Author

Updated to the latest dev version this morning and can confirm the devices now import successfully from pihole. so thank you so much for fixing that.

However, the devices page header shows 70+ devices but connected only shows 2 devices, the pi and the router and selecting all devices doesn't actually show any of the devices at all.

@jokob-sk
Copy link
Owner

@Absoblogginlutely thanks for checking.

Can you provide screenshots and logs to illustrate the issue more? It's possible the input from PiHole isn't processed correctly (e.g.: a device name may break the HTML code, or the validation for IP addresses etc.) so for that I need a bit more information to determine if there is a bug somewhere in the UI.

@Absoblogginlutely
Copy link
Author

Sure, my main screen looks like this -
image
I did notice that my arp scan was set to the default range rather than my actual ip, so I just updated it and ran. The scan is now showing up almost correctly.
The initial load of all devices shows 0 devices as per the screenshot above, but if I then click on connected, the devices show up as per this screenshot -
image
Note it shows 2 devices in the count but about 48 actually online.
subsequent reloads of the page however is still showing me the blank page in the first screenshot - it's almost like the connected buttons are not being pushed

Log file with ip switched out for a.b.c. and waiting lines snipped attached.
pialertlog.txt

@jokob-sk
Copy link
Owner

@Absoblogginlutely thanks for that. At first - can you make sure all your scans are running on the same schedule? For example in my case all scans run on a 5 minute interval. If you have different intervals you will get the pattern you see in the second screenshot.

image

@jokob-sk jokob-sk added the next release/in dev image🚀 This is coming in the next release or was already released if the issue is Closed. label Jan 1, 2024
@Absoblogginlutely
Copy link
Author

@Absoblogginlutely thanks for that. At first - can you make sure all your scans are running on the same schedule? For example in my case all scans run on a 5 minute interval. If you have different intervals you will get the pattern you see in the second screenshot.

Scans are now synched up and the header of the main page now shows all devices online, which fixes part of the issue now, however the connected area is still blank where I'd expect it to show devices
Screenshot - 1_3_2024 , 8_12_28 AM

@jokob-sk
Copy link
Owner

jokob-sk commented Jan 3, 2024

@Absoblogginlutely this is now probably a different issue and might be related to: https://github.com/jokob-sk/Pi.Alert/issues/523

Can you check that thread and the browser dev tools if the issues are similar and you have IP v6 addresses on your network?

@jokob-sk jokob-sk added bug 🐛 Something isn't working and removed Waiting for reply⏳ Waiting for the original poster to respond, or discussion in progress. labels Jan 5, 2024
@jokob-sk
Copy link
Owner

Released -> Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working next release/in dev image🚀 This is coming in the next release or was already released if the issue is Closed.
Projects
None yet
Development

No branches or pull requests

5 participants