jokob-sk / NetAlertX

šŸ–§šŸ” WIFI / LAN intruder detector. Scans for devices connected to your network and alerts you if new and unknown devices are found.
GNU General Public License v3.0
2.74k stars 160 forks source link

DB locked error when calling webhook #280

Closed ajmathews closed 1 year ago

ajmathews commented 1 year ago

Describe the issue It started with Discord not showing the notifications correctly but that's covered in other issues reported. Soon after, I believe none of the webhook calls are succeeding. I stopped receiving the plain HTML notifications in Discord as well. When I try to 'test' the call using the UI, I get an error that the DB is locked.

Paste last few lines from pialert.log

You can use tail -20 /home/pi/pialert/front/log/pialert.log

I don't see any logs printing when I do this.

Paste your pialert.conf (remove personal info)


# General
#---------------------------
ENABLE_ARPSCAN=True
SCAN_SUBNETS=['192.168.1.0/24 --interface=eno1']
LOG_LEVEL='debug'
TIMEZONE='America/Chicago'
ENABLE_PLUGINS=True
PIALERT_WEB_PROTECTION=False
PIALERT_WEB_PASSWORD='zzz'
INCLUDED_SECTIONS=['internet','new_devices','down_devices','events']
SCAN_CYCLE_MINUTES=5
DAYS_TO_KEEP_EVENTS=90
REPORT_DASHBOARD_URL='http://pi.alert'
DIG_GET_IP_ARG='-4 myip.opendns.com @resolver1.opendns.com'
UI_LANG='English'
UI_PRESENCE=['online','offline','archived']

.....

# Webhooks
#---------------------------
REPORT_WEBHOOK=True
WEBHOOK_URL='https://discordapp.com/api/webhooks/123/321'
WEBHOOK_PAYLOAD='text'
WEBHOOK_REQUEST_METHOD='GET'

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

docker-compose.yml

  pialert:
    container_name: pialert
    image: "jokobsk/pi.alert:latest"
    network_mode: "host"
    restart: unless-stopped
    volumes:
      - ${CONFIG_DIR}/pialert/config:/home/pi/pialert/config
      - ${CONFIG_DIR}/pialert/api:/home/pi/pialert/front/api
      - ${TEMP_DIR}/pialert/db:/home/pi/pialert/db
      - ${TEMP_DIR}/pialert/logs:/home/pi/pialert/front/log
    environment:
      - TZ=${TZ}
      - HOST_USER_ID=${PUID}
      - HOST_USER_GID=${PGID}
      - PORT=20211

.env

paste_here

Screenshots

image

Soon after,

image

Appreciate any help or suggestions to get this working again. If it's best to start over, is there a way I can copy over the config changes (name, icons, etc.) for each devices?

jokob-sk commented 1 year ago

Hi there!

Can you please check the issue #271 ?

You can try the dev build mentioned in the above thread.

The DB locked message is expected behaviour if there is a background process going on.

If you still want to start from scratch after trying the above, you can use the Maintenance > Backup / Restore > Export to CSV, then rebuild the container and Import from CSV.

Please backup everything before proceeding.

J

ajmathews commented 1 year ago

Thanks @jokob-sk. I did see #271 and changed the payload type to 'text' but didn't work. I kept running into the locked DB every time I test run the webhook. I gave the dev image a go and I'm not getting the error anymore, but still not getting the Discord notification. I tried to start from scratch as well but it keeps failing on import of CSV.

image

I tried removing this record and it follows with another one, and so on.

jokob-sk commented 1 year ago

Hey!

The text webhook payload solution only works on the dev image as its not yet released.

The CSV error is sometimes caused by empty new lines at the end / start of the file or invalid line endings if the file was edited.

J

jokob-sk commented 1 year ago

I also noticed that in the CSV import error a " seems to be missing here. Might be caused by the error output though. Screenshot_20230706-181333-097

ajmathews commented 1 year ago

Thanks again for your quick responses! I did try using text and the dev image but I wasn't getting any messages.

I was however able to successfully import CSV. Looks like there was an invalid record in the generated CSV that was throwing it off. Pasting it here in case you're curious what it looked like.

image

For the notifications, I moved over to using Apprise and I'm unblocked for now. Feel free to close the issue. Appreciate the help!

jokob-sk commented 1 year ago

Great, thanks! > closing