logs fixes
This commit is contained in:
@@ -106,7 +106,7 @@ Instructions for [pucherot's original code can be found here](https://github.com
|
||||
|
||||
<!--- --------------------------------------------------------------------- --->
|
||||
[main]: ./docs/img/devices_split.png "Main screen"
|
||||
[screen1]: ./docs/img/devices_details.png "Screen 1"
|
||||
[screen1]: ./docs/img/device_details.png "Screen 1"
|
||||
[screen2]: ./docs/img/events.png "Screen 2"
|
||||
[screen3]: ./docs/img/presence.png "Screen 3"
|
||||
[screen4]: ./docs/img/maintenance.png "Screen 4"
|
||||
|
||||
@@ -506,7 +506,7 @@ def main ():
|
||||
# proceed if 1 minute passed
|
||||
if last_run + timedelta(minutes=1) < time_now :
|
||||
|
||||
# last time any scan or maintennace was run
|
||||
# last time any scan or maintennace/Upkeep was run
|
||||
last_run = time_now
|
||||
|
||||
reporting = False
|
||||
@@ -552,7 +552,7 @@ def main ():
|
||||
# Final message
|
||||
if cycle != "":
|
||||
action = str(cycle)
|
||||
if cycle == "1":
|
||||
if action == "1":
|
||||
action = "network_scan"
|
||||
file_print('[', time_now.replace (microsecond=0), '] Last action: ', action)
|
||||
cycle = ""
|
||||
@@ -575,7 +575,7 @@ def check_internet_IP ():
|
||||
reporting = False
|
||||
|
||||
# Header
|
||||
updateState("Scanning: Internet IP")
|
||||
updateState("Scan: Internet IP")
|
||||
file_print('[', startTime, '] Check Internet IP:')
|
||||
|
||||
# Get Internet IP
|
||||
@@ -744,18 +744,18 @@ def check_IP_format (pIP):
|
||||
#===============================================================================
|
||||
def cleanup_database ():
|
||||
# Header
|
||||
updateState("Maintenance: DB cleanup")
|
||||
file_print('[', startTime, '] Cleanup Database:' )
|
||||
updateState("Upkeep: Clean DB")
|
||||
file_print('[', startTime, '] Upkeep Database:' )
|
||||
|
||||
openDB()
|
||||
|
||||
# Cleanup Online History
|
||||
file_print(' Cleanup Online_History')
|
||||
file_print(' Upkeep Online_History')
|
||||
sql.execute ("DELETE FROM Online_History WHERE Scan_Date <= date('now', '-1 day')")
|
||||
file_print(' Optimize Database')
|
||||
|
||||
# Cleanup Events
|
||||
file_print(' Cleanup Events, up to the lastest '+str(DAYS_TO_KEEP_EVENTS)+' days')
|
||||
file_print(' Upkeep Events, up to the lastest '+str(DAYS_TO_KEEP_EVENTS)+' days')
|
||||
sql.execute ("DELETE FROM Events WHERE eve_DateTime <= date('now', '-"+str(DAYS_TO_KEEP_EVENTS)+" day')")
|
||||
|
||||
# Shrink DB
|
||||
@@ -769,11 +769,11 @@ def cleanup_database ():
|
||||
#===============================================================================
|
||||
def update_devices_MAC_vendors (pArg = ''):
|
||||
# Header
|
||||
updateState("Maintenance: Update HW Vendors")
|
||||
file_print('[', startTime, '] Update HW Vendors:' )
|
||||
updateState("Upkeep: Vendors")
|
||||
file_print('[', startTime, '] Upkeep - Update HW Vendors:' )
|
||||
|
||||
# Update vendors DB (iab oui)
|
||||
file_print('\nUpdating vendors DB (iab & oui)')
|
||||
file_print(' Updating vendors DB (iab & oui)')
|
||||
# update_args = ['sh', PIALERT_BACK_PATH + '/update_vendors.sh', ' > ', logPath + '/update_vendors.log', '2>&1']
|
||||
update_args = ['sh', PIALERT_BACK_PATH + '/update_vendors.sh', pArg]
|
||||
|
||||
@@ -794,7 +794,7 @@ def update_devices_MAC_vendors (pArg = ''):
|
||||
notFound = 0
|
||||
|
||||
# All devices loop
|
||||
file_print('\nSearching devices vendor')
|
||||
file_print(' Searching devices vendor')
|
||||
openDB()
|
||||
for device in sql.execute ("SELECT * FROM Devices") :
|
||||
# Search vendor in HW Vendors DB
|
||||
@@ -889,7 +889,7 @@ def scan_network ():
|
||||
# # devtest end
|
||||
|
||||
# Header
|
||||
updateState("Scanning: Network")
|
||||
updateState("Scan: Network")
|
||||
file_print('[', startTime, '] Scan Devices:' )
|
||||
file_print(' ScanCycle:', cycle)
|
||||
|
||||
@@ -1945,38 +1945,38 @@ def email_reporting ():
|
||||
file_print(' Changes detected, sending reports')
|
||||
|
||||
if REPORT_MAIL and check_config('email'):
|
||||
updateState("Sending: Email")
|
||||
updateState("Send: Email")
|
||||
file_print(' Sending report by Email')
|
||||
send_email (mail_text, mail_html)
|
||||
else :
|
||||
file_print(' Skip mail')
|
||||
if REPORT_APPRISE and check_config('apprise'):
|
||||
updateState("Sending: Apprise")
|
||||
updateState("Send: Apprise")
|
||||
file_print(' Sending report by Apprise')
|
||||
send_apprise (mail_html)
|
||||
else :
|
||||
file_print(' Skip Apprise')
|
||||
if REPORT_WEBHOOK and check_config('webhook'):
|
||||
updateState("Sending: Webhook")
|
||||
updateState("Send: Webhook")
|
||||
file_print(' Sending report by Webhook')
|
||||
send_webhook (json_final, mail_text)
|
||||
else :
|
||||
file_print(' Skip webhook')
|
||||
if REPORT_NTFY and check_config('ntfy'):
|
||||
updateState("Sending: NTFY")
|
||||
updateState("Send: NTFY")
|
||||
file_print(' Sending report by NTFY')
|
||||
send_ntfy (mail_text)
|
||||
else :
|
||||
file_print(' Skip NTFY')
|
||||
if REPORT_PUSHSAFER and check_config('pushsafer'):
|
||||
updateState("Sending: PUSHSAFER")
|
||||
updateState("Send: PUSHSAFER")
|
||||
file_print(' Sending report by PUSHSAFER')
|
||||
send_pushsafer (mail_text)
|
||||
else :
|
||||
file_print(' Skip PUSHSAFER')
|
||||
# Update MQTT entities
|
||||
if REPORT_MQTT and check_config('mqtt'):
|
||||
updateState("Sending: MQTT")
|
||||
updateState("Send: MQTT")
|
||||
file_print(' Establishing MQTT thread')
|
||||
mqtt_start()
|
||||
else :
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
|
||||
🐳 [Docker hub](https://registry.hub.docker.com/r/jokobsk/pi.alert) | 📄 [Dockerfile](https://github.com/jokob-sk/Pi.Alert/blob/main/Dockerfile) | 📚 [Docker instructions](https://github.com/jokob-sk/Pi.Alert/blob/main//dockerfiles/README.md)
|
||||
|
||||
<a href="https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/1_devices.jpg" target="_blank">
|
||||
<img src="https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/1_devices.jpg" width="300px" />
|
||||
<a href="https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/devices_split.png" target="_blank">
|
||||
<img src="https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/devices_split.png" width="300px" />
|
||||
</a>
|
||||
<a href="https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/2_4_network.png" target="_blank">
|
||||
<img src="https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/2_4_network.png" width="320px" />
|
||||
<a href="https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/network.png" target="_blank">
|
||||
<img src="https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/network.png" width="300px" />
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
@@ -27,10 +27,36 @@
|
||||
font-family: 'Courier New', monospace;
|
||||
|
||||
}
|
||||
.logs-row
|
||||
{
|
||||
align-content: center;
|
||||
width: 100%;
|
||||
display: grid;
|
||||
margin: 5px;
|
||||
}
|
||||
.log-area
|
||||
{
|
||||
padding: 3px;
|
||||
width:100%;
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-style: solid;
|
||||
border-color: #606060;
|
||||
}
|
||||
.logs-small
|
||||
{
|
||||
height: 100px;
|
||||
}
|
||||
.log-file
|
||||
{
|
||||
width: 145px;
|
||||
display: inline-grid;
|
||||
font-size: 20px;
|
||||
}
|
||||
.log-purge
|
||||
{
|
||||
width: 90px;
|
||||
float:right;
|
||||
}
|
||||
.span-padding
|
||||
{
|
||||
padding:10px;
|
||||
|
||||
@@ -346,55 +346,79 @@ if (submit && isset($_POST['skinselector_set'])) {
|
||||
<!-- ---------------------------Logging-------------------------------------------- -->
|
||||
<div class="tab-pane" id="tab_Logging">
|
||||
<div class="db_info_table">
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_tools_table_cell_a" style="">
|
||||
<div><label>pialert.log</label><span class="span-padding"><a href="./log/pialert.log"><i class="fa fa-download"></i> </a></span></div>
|
||||
<div><button class="btn btn-primary" onclick="logManage('pialert.log','cleanLog')"><?php echo lang('Gen_Purge');?></button></div>
|
||||
</div>
|
||||
<div class="db_tools_table_cell_b">
|
||||
<div class="log-area">
|
||||
<div class="row logs-row">
|
||||
<textarea id="pialert_log" class="logs" cols="70" rows="10" readonly ><?php echo file_get_contents( "./log/pialert.log" ); ?>
|
||||
</textarea>
|
||||
</div>
|
||||
<div class="row logs-row" >
|
||||
<div>
|
||||
<div class="log-file">pialert.log</div><span class="span-padding"><a href="./log/pialert.log" target="_blank"><i class="fa fa-download"></i> </a></span>
|
||||
<div class="log-purge">
|
||||
<button class="btn btn-primary" onclick="logManage('pialert.log','cleanLog')"><?php echo lang('Gen_Purge');?></button>
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_tools_table_cell_a" style="">
|
||||
<div><label>pialert_front.log</label><span class="span-padding"><a href="./log/pialert_front.log"><i class="fa fa-download"></i> </a></span></div>
|
||||
<div><button class="btn btn-primary" onclick="logManage('pialert_front.log','cleanLog')"><?php echo lang('Gen_Purge');?></button></div>
|
||||
</div>
|
||||
<div class="db_tools_table_cell_b">
|
||||
</div>
|
||||
</div>
|
||||
<div class="log-area">
|
||||
<div class="row logs-row">
|
||||
<textarea id="pialert_front_log" class="logs" cols="70" rows="10" wrap='off' readonly><?php echo file_get_contents( "./log/pialert_front.log" ); ?>
|
||||
</textarea>
|
||||
</div>
|
||||
<div class="row logs-row" >
|
||||
<div>
|
||||
<div class="log-file">pialert_front.log</div><span class="span-padding"><a href="./log/pialert_front.log"><i class="fa fa-download"></i> </a></span>
|
||||
<div class="log-purge">
|
||||
<button class="btn btn-primary" onclick="logManage('pialert_front.log','cleanLog')"><?php echo lang('Gen_Purge');?></button>
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_tools_table_cell_a" style="">
|
||||
<div><label>IP_changes.log</label><span class="span-padding"><a href="./log/IP_changes.log"><i class="fa fa-download"></i> </a></span></div>
|
||||
<div><button class="btn btn-primary" onclick="logManage('IP_changes.log','cleanLog')"><?php echo lang('Gen_Purge');?></button></div>
|
||||
</div>
|
||||
<div class="db_tools_table_cell_b">
|
||||
</div>
|
||||
</div>
|
||||
<div class="log-area">
|
||||
|
||||
<div class="row logs-row">
|
||||
<textarea id="IP_changes_log" class="logs logs-small" cols="70" rows="10" readonly><?php echo file_get_contents( "./log/IP_changes.log" ); ?>
|
||||
</textarea>
|
||||
</div>
|
||||
<div class="row logs-row" >
|
||||
<div>
|
||||
<div class="log-file">IP_changes.log</div><span class="span-padding"><a href="./log/IP_changes.log"><i class="fa fa-download"></i> </a></span>
|
||||
<div class="log-purge">
|
||||
<button class="btn btn-primary" onclick="logManage('IP_changes.log','cleanLog')"><?php echo lang('Gen_Purge');?></button>
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_tools_table_cell_a" style="">
|
||||
<div><label>stdout.log</label><span class="span-padding"><a href="./log/stdout.log"><i class="fa fa-download"></i> </a></span></div>
|
||||
<div><button class="btn btn-primary" onclick="logManage('stdout.log','cleanLog')"><?php echo lang('Gen_Purge');?></button></div>
|
||||
</div>
|
||||
<div class="db_tools_table_cell_b">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="log-area">
|
||||
<div class="row logs-row">
|
||||
<textarea id="stdout_log" class="logs logs-small" cols="70" rows="10" wrap='off' readonly><?php echo file_get_contents( "./log/stdout.log" ); ?>
|
||||
</textarea>
|
||||
</div>
|
||||
<div class="row logs-row" >
|
||||
<div>
|
||||
<div class="log-file">stdout.log</div><span class="span-padding"><a href="./log/stdout.log"><i class="fa fa-download"></i> </a></span>
|
||||
<div class="log-purge">
|
||||
<button class="btn btn-primary" onclick="logManage('stdout.log','cleanLog')"><?php echo lang('Gen_Purge');?></button>
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_tools_table_cell_a" style="">
|
||||
<div><label>stderr.log</label><span class="span-padding"><a href="./log/stderr.log"><i class="fa fa-download"></i> </a></span></div>
|
||||
<div><button class="btn btn-primary" onclick="logManage('stderr.log','cleanLog')"><?php echo lang('Gen_Purge');?></button></div>
|
||||
</div>
|
||||
<div class="db_tools_table_cell_b">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="log-area">
|
||||
<div class="row logs-row">
|
||||
<textarea id="stderr_log" class="logs logs-small" cols="70" rows="10" wrap='off' readonly><?php echo file_get_contents( "./log/stderr.log" ); ?>
|
||||
</textarea>
|
||||
</div>
|
||||
<div class="row logs-row" >
|
||||
<div>
|
||||
<div class="log-file">stderr.log</div><span class="span-padding"><a href="./log/stderr.log"><i class="fa fa-download"></i> </a></span>
|
||||
<div class="log-purge">
|
||||
<button class="btn btn-primary" onclick="logManage('stderr.log','cleanLog')"><?php echo lang('Gen_Purge');?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -268,7 +268,7 @@ function getParam(targetId, key) {
|
||||
$.get('php/server/parameters.php?action=get¶meter='+ key, function(data) {
|
||||
var result = data;
|
||||
|
||||
document.getElementById(targetId).innerHTML = result;
|
||||
document.getElementById(targetId).innerHTML = result.replaceAll('"', '');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user