1 <& /elements/header.html &>
2 % foreach my $section ( keys %status ) {
3 <FONT CLASS="fsinnerbox-title"><% mt($section) |h %></FONT>
4 <TABLE CLASS="fsinnerbox">
5 % foreach my $item ( @{ $status{$section} } ) {
7 <TD ALIGN="right"><% $item->{title} %></TH>
8 <TD><B><% $item->{value} %></B></TD>
14 <& /elements/footer.html &>
18 -e '/usr/bin/lsb_release' and run( ['lsb_release', '-d'], '>',\$os );
19 if ( ! $@ && $os =~ /^\s*Description:\s*(.+)$/ ) {
21 } elsif ( my $deb_version = slurp('/etc/debian_version') ) {
22 $os = "Debian $deb_version";
25 ( my $perl_ver = $^V ) =~ s/^v//;
28 $db = 'PostgreSQL' if $db =~ /^Pg/;
29 $db = 'MySQL' if $db =~ /^mysql/;
31 my $db_ver = FS::Record->scalar_sql('SELECT VERSION()');
32 if ( $db eq 'PostgreSQL' && $db_ver =~ /^\s*PostgreSQL\s+([\w\.]+)\s+on\s+/ ) {
36 tie my %status, 'Tie::IxHash',
38 { 'title' => 'Freeside version',
39 'value' => $FS::VERSION,
41 { 'title' => 'Operating System',
44 { 'title' => 'Perl version',
47 { 'title' => 'Database engine',
50 { 'title' => 'Database version',
54 'Required Daemons' => [
55 { 'title' => 'Queue daemon',
56 'value' => _is_running('queued') ? 'Running' : 'Not running',
59 'Optional Daemons' => [
60 { 'title' => 'Self-service server(s)',
61 'value' => '(Not checked)', #XXX multiple pid files, per machine etc
63 { 'title' => 'Self-service XML-RPC server',
64 'value' => _is_running('selfservice-xmlrpcd') ? 'Running' : 'Not running',
66 { 'title' => 'Back office XML-RPC server',
67 'value' => _is_running('xmlrpcd') ? 'Running' : 'Not running',
69 { 'title' => 'RADIUS accounting import daemon',
70 'value' => _is_running('sqlradius-radacctd') ? 'Running' : 'Not running',
72 { 'title' => 'Prepaid daemon',
73 'value' => _is_running('prepaidd') ? 'Running' : 'Not running',
75 { 'title' => 'CDR Rewrite daemon',
76 'value' => _is_running('cdrrewrited') ? 'Running' : 'Not running',
78 { 'title' => 'CDR Prepaid daemon',
79 'value' => _is_running('cdrd') ? 'Running' : 'Not running',
81 { 'title' => 'CDR Real-time rating daemon',
82 'value' => _is_running('cdrrated') ? 'Running' : 'Not running',
84 #{ 'title' => 'Network monitoring port combiner', #?
85 # 'value' => _is_running('torrus-srvderive') ? 'Running' : 'Not running',
90 if ( _is_running('cdrd') ) {
92 my $delay = FS::Record->scalar_sql('
93 SELECT AVG(end_date-insert_date)
100 my $h = int($delay/3600);
101 my $m = int( ($delay%3600) / 60 );
104 $delay = ( $h ? $h. 'h' : '' ).
105 ( $h||$m ? $m. 'm' : '').
110 my $pr_delay = FS::Record->scalar_sql('
111 SELECT AVG(end_date-start_date)
114 ORDER BY statnum DESC
118 my $h = int($delay/3600);
119 my $m = int( ($delay%3600) / 60 );
122 $pr_delay = ( $h ? $h. 'h' : '' ).
123 ( $h||$m ? $m. 'm' : '').
128 my $dayago = time2str('%Y-%m-%d %X', time - 86400);
129 my $cdrs = FS::Record->scalar_sql(qq{
130 SELECT COUNT(*) FROM cdr
131 WHERE ( freesidestatus IS NULL OR freesidestatus = '' )
132 AND calldate > '$dayago'
135 $status{'CDR Processing'} = [
136 { 'title' => 'Current processing delay',
139 { 'title' => 'Average billing time',
140 'value' => $pr_delay,
142 { 'title' => 'Unprocessed CDRs (last 24 hours)',
152 my $pid_path = '/var/run'; #XXX hardcoded path
155 -e "$pid_path/freeside/$thing.pid" ? "$pid_path/freeside/$thing.pid" :
156 -e "$pid_path/freeside-$thing.pid" ? "$pid_path/freeside-$thing.pid" :
159 -e $pidfile and kill 0, slurp($pidfile)