[freeside-commits] branch FREESIDE_3_BRANCH updated. 884a06efc50dbffc28af3d1b7ee49325c5ee3e6c

Ivan ivan at 420.am
Sun Jan 18 14:51:12 PST 2015


The branch, FREESIDE_3_BRANCH has been updated
       via  884a06efc50dbffc28af3d1b7ee49325c5ee3e6c (commit)
      from  4c289fa61fa2cc6ed21bdacd047c969eb5c7f96c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 884a06efc50dbffc28af3d1b7ee49325c5ee3e6c
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Jan 18 14:51:11 2015 -0800

    basic replication status

diff --git a/httemplate/view/Status.html b/httemplate/view/Status.html
index 2ddf7e5..f106087 100644
--- a/httemplate/view/Status.html
+++ b/httemplate/view/Status.html
@@ -87,6 +87,50 @@ tie my %status, 'Tie::IxHash',
   ],
 ;
 
+if ( $db eq 'PostgreSQL' ) {
+
+  my $enabled =    FS::Record->scalar_sql('SHOW wal_level')    eq 'hot_standby'
+                && FS::Record->scalar_sql('SHOW archive_mode') eq 'on';
+
+  my $slave = 
+    FS::Record->scalar_sql('SHOW archive_command') =~ / postgres\@([\w\.\-]): /
+      ? $1 : '';
+
+  $status{'Replication'} = [
+    { 'title' => 'Status', #?
+      'value' => $enabled ? 'Enabled' : 'Disabled',
+    },
+  ];
+
+  if ( $enabled ) {
+    push @{ $status{'Replication'} }, 
+      { 'title' => 'Slave',
+        'value' => $slave || '(Missing, or unparseable archive_command)',
+      },
+    ;
+    if ( $slave ) {
+      #how far behind is it?  will be easier once we're off 9.1
+      # http://www.keithf4.com/monitoring_streaming_slave_lag/
+      # except pg_stat_replication still doesn't fill in the columns we need as
+      # non-Pg user :/
+      push @{ $status{'Replication'} }, 
+        { 'title' => 'Slave',
+          'value' => $slave || '(Missing, or unparseable archive_command)',
+        },
+      ;
+    }
+  }
+
+} else {
+
+  $status{'Replication'} = [
+    { 'title' => 'Enabled',
+      'value' => "(Not yet checked on $db)",
+    },
+  ];
+
+}
+
 if ( _is_running('cdrd') ) {
 
   my $delay = FS::Record->scalar_sql('

-----------------------------------------------------------------------

Summary of changes:
 httemplate/view/Status.html |   44 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)




More information about the freeside-commits mailing list