leiweibau / Pi.Alert

Scan the devices connected to your WIFI / LAN and alert you the connection of unknown devices. It also warns if a "always connected" device disconnects. In addition, it is possible to check web services for availability. For this purpose HTTP status codes and the response time of the service are evaluated.
https://leiweibau.net
GNU General Public License v3.0
434 stars 31 forks source link

[Bug] Error when opening the database #336

Closed Trrw closed 3 months ago

Trrw commented 3 months ago

Is there an existing issue for this?

Current Behavior

Hello, when I press Scan under Settings in Logviewer, the following message appears:

Pi.Alert v2024-07-04

Executing user: root

Scan Devices Timestamp: 2024-07-11 23:15:00 Traceback (most recent call last): File "/opt/pialert/back/pialert.py", line 3375, in sys.exit(main())
^^^^^^ File "/opt/pialert/back/pialert.py", line 95, in main res = scan_network() ^^^^^^^^^^^^^^ File "/opt/pialert/back/pialert.py", line 700, in scan_network scanCycle_data = query_ScanCycle_Data (True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/pialert/back/pialert.py", line 816, in query_ScanCycle_Data openDB() File "/opt/pialert/back/pialert.py", line 3326, in openDB sql_connection = sqlite3.connect (DB_PATH, isolation_level=None) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ sqlite3.OperationalError: unable to open database file

Environment

LXC Container in Proxmox Installed with https://tteck.github.io/Proxmox/ (Proxmox Service Helper)

Anything else?

No response

leiweibau commented 3 months ago

Can you show me the „General Settings“ section of your pialert.conf file? Can you show me the contents of the folder to which the configuration file points? Is this an update, or has Pi.Alert been clean installed with the container?

Trrw commented 3 months ago

Hello, I have freshly installed pialert.

Bildschirmfoto 2024-07-12 um 13 17 17 Bildschirmfoto 2024-07-12 um 13 17 58

General Settings

----------------------

PIALERT_PATH = '/home/pi/pialert' DB_PATH = PIALERT_PATH + '/db/pialert.db' LOG_PATH = PIALERT_PATH + '/log' PRINT_LOG = False VENDORS_DB = '/usr/share/arp-scan/ieee-oui.txt' PIALERT_APIKEY = '' PIALERT_WEB_PROTECTION = False PIALERT_WEB_PASSWORD = 'XXXXXX' NETWORK_DNS_SERVER = 'localhost' AUTO_UPDATE_CHECK = True AUTO_UPDATE_CHECK_CRON = '0 3,9,15,21 *'

The shortest interval is 3 minutes. All larger intervals must be integer multiples of 3 minutes.

AUTO_DB_BACKUP = False AUTO_DB_BACKUP_CRON = '0 3 /2 *'

The shortest interval is 3 minutes. All larger intervals must be integer multiples of 3 minutes.

AUTO_DB_BACKUP_KEEP = 5

Other Modules

----------------------

SCAN_WEBSERVICES = True ICMPSCAN_ACTIVE = True SATELLITES_ACTIVE = False

Special Protocol Scanning

----------------------

SCAN_ROGUE_DHCP = False DHCP_SERVER_ADDRESS = '0.0.0.0'

Mail-Account Settings

----------------------

SMTP_SERVER = 'XXX' SMTP_PORT = 587 SMTP_USER = 'XXX@XXXX' SMTP_PASS = 'XXX' SMTP_SKIP_TLS = False SMTP_SKIP_LOGIN = False

WebGUI Reporting

----------------------

REPORT_WEBGUI = True REPORT_WEBGUI_WEBMON = True

Mail Reporting

----------------------

REPORT_MAIL = True REPORT_MAIL_WEBMON = True REPORT_FROM = 'Pi.Alert <' + SMTP_USER + '>' REPORT_TO = 'XXX@XXX' REPORT_DEVICE_URL = 'http://pi.alert/deviceDetails.php?mac=' REPORT_DASHBOARD_URL = 'http://pi.alert/'

Pushsafer

----------------------

REPORT_PUSHSAFER = False REPORT_PUSHSAFER_WEBMON = False PUSHSAFER_TOKEN = 'ApiKey' PUSHSAFER_DEVICE = 'a' PUSHSAFER_PRIO = 0 PUSHSAFER_SOUND = 22

Pushover

----------------------

REPORT_PUSHOVER = True REPORT_PUSHOVER_WEBMON = True PUSHOVER_TOKEN = 'XXXXX' PUSHOVER_USER = 'XXXXX' PUSHOVER_PRIO = 0 PUSHOVER_SOUND = 'siren'

NTFY

---------------------------

REPORT_NTFY = False REPORT_NTFY_WEBMON = False NTFY_HOST = 'https://ntfy.sh' NTFY_TOPIC = 'replace_my_secure_topicname_91h889f28' NTFY_USER = 'user' NTFY_PASSWORD = 'password' NTFY_PRIORITY = 'default' NTFY_CLICKABLE = True

Shoutrrr

----------------------

SHOUTRRR_BINARY = 'armhf'

SHOUTRRR_BINARY = 'armhf'

SHOUTRRR_BINARY = 'arm64'

SHOUTRRR_BINARY = 'x86'

Telegram via Shoutrrr

----------------------

REPORT_TELEGRAM = False REPORT_TELEGRAM_WEBMON = False TELEGRAM_BOT_TOKEN_URL = '<Your generated servive URL for telegram - use $HOME/pialert/back/shoutrrr//shoutrrr generate telegram>'

DynDNS and IP

----------------------

QUERY_MYIP_SERVER = 'https://myipv4.p1.opendns.com/get_my_ip' DDNS_ACTIVE = False DDNS_DOMAIN = 'your_domain.freeddns.org' DDNS_USER = 'dynu_user' DDNS_PASSWORD = 'A0000000B0000000C0000000D0000000' DDNS_UPDATE_URL = 'https://api.dynu.com/nic/update?'

Automatic Speedtest

----------------------

SPEEDTEST_TASK_ACTIVE = False SPEEDTEST_TASK_CRON = '00 7,22 *'

The shortest interval is 3 minutes. All larger intervals must be integer multiples of 3 minutes.

Arp-scan Options & Samples

----------------------

ARPSCAN_ACTIVE = True MAC_IGNORE_LIST = [] SCAN_SUBNETS = '--localnet'

SCAN_SUBNETS = '--localnet'

SCAN_SUBNETS = '--localnet --interface=eth0'

SCAN_SUBNETS = ['192.168.1.0/24 --interface=eth0','192.168.2.0/24 --interface=eth1']

ICMP Monitoring Options

----------------------

ICMP_ONLINE_TEST = 1 ICMP_GET_AVG_RTT = 2

Pi-hole Configuration

----------------------

PIHOLE_ACTIVE = False PIHOLE_DB = '/etc/pihole/pihole-FTL.db' DHCP_ACTIVE = False DHCP_LEASES = '/etc/pihole/dhcp.leases'

Fritzbox Configuration

----------------------

FRITZBOX_ACTIVE = False FRITZBOX_IP = '192.168.17.1' FRITZBOX_USER = 'user' FRITZBOX_PASS = 'password'

Mikrotik Configuration

----------------------

MIKROTIK_ACTIVE = False MIKROTIK_IP = '10.0.0.1' MIKROTIK_USER = 'user' MIKROTIK_PASS = 'password'

UniFi Configuration

-------------------

UNIFI_ACTIVE = False UNIFI_IP = '10.0.0.2' UNIFI_API = 'v5' UNIFI_USER = 'user' UNIFI_PASS = 'password'

Possible UNIFI APIs are v4, v5, unifiOS, UDMP-unifiOS, default

Satellite Configuration

-----------------------

SATELLITE_PROXY_MODE = False SATELLITE_PROXY_URL = ''

Maintenance Tasks Cron

----------------------

DAYS_TO_KEEP_ONLINEHISTORY = 30 DAYS_TO_KEEP_EVENTS = 90

leiweibau commented 3 months ago

Something has gone wrong here.

I assume that the path "/opt/pialert/" is the correct one. Does the folder "/opt/pialert/db/" exist?

Please change this in the configuration file: PIALERT_PATH = '/home/pi/pialert' to PIALERT_PATH = '/opt/pialert'

Trrw commented 3 months ago

Thank you for your help! Now it works :)