Added crashed DB table display to admin web screens
Added --vicidial-dial-log-only flag to log archive script git-svn-id: svn://192.168.202.10@3950 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -890,6 +890,10 @@ OTHER CHANGES:
|
||||
for X seconds if any DTMF signal is detected on the call. Configurable
|
||||
in Campaigns, In-Groups and system-wide.
|
||||
|
||||
254. Added Database crashed table auto-check, with display on Admin Web screens
|
||||
for level 9 users if crashed tables are found. Enabled by default,
|
||||
configurable in the System Settings.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
# 240924-2041 - Added --vicidial-log-only
|
||||
# 250914-1537 - Added archiving of recording_log_stereo and recording_log_parallel tables
|
||||
# 251011-2048 - Added archiving of recording_live_log table
|
||||
# 251024-1518 - Added --vicidial-dial-log-only flag
|
||||
#
|
||||
|
||||
$CALC_TEST=0;
|
||||
@@ -122,6 +123,8 @@ if (length($ARGV[0])>1)
|
||||
print " [--api-log-days=XX] = REQUIRED FOR --api-only, number of days to archive vicidial_api_log table only past\n";
|
||||
print " [--vicidial-log-only] = OPTIONAL, only archive vicidial_log table then exit\n";
|
||||
print " [--vicidial-log-days=XX] = REQUIRED FOR --vicidial-log-only, number of days to archive vicidial_log table only past\n";
|
||||
print " [--vicidial-dial-log-only] = OPTIONAL, only archive vicidial_dial_log table then exit\n";
|
||||
print " [--vicidial-dial-log-days=XX] = REQUIRED FOR --vicidial-dial-log-only, number of days to archive vicidial_dial_log table only past\n";
|
||||
print " [--extended-log-only] = OPTIONAL, only archive vicidial_log_extended table then exit\n";
|
||||
print " [--extended-log-days=XX] = REQUIRED FOR --extended-log-only, number of days to archive vicidial_log_extended table only past\n";
|
||||
print " [--api-archive-only] = OPTIONAL, only purge vicidial_api_log_archive table then exit\n";
|
||||
@@ -294,7 +297,6 @@ if (length($ARGV[0])>1)
|
||||
if ($Q < 1)
|
||||
{print "\n----- VICIDIAL LOG ARCHIVE ONLY $vicidial_log_only -----\n\n";}
|
||||
}
|
||||
|
||||
if ($args =~ /--vicidial-log-days=/i)
|
||||
{
|
||||
$vicidial_log_only++;
|
||||
@@ -308,13 +310,31 @@ if (length($ARGV[0])>1)
|
||||
{print "\n----- VICIDIAL LOG ARCHIVE ACTIVE, DAYS: $extendeddays -----\n\n";}
|
||||
}
|
||||
|
||||
if ($args =~ /--vicidial-dial-log-only/i)
|
||||
{
|
||||
$vicidial_dial_log_only++;
|
||||
if ($Q < 1)
|
||||
{print "\n----- VICIDIAL DIAL LOG ARCHIVE ONLY $vicidial_dial_log_only -----\n\n";}
|
||||
}
|
||||
if ($args =~ /--vicidial-dial-log-days=/i)
|
||||
{
|
||||
$vicidial_dial_log_only++;
|
||||
@data_in = split(/--vicidial-dial-log-days=/,$args);
|
||||
$extendeddays = $data_in[1];
|
||||
$extendeddays =~ s/ .*$//gi;
|
||||
$extendeddays =~ s/\D//gi;
|
||||
if ($extendeddays > 999999)
|
||||
{$extendeddays=1825;}
|
||||
if ($Q < 1)
|
||||
{print "\n----- VICIDIAL DIAL LOG ARCHIVE ACTIVE, DAYS: $extendeddays -----\n\n";}
|
||||
}
|
||||
|
||||
if ($args =~ /--extended-log-only/i)
|
||||
{
|
||||
$extended_log_only++;
|
||||
if ($Q < 1)
|
||||
{print "\n----- EXTENDED LOG ARCHIVE ONLY $extended_log_only -----\n\n";}
|
||||
}
|
||||
|
||||
if ($args =~ /--extended-log-days=/i)
|
||||
{
|
||||
$extended_log_only++;
|
||||
@@ -334,7 +354,6 @@ if (length($ARGV[0])>1)
|
||||
if ($Q < 1)
|
||||
{print "\n----- API ARCHIVE PURGE ONLY -----\n\n";}
|
||||
}
|
||||
|
||||
if ($args =~ /--api-archive-days=/i)
|
||||
{
|
||||
$api_log_archive_purge++;
|
||||
@@ -354,7 +373,6 @@ if (length($ARGV[0])>1)
|
||||
if ($Q < 1)
|
||||
{print "\n----- URL LOG PURGE ONLY -----\n\n";}
|
||||
}
|
||||
|
||||
if ($args =~ /--url-log-days=/i)
|
||||
{
|
||||
$url_log_only++;
|
||||
@@ -505,7 +523,7 @@ if ($url_log_only > 0)
|
||||
if ($URLsec < 10) {$URLsec = "0$URLsec";}
|
||||
$URLdel_time = "$URLyear-$URLmon-$URLmday $URLhour:$URLmin:$URLsec";
|
||||
}
|
||||
if ( ($extended_log_only > 0) || ($vicidial_log_only > 0) )
|
||||
if ( ($extended_log_only > 0) || ($vicidial_log_only > 0) || ($vicidial_dial_log_only > 0) )
|
||||
{
|
||||
$EXTENDEDdel_epoch = ($secX - (86400 * $extendeddays)); # X days ago
|
||||
($EXTENDEDsec,$EXTENDEDmin,$EXTENDEDhour,$EXTENDEDmday,$EXTENDEDmon,$EXTENDEDyear,$EXTENDEDwday,$EXTENDEDyday,$EXTENDEDisdst) = localtime($EXTENDEDdel_epoch);
|
||||
@@ -2083,6 +2101,66 @@ if (!$T)
|
||||
########## END --vicidial-log-only flag processing ##########
|
||||
|
||||
|
||||
|
||||
|
||||
########## BEGIN --vicidial-dial-log-only flag processing ##########
|
||||
if ($vicidial_dial_log_only > 0)
|
||||
{
|
||||
##### vicidial_dial_log
|
||||
$stmtA = "SELECT count(*) from vicidial_dial_log;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$vicidial_dial_log_count = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
$stmtA = "SELECT count(*) from vicidial_dial_log_archive;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$vicidial_dial_log_archive_count = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
if (!$Q) {print "\nProcessing vicidial_dial_log table... ($vicidial_dial_log_count|$vicidial_dial_log_archive_count)\n";}
|
||||
$stmtA = "INSERT IGNORE INTO vicidial_dial_log_archive SELECT * from vicidial_dial_log;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
|
||||
$sthArows = $sthA->rows;
|
||||
if (!$Q) {print "$sthArows rows inserted into vicidial_dial_log_archive table \n";}
|
||||
|
||||
$rv = $sthA->err();
|
||||
if (!$rv)
|
||||
{
|
||||
if ($wipe_all > 0)
|
||||
{$stmtA = "DELETE FROM vicidial_dial_log;";}
|
||||
else
|
||||
{$stmtA = "DELETE FROM vicidial_dial_log WHERE call_date < '$EXTENDEDdel_time';";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows = $sthA->rows;
|
||||
if (!$Q) {print "$sthArows rows deleted from vicidial_dial_log table \n";}
|
||||
|
||||
$stmtA = "optimize table vicidial_dial_log;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
}
|
||||
|
||||
if (!$Q) {print "\nProcessing vicidial_dial_log table finished: ($sthArows rows deleted) \n";}
|
||||
|
||||
exit;
|
||||
}
|
||||
########## END --vicidial-dial-log-only flag processing ##########
|
||||
|
||||
|
||||
if ($queue_log > 0)
|
||||
{
|
||||
#############################################
|
||||
|
||||
@@ -177,9 +177,10 @@
|
||||
# 250924-2212 - Added code for deprecation of "Monitor" application after Asterisk 20
|
||||
# 251006-0832 - Added truncating of vicidial_dtmf_log older than 24 hours & If recording_dtmf_muting enabled, force use of MixMonitor for recording
|
||||
# 251011-1000 - Added archiving of recording_dtmf_muting_log, disabled purging of recording_live_log after 7 days
|
||||
# 251024-2222 - Added crashed table detection
|
||||
#
|
||||
|
||||
$build = '251011-1000';
|
||||
$build = '251024-2222';
|
||||
|
||||
$DB=0; # Debug flag
|
||||
$teodDB=0; # flag to log Timeclock End of Day processes to log file
|
||||
@@ -502,7 +503,7 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
|
||||
|
||||
|
||||
##### Get the settings from system_settings #####
|
||||
$stmtA = "SELECT sounds_central_control_active,active_voicemail_server,custom_dialplan_entry,default_codecs,generate_cross_server_exten,voicemail_timezones,default_voicemail_timezone,call_menu_qualify_enabled,allow_voicemail_greeting,reload_timestamp,meetme_enter_login_filename,meetme_enter_leave3way_filename,allow_chats,enable_auto_reports,enable_drop_lists,expired_lists_inactive,sip_event_logging,call_quota_lead_ranking,inbound_answer_config,log_latency_gaps,demographic_quotas,weekday_resets,highest_lead_id,hopper_hold_inserts,stereo_recording,stereo_parallel_recording,recording_dtmf_muting FROM system_settings;";
|
||||
$stmtA = "SELECT sounds_central_control_active,active_voicemail_server,custom_dialplan_entry,default_codecs,generate_cross_server_exten,voicemail_timezones,default_voicemail_timezone,call_menu_qualify_enabled,allow_voicemail_greeting,reload_timestamp,meetme_enter_login_filename,meetme_enter_leave3way_filename,allow_chats,enable_auto_reports,enable_drop_lists,expired_lists_inactive,sip_event_logging,call_quota_lead_ranking,inbound_answer_config,log_latency_gaps,demographic_quotas,weekday_resets,highest_lead_id,hopper_hold_inserts,stereo_recording,stereo_parallel_recording,recording_dtmf_muting,db_crashed_tables_check FROM system_settings;";
|
||||
# print "$stmtA\n";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -537,6 +538,7 @@ if ($sthArows > 0)
|
||||
$SSstereo_recording = $aryA[24];
|
||||
$SSstereo_parallel_recording = $aryA[25];
|
||||
$SSrecording_dtmf_muting = $aryA[26];
|
||||
$SSdb_crashed_tables_check = $aryA[27];
|
||||
}
|
||||
$sthA->finish();
|
||||
if ($DBXXX > 0) {print "SYSTEM SETTINGS: $sounds_central_control_active|$active_voicemail_server|$SScustom_dialplan_entry|$SSdefault_codecs\n";}
|
||||
@@ -604,6 +606,7 @@ else
|
||||
$runningASTERISK=0;
|
||||
$runningsip_logger=0;
|
||||
$runningconf_updater=0;
|
||||
$runningcrash_test=0;
|
||||
$AST_conf_3way=0;
|
||||
$AST_rec_monitor=0;
|
||||
|
||||
@@ -780,6 +783,11 @@ else
|
||||
$runningAST_rec_monitor++;
|
||||
if ($DB) {print "AST_rec_monitor RUNNING: |$psline[1]|\n";}
|
||||
}
|
||||
if ($psline[1] =~ /$REGhome\/AST_table_status\.pl/)
|
||||
{
|
||||
$runningcrash_test++;
|
||||
if ($DB) {print "AST_table_status RUNNING: |$psline[1]|\n";}
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
@@ -953,6 +961,11 @@ else
|
||||
$runningAST_rec_monitor++;
|
||||
if ($DB) {print "AST_rec_monitor RUNNING: |$psline[1]|\n";}
|
||||
}
|
||||
if ($psline[1] =~ /$REGhome\/AST_table_status\.pl/)
|
||||
{
|
||||
$runningcrash_test++;
|
||||
if ($DB) {print "AST_table_status RUNNING: |$psline[1]|\n";}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
@@ -1522,6 +1535,15 @@ if ($timeclock_end_of_day_NOW > 0)
|
||||
if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";}
|
||||
$sthA->finish();
|
||||
|
||||
$stmtA = "optimize table crashed_tables;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";}
|
||||
$sthA->finish();
|
||||
|
||||
if ($agents_calls_reset > 0)
|
||||
{
|
||||
$stmtA = "delete from vicidial_live_inbound_agents where last_call_finish < \"$TDSQLdate\";";
|
||||
@@ -2318,7 +2340,7 @@ if ($timeclock_end_of_day_NOW > 0)
|
||||
|
||||
|
||||
##### BEGIN vicidial_dtmf_log end of day process removing records older than 24 hours #####
|
||||
$stmtA = "DELETE from vicidial_dtmf_log where vicidial_dtmf_log < \"$RMSQLdate\";";
|
||||
$stmtA = "DELETE from vicidial_dtmf_log where dtmf_time < \"$RMSQLdate\";";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if($DB){print STDERR "\n|$affected_rows vicidial_dtmf_log records older than 1 day purged|\n";}
|
||||
@@ -6812,6 +6834,49 @@ if ($AST_VDadapt > 0)
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
##### BEGIN check for crashed tables
|
||||
################################################################################
|
||||
if ( ($THISserver_voicemail > 0) && ($SSdb_crashed_tables_check > 0) )
|
||||
{
|
||||
if ($DB) {print "Begin check for crashed table... |db_crashed_tables_check setting: $SSdb_crashed_tables_check| \n";}
|
||||
|
||||
if ($runningcrash_test > 0)
|
||||
{
|
||||
if ($DB) {print "Previous crash test already running, do not start another one.\n";}
|
||||
}
|
||||
else
|
||||
{
|
||||
$start_crash_check_now=0;
|
||||
if ($SSdb_crashed_tables_check >= 4)
|
||||
{$start_crash_check_now++;}
|
||||
if ( ($SSdb_crashed_tables_check >= 3) && ($reset_test =~ /0$/) )
|
||||
{$start_crash_check_now++;}
|
||||
if ( ($SSdb_crashed_tables_check >= 2) && ($reset_test =~ /00$/) )
|
||||
{$start_crash_check_now++;}
|
||||
if ( ($SSdb_crashed_tables_check >= 1) && ($timeclock_end_of_day_NOW > 0) )
|
||||
{$start_crash_check_now++;}
|
||||
|
||||
if ($start_crash_check_now > 0)
|
||||
{
|
||||
if ($DB) {print "starting AST_table_status... |$start_crash_check_now| \n";}
|
||||
# add a '-L' to the command below to activate logging
|
||||
`/usr/bin/screen -d -m -S ASTcrash $PATHhome/AST_table_status.pl --debugX`;
|
||||
if ($megaDB)
|
||||
{
|
||||
`/usr/bin/screen -S ASTcrash -X logfile $PATHlogs/ASTcrash-screenlog.0`;
|
||||
`/usr/bin/screen -S ASTcrash -X log`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
################################################################################
|
||||
##### END check for crashed tables
|
||||
################################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ($DB) {print "DONE\n";}
|
||||
|
||||
@@ -0,0 +1,191 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# AST_table_status.pl version 2.12
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# - gathers MySQL "SHOW TABLE STATUS" info to check for crashed tables
|
||||
#
|
||||
#
|
||||
# Copyright (C) 2025 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES
|
||||
# 251025-1618 - First build
|
||||
#
|
||||
|
||||
### begin parsing run-time options ###
|
||||
if (length($ARGV[0])>1)
|
||||
{
|
||||
$i=0;
|
||||
while ($#ARGV >= $i)
|
||||
{
|
||||
$args = "$args $ARGV[$i]";
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($args =~ /--help/i)
|
||||
{
|
||||
print "allowed run time options:\n";
|
||||
print " [-q] = quiet\n";
|
||||
print " [-t] = test\n";
|
||||
print " [--debug] = debugging messages\n";
|
||||
print " [--debugX] = Extra debugging messages\n";
|
||||
print "\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($args =~ /-q/i)
|
||||
{
|
||||
$q=1; $Q=1;
|
||||
}
|
||||
if ($args =~ /--debug/i)
|
||||
{
|
||||
$DB=1;
|
||||
print "\n----- DEBUGGING -----\n\n";
|
||||
}
|
||||
if ($args =~ /--debugX/i)
|
||||
{
|
||||
$DBX=1;
|
||||
print "\n----- EXTRA DEBUGGING -----\n\n";
|
||||
}
|
||||
if ($args =~ /-t|--test/i)
|
||||
{
|
||||
$T=1; $TEST=1;
|
||||
print "\n----- TESTING -----\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "no command line options set Exiting...\n";
|
||||
}
|
||||
### end parsing run-time options ###
|
||||
|
||||
$secX = time();
|
||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
||||
$year = ($year + 1900);
|
||||
$yy = $year; $yy =~ s/^..//gi;
|
||||
$mon++;
|
||||
if ($mon < 10) {$mon = "0$mon";}
|
||||
if ($mday < 10) {$mday = "0$mday";}
|
||||
if ($hour < 10) {$hour = "0$hour";}
|
||||
if ($min < 10) {$min = "0$min";}
|
||||
if ($sec < 10) {$sec = "0$sec";}
|
||||
$now_date="$year-$mon-$mday $hour:$min:$sec";
|
||||
|
||||
if (!$Q) {print "NOW DATETIME: $now_date \n";}
|
||||
|
||||
# default path to astguiclient configuration file:
|
||||
$PATHconf = '/etc/astguiclient.conf';
|
||||
|
||||
open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n";
|
||||
@conf = <conf>;
|
||||
close(conf);
|
||||
$i=0;
|
||||
foreach(@conf)
|
||||
{
|
||||
$line = $conf[$i];
|
||||
$line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi;
|
||||
if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) )
|
||||
{$PATHhome = $line; $PATHhome =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) )
|
||||
{$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) )
|
||||
{$PATHagi = $line; $PATHagi =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) )
|
||||
{$PATHweb = $line; $PATHweb =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) )
|
||||
{$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) )
|
||||
{$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) )
|
||||
{$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) )
|
||||
{$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) )
|
||||
{$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) )
|
||||
{$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) )
|
||||
{$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) )
|
||||
{$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;}
|
||||
$i++;
|
||||
}
|
||||
|
||||
# Customized Variables
|
||||
$server_ip = $VARserver_ip; # Asterisk server IP
|
||||
|
||||
if (!$VARDB_port) {$VARDB_port='3306';}
|
||||
|
||||
use DBI;
|
||||
|
||||
$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass")
|
||||
or die "Couldn't connect to database: " . DBI->errstr;
|
||||
|
||||
|
||||
if ($DB) {print "Begin check for crashed table...\n";}
|
||||
# gather crashed table records
|
||||
$stmtA = "SHOW TABLE STATUS WHERE Comment LIKE \"%crash%\";";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsCRASH=$sthA->rows;
|
||||
$i=0;
|
||||
while ($sthArowsCRASH > $i)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$CRASHEDtables[$i] = $aryA[0];
|
||||
|
||||
if($DBX){print STDERR "\nCRASHED TABLE: |$i|$CRASHEDtables[$i]| \n";}
|
||||
|
||||
$i++;
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
if ($i > 0)
|
||||
{
|
||||
$keep_tables="''";
|
||||
$i=0;
|
||||
while ($sthArowsCRASH > $i)
|
||||
{
|
||||
$keep_tables .= ",'$CRASHEDtables[$i]'";
|
||||
$stmtA = "INSERT INTO crashed_tables SET table_name='$CRASHEDtables[$i]',crashed_datetime='$now_date',last_check_datetime='$now_date' ON DUPLICATE KEY UPDATE last_check_datetime='$now_date';";
|
||||
$Iaffected_rows = $dbhA->do($stmtA);
|
||||
if ($DB) {print "Crashed table update: |$Iaffected_rows|$stmtA";}
|
||||
$i++;
|
||||
}
|
||||
$stmtA = "DELETE FROM crashed_tables where table_name NOT IN($keep_tables);";
|
||||
$Iaffected_rows = $dbhA->do($stmtA);
|
||||
if ($DB) {print "Crashed table old entries cleared: |$Iaffected_rows|$stmtA";}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($DBX){print STDERR "\nNO CRASHED TABLES FOUND.\n";}
|
||||
$CRASHEDtable_ct=0;
|
||||
# gather crashed table records count
|
||||
$stmtA = "SELECT count(*) FROM crashed_tables;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsCRASHct=$sthA->rows;
|
||||
if ($sthArowsCRASHct > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$CRASHEDtable_ct = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
if ($CRASHEDtable_ct > 0)
|
||||
{
|
||||
$stmtA = "DELETE FROM crashed_tables;";
|
||||
$Iaffected_rows = $dbhA->do($stmtA);
|
||||
if ($DB) {print "Crashed table cleared: |$Iaffected_rows|$stmtA";}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$dbhA->disconnect();
|
||||
|
||||
if (!$Q) {print "Script exiting\n";}
|
||||
|
||||
exit;
|
||||
@@ -2074,7 +2074,8 @@ agent_man_dial_filter VARCHAR(20) default '',
|
||||
agent_3way_dial_filter VARCHAR(20) default '',
|
||||
recording_dtmf_detection TINYINT(3) UNSIGNED default '0',
|
||||
recording_dtmf_muting TINYINT(3) UNSIGNED default '0',
|
||||
stereo_parallel_recording ENUM('0','1','2','3','4','5','6') default '0'
|
||||
stereo_parallel_recording ENUM('0','1','2','3','4','5','6') default '0',
|
||||
db_crashed_tables_check ENUM('0','1','2','3','4','5','6') default '1'
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
CREATE TABLE vicidial_campaigns_list_mix (
|
||||
@@ -5449,6 +5450,12 @@ index(recording_id),
|
||||
index(dtmf_muting_end_time)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
CREATE TABLE crashed_tables (
|
||||
table_name VARCHAR(100) PRIMARY KEY NOT NULL,
|
||||
crashed_datetime DATETIME,
|
||||
last_check_datetime DATETIME
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
|
||||
ALTER TABLE vicidial_email_list MODIFY message text character set utf8;
|
||||
|
||||
@@ -5867,4 +5874,4 @@ INSERT INTO `wallboard_reports` VALUES ('AGENTS_AND_QUEUES','Agents and Queues',
|
||||
|
||||
UPDATE system_settings set vdc_agent_api_active='1';
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1732',db_schema_update_date=NOW(),reload_timestamp=NOW();
|
||||
UPDATE system_settings SET db_schema_version='1733',db_schema_update_date=NOW(),reload_timestamp=NOW();
|
||||
|
||||
@@ -3030,3 +3030,13 @@ CREATE INDEX rllst on recording_live_log(start_time);
|
||||
CREATE TABLE recording_live_log_archive LIKE recording_live_log;
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1732',db_schema_update_date=NOW() where db_schema_version < 1732;
|
||||
|
||||
CREATE TABLE crashed_tables (
|
||||
table_name VARCHAR(100) PRIMARY KEY NOT NULL,
|
||||
crashed_datetime DATETIME,
|
||||
last_check_datetime DATETIME
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
ALTER TABLE system_settings ADD db_crashed_tables_check ENUM('0','1','2','3','4','5','6') default '1';
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1733',db_schema_update_date=NOW() where db_schema_version < 1733;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# admin_header.php - VICIDIAL administration header
|
||||
#
|
||||
# Copyright (C) 2023 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2025 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
|
||||
# CHANGES
|
||||
@@ -98,6 +98,7 @@
|
||||
# 221230-2230 - Added Postal Codes Cities submenu
|
||||
# 230118-0835 - Added Agent Call Hangup Change function
|
||||
# 230613-1835 - Added VIDPROMPTSPECIAL options
|
||||
# 251025-1953 - Added crashed DB table display
|
||||
#
|
||||
|
||||
$HTMLcolors = 'IndianRed,CD5C5C|LightCoral,F08080|Salmon,FA8072|DarkSalmon,E9967A|LightSalmon,FFA07A|Crimson,DC143C|Red,FF0000|FireBrick,B22222|DarkRed,8B0000|Pink,FFC0CB|LightPink,FFB6C1|HotPink,FF69B4|DeepPink,FF1493|MediumVioletRed,C71585|PaleVioletRed,DB7093|LightSalmon,FFA07A|Coral,FF7F50|Tomato,FF6347|OrangeRed,FF4500|DarkOrange,FF8C00|Orange,FFA500|Gold,FFD700|Yellow,FFFF00|LightYellow,FFFFE0|LemonChiffon,FFFACD|LightGoldenrodYellow,FAFAD2|PapayaWhip,FFEFD5|Moccasin,FFE4B5|PeachPuff,FFDAB9|PaleGoldenrod,EEE8AA|Khaki,F0E68C|DarkKhaki,BDB76B|Lavender,E6E6FA|Thistle,D8BFD8|Plum,DDA0DD|Violet,EE82EE|Orchid,DA70D6|Fuchsia,FF00FF|Magenta,FF00FF|MediumOrchid,BA55D3|MediumPurple,9370DB|RebeccaPurple,663399|BlueViolet,8A2BE2|DarkViolet,9400D3|DarkOrchid,9932CC|DarkMagenta,8B008B|Purple,800080|Indigo,4B0082|SlateBlue,6A5ACD|DarkSlateBlue,483D8B|MediumSlateBlue,7B68EE|GreenYellow,ADFF2F|Chartreuse,7FFF00|LawnGreen,7CFC00|Lime,00FF00|LimeGreen,32CD32|PaleGreen,98FB98|LightGreen,90EE90|MediumSpringGreen,00FA9A|SpringGreen,00FF7F|MediumSeaGreen,3CB371|SeaGreen,2E8B57|ForestGreen,228B22|Green,008000|DarkGreen,006400|YellowGreen,9ACD32|OliveDrab,6B8E23|Olive,808000|DarkOliveGreen,556B2F|MediumAquamarine,66CDAA|DarkSeaGreen,8FBC8B|LightSeaGreen,20B2AA|DarkCyan,008B8B|Teal,008080|Aqua,00FFFF|Cyan,00FFFF|LightCyan,E0FFFF|PaleTurquoise,AFEEEE|Aquamarine,7FFFD4|Turquoise,40E0D0|MediumTurquoise,48D1CC|DarkTurquoise,00CED1|CadetBlue,5F9EA0|SteelBlue,4682B4|LightSteelBlue,B0C4DE|PowderBlue,B0E0E6|LightBlue,ADD8E6|SkyBlue,87CEEB|LightSkyBlue,87CEFA|DeepSkyBlue,00BFFF|DodgerBlue,1E90FF|CornflowerBlue,6495ED|MediumSlateBlue,7B68EE|RoyalBlue,4169E1|Blue,0000FF|MediumBlue,0000CD|DarkBlue,00008B|Navy,000080|MidnightBlue,191970|Cornsilk,FFF8DC|BlanchedAlmond,FFEBCD|Bisque,FFE4C4|NavajoWhite,FFDEAD|Wheat,F5DEB3|BurlyWood,DEB887|Tan,D2B48C|RosyBrown,BC8F8F|SandyBrown,F4A460|Goldenrod,DAA520|DarkGoldenrod,B8860B|Peru,CD853F|Chocolate,D2691E|SaddleBrown,8B4513|Sienna,A0522D|Brown,A52A2A|Maroon,800000|White,FFFFFF|Snow,FFFAFA|HoneyDew,F0FFF0|MintCream,F5FFFA|Azure,F0FFFF|AliceBlue,F0F8FF|GhostWhite,F8F8FF|WhiteSmoke,F5F5F5|SeaShell,FFF5EE|Beige,F5F5DC|OldLace,FDF5E6|FloralWhite,FFFAF0|Ivory,FFFFF0|AntiqueWhite,FAEBD7|Linen,FAF0E6|LavenderBlush,FFF0F5|MistyRose,FFE4E1|Gainsboro,DCDCDC|LightGray,D3D3D3|Silver,C0C0C0|DarkGray,A9A9A9|Gray,808080|DimGray,696969|LightSlateGray,778899|SlateGray,708090|DarkSlateGray,2F4F4F|Black,000000';
|
||||
@@ -2756,6 +2757,22 @@ if ($SSenable_languages == '1')
|
||||
{
|
||||
echo " | <a href=\"$ADMIN?ADD=999989\" STYLE=\"text-decoration:none;\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE SIZE=1>"._QXZ("Change language")."</a>";
|
||||
}
|
||||
if ($LOGuser_level >= 9)
|
||||
{
|
||||
$stmt = "SELECT count(*) FROM crashed_tables;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$crashes_ct = mysqli_num_rows($rslt);
|
||||
if ($crashes_ct > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$crashed_tables = $row[0];
|
||||
}
|
||||
if ($crashed_tables > 0)
|
||||
{
|
||||
echo " <a href=\"$ADMIN?ADD=999984\" STYLE=\"text-decoration:none;\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=RED SIZE=1 STYLE=\"background-color:white\"><B> "._QXZ("Crashed DB Tables").": $crashed_tables </B></FONT></a>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</TD><TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B><?php echo date("l F j, Y G:i:s A") ?> </B></TD></TR>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# version: 20251017123601
|
||||
# version: 20251025191301
|
||||
users-user User ID <QXZ>This field is where you put the users ID number, can be up to 20 digits in length, Must be at least 2 characters in length. We strongly recommend not reusing user accounts for different users, for reporting accuracy. To disable a user account, set the Active option to -N-.</QXZ>
|
||||
users-pass Password <QXZ>This field is where you put the users password. Must be at least 2 characters in length, unless the User Password Minimum Length system setting is enabled, which will require a longer password. Only letters and numbers are allowed in user passwords. A medium strength user password will be at least 10 characters in length, and a strong user password will be at least 20 characters in length and have letters as well as at least one number. It is recommended that you use a longer password if possible, stringing together several unrelated words with no spaces, and a number somewhere in the string. The maximum size of a password is 100 characters.</QXZ>
|
||||
users-force_change_password Force Change Password <QXZ>If this option is set to Y then the user will be prompted to change their password the next time they log in to the administration webpage or the agent screen. Default is N.</QXZ>
|
||||
@@ -1124,6 +1124,7 @@ settings-default_language Default Language <QXZ>This is the language that the ag
|
||||
settings-webroot_writable Webroot Writable <QXZ>This setting allows you to define whether temp files and authentication files should be placed in the webroot on your web server. Default is 1.</QXZ>
|
||||
settings-agent_disable Agent Disable Display <QXZ>This field is used to select when to show an agent notices when their session has been disabled by the system, a manager action or by an external measure. The NOT_ACTIVE setting will disable the message on the agents screen. The LIVE_AGENT setting will only display the disabled message when the agents auto_calls record has been removed, such as during a force logout or emergency logout. Default is ALL.</QXZ>
|
||||
settings-frozen_server_call_clear Clear Frozen Calls <QXZ>This option can enable the ability for the general Reports page and the optional AST_timecheck.pl script to clear out the auto_calls entries for a frozen server so they do not affect call routing. Default is 0 for disabled.</QXZ>
|
||||
settings-db_crashed_tables_check Auto Check DB Crashed Tables <QXZ>If this option is set to 1 or higher, the system will automatically check to see if any of the database tables are in a crashed state. If a crashed table is found, then a message will appear at the top of the Admin Web screens for level-9 users stating that there are crashed DB tables, you can then click on that message for details on which tables are crashed. If this option is set to -1-, then the check will happen only once a day at the Timeclock-End-of-Day time. If this is set to -2-, then the check will happen once every hour. If this is set to -3-, then the check will happen every 10 minutes. If this is set to -4-, then the check will happen every minute. Default is 1.</QXZ>
|
||||
settings-allowed_sip_stacks Allowed SIP Stacks <QXZ>This option will determine which SIP modules in Asterisk will be allowed to be configured on your dialers for Phones and Carriers. The standard up until Asterisk 16 is -SIP- which uses the older chan_sip module. The newer PJSIP can be used with Asterisk 16 and higher, if configured properly. Default is SIP.</QXZ>
|
||||
settings-allow_sipsak_messages Allow SIPSAK Messages <QXZ>If set to 1, this will allow the sipsak phones table setting to work if the phone is set to the SIP protocol. The server will send messages to the SIP phone to display on the phone display when logged into the system. This feature only works with SIP phones and requires sipsak application to be installed on the web server that the agent is logged into. Default is 0. </QXZ>
|
||||
settings-vdc_agent_api_active Agent API Active <QXZ>If set to 1, this will allow the Agent API interface to function. Default is 0. </QXZ>
|
||||
|
||||
Reference in New Issue
Block a user