summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--httemplate/view/Status.html36
1 files changed, 35 insertions, 1 deletions
diff --git a/httemplate/view/Status.html b/httemplate/view/Status.html
index 019470eb9..6b1cc6de2 100644
--- a/httemplate/view/Status.html
+++ b/httemplate/view/Status.html
@@ -106,13 +106,47 @@ if ( _is_running('cdrd') ) {
$s. 's';
}
-
$status{'CDR Processing'} = [
{ 'title' => 'Current processing delay',
'value' => $delay,
},
];
+ my $pr_delay = FS::Record->scalar_sql('
+ SELECT AVG(end_date-start_date)
+ FROM queue_stat
+ GROUP BY statnum
+ ORDER BY statnum DESC
+ LIMIT 100
+ ');
+ if ( $pr_delay ) {
+ my $h = int($delay/3600);
+ my $m = int( ($delay%3600) / 60 );
+ my $s = $delay%60;
+
+ $pr_delay = ( $h ? $h. 'h' : '' ).
+ ( $h||$m ? $m. 'm' : '').
+ $s. 's';
+
+ }
+ $status{'CDR Processing'} = [
+ { 'title' => 'Average billing time',
+ 'value' => $pr_delay,
+ },
+ ];
+
+ my $24ago = time2str('%Y-%m-$d %X', time - 86400);
+ my $cdrs = FS::Record->scalar_sql(qq{
+ SELECT COUNT(*) FROM cdr
+ WHERE ( freesidestatus IS NULL OR freesidestatus = '' )
+ AND calldate > '$24ago'
+ });
+ $status{'CDR Processing'} = [
+ { 'title' => 'Unprocessed CDRs',
+ 'value' => $cdrs,
+ },
+ ];
+
}
sub _is_running {