mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-06 17:15:38 -08:00
Maintain "cleanup" Section of pialert.py
Add Config Parameters No defaults set if they are missing. Will follow soon.
This commit is contained in:
@@ -264,15 +264,20 @@ def cleanup_database ():
|
||||
print (' Timestamp:', startTime )
|
||||
|
||||
openDB()
|
||||
|
||||
strdaystokeepOH = str(DAYS_TO_KEEP_ONLINEHISTORY)
|
||||
strdaystokeepEV = str(DAYS_TO_KEEP_EVENTS)
|
||||
# Cleanup Online History
|
||||
print ('\nCleanup Online_History...')
|
||||
sql.execute ("""DELETE FROM Online_History WHERE Scan_Date <= date('now', '-1 day')""")
|
||||
print ('\nOptimize Database...')
|
||||
print ('\nCleanup Online_History, up to the lastest '+strdaystokeepOH+' days...')
|
||||
sql.execute ("DELETE FROM Online_History WHERE Scan_Date <= date('now', '-"+strdaystokeepOH+" day')")
|
||||
# Cleanup Events
|
||||
print ('\nCleanup Events, up to the lastest '+strdaystokeepEV+' days...')
|
||||
sql.execute ("DELETE FROM Events WHERE eve_DateTime <= date('now', '-"+strdaystokeepEV+" day')")
|
||||
# Shrink DB
|
||||
print ('\nShrink Database...')
|
||||
sql.execute ("VACUUM;")
|
||||
|
||||
closeDB()
|
||||
|
||||
|
||||
# OK
|
||||
return 0
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
# Puche 2021 pi.alert.application@gmail.com GNU GPLv3
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# General Settings
|
||||
# ----------------------
|
||||
PIALERT_PATH = '/home/pi/pialert'
|
||||
DB_PATH = PIALERT_PATH + '/db/pialert.db'
|
||||
LOG_PATH = PIALERT_PATH + '/log'
|
||||
@@ -16,6 +18,8 @@ TIMEZONE = 'Europe/Berlin'
|
||||
PIALERT_WEB_PROTECTION = False
|
||||
PIALERT_WEB_PASSWORD = '8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92'
|
||||
|
||||
# Mail-Account Settings
|
||||
# ----------------------
|
||||
SMTP_SERVER = 'smtp.gmail.com'
|
||||
SMTP_PORT = 587
|
||||
SMTP_USER = 'user@gmail.com'
|
||||
@@ -23,18 +27,26 @@ SMTP_PASS = 'password'
|
||||
SMTP_SKIP_TLS = False
|
||||
SMTP_SKIP_LOGIN = False
|
||||
|
||||
# Mail Reporting
|
||||
# ----------------------
|
||||
REPORT_MAIL = False
|
||||
REPORT_FROM = 'Pi.Alert <' + SMTP_USER +'>'
|
||||
REPORT_TO = 'user@gmail.com'
|
||||
REPORT_DEVICE_URL = 'http://pi.alert/deviceDetails.php?mac='
|
||||
REPORT_DASHBOARD_URL = 'http://pi.alert/'
|
||||
|
||||
# Pushsafer
|
||||
# ----------------------
|
||||
REPORT_PUSHSAFER = False
|
||||
PUSHSAFER_TOKEN = 'ApiKey'
|
||||
|
||||
# ntfy
|
||||
# ----------------------
|
||||
REPORT_NTFY = False
|
||||
NTFY_TOPIC = 'replace_my_secure_topicname_91h889f28'
|
||||
|
||||
# DynDNS
|
||||
# ----------------------
|
||||
# QUERY_MYIP_SERVER = 'https://diagnostic.opendns.com/myip'
|
||||
QUERY_MYIP_SERVER = 'http://ipv4.icanhazip.com'
|
||||
DDNS_ACTIVE = False
|
||||
@@ -43,8 +55,15 @@ DDNS_USER = 'dynu_user'
|
||||
DDNS_PASSWORD = 'A0000000B0000000C0000000D0000000'
|
||||
DDNS_UPDATE_URL = 'https://api.dynu.com/nic/update?'
|
||||
|
||||
# Pi-hole Configuration
|
||||
# ----------------------
|
||||
PIHOLE_ACTIVE = False
|
||||
PIHOLE_DB = '/etc/pihole/pihole-FTL.db'
|
||||
DHCP_ACTIVE = False
|
||||
DHCP_LEASES = '/etc/pihole/dhcp.leases'
|
||||
|
||||
# Maintenance Tasks Cron
|
||||
# ----------------------
|
||||
DAYS_TO_KEEP_ONLINEHISTORY = 30
|
||||
DAYS_TO_KEEP_EVENTS = 90
|
||||
|
||||
|
||||
Reference in New Issue
Block a user