CINXE.COM
Status
<!DOCTYPE html> <html> <head> <link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,500,600" rel="stylesheet"> <title> Status </title> <link rel="shortcut icon" href="/static/icons/favicon.ico" type="image/x-icon"/> <link rel="stylesheet" href="/static/bootstrap/css/bootstrap.min.css"/> <link rel="stylesheet" href="/static/css/monitor.css"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> </head> <body> <div class="wrapper"> <div class="navbar navbar-inverse navbar-top hidden-print"> <div class="container-fluid"> <a class="top-line" href="https://tradablebits.com"> <img src="/static/icons/tradablebits-icon.svg" style="width:30px;"/> tradable bits </a> <span class="top-line green-colo pull-right"> STATUS REPORT </span> </div> </div> <div class="content"> <div class="container"> <div id="status-area"></div> <div id="graph-area"></div> <div id="server-area"></div> <div id="failure-area"></div> </div> </div> <div class="footer hidden-print"> <div class="container"> <div class="footer-link"> <a href="https://tbits.me/developers">Developers</a> </div> <div class="footer-link"> <a href="https://tradablebits.com/blog">Blog</a> </div> <div class="footer-link"> <a href="https://tbits.me/terms">Terms</a> </div> <div class="footer-link"> <a href="https://tbits.me/privacy">Privacy</a> </div> <span class="hidden-xs hidden-sm hidden-md catch-phrase">Handcrafted in Vancouver, BC Canada. 漏 TradableBits Media Inc. All rights reserved. </span> </div> </div> </div> <script type="text/template" id="graph-template"> <div class="white-well padded-well"> <h4 class="green-color"> UPTIME HISTORY (LAST 7D)</h4> <div class="daily-history-chart" id="daily-history-chart" style="height:150px;"> </div> </div> </script> <script type="text/template" id="server-template"> <% _.each(servers, function(server, i){ %> <div class="white-well padded-well"> <% if (server.is_online === 1) { %> <h4 class="green-color"><%= server.server_name %> - Online</h4> <% } else { %> <h4 class="red-color"><%= server.server_name %> - Failing</h4> <% } %> <% if (server.props.data_model) { %> <table class="monitor-table"> <tr> <% if (server.props.data_model === false) { %> <th class="table-cell red-color">Datamodel Status</th> <th class="table-cell red-color">Local Datamodel MD5</th> <th class="table-cell red-color">Expected Datamodel MD5</th> <% } else { %> <th class="table-cell">Datamodel Status</th> <th class="table-cell">Local Datamodel MD5</th> <th class="table-cell">Expected Datamodel MD5</th> <% } %> <% if (server.props.jobs === false) { %> <th class="table-cell red-color">Celery Jobs</th> <% } else { %> <th class="table-cell">Celery Jobs</th> <% } %> </tr> <tr> <td class="table-cell"><%= server.props.data_model %></td> <td class="table-cell"><%= server.props.local_data_model_md5 %></td> <td class="table-cell"><%= server.props.expected_data_model_md5 %></td> <td class="table-cell"><%= server.props.jobs %></td> </tr> </table> <table class="monitor-table"> <tr> <% if (server.props.google_ads === false) { %> <th class="table-cell red-color">Google Ads</th> <% } else { %> <th class="table-cell">Google Ads</th> <% } %> <% if (server.props.replication_lag === false) { %> <th class="table-cell red-color">Replication Lag</th> <% } else { %> <th class="table-cell">Replication Lag</th> <% } %> <% if (server.props.replication_slots === false) { %> <th class="table-cell red-color">Replication Slots</th> <% } else { %> <th class="table-cell">Replication Slots</th> <% } %> <% if (server.props.websocket_basic_status === false) { %> <th class="table-cell red-color">Websockets Basic</th> <% } else { %> <th class="table-cell">Websockets Basic</th> <% } %> <% if (server.props.websocket_room_status === false) { %> <th class="table-cell red-color">Websockets Room</th> <% } else { %> <th class="table-cell">Websockets Room</th> <% } %> <th class="table-cell">Last Deploy</th> </tr> <tr> <td class="table-cell"><%= server.props.google_ads %></td> <td class="table-cell"><%= server.props.replication_lag %></td> <td class="table-cell"><%= server.props.replication_slots %></td> <td class="table-cell"><%= server.props.websocket_basic_status %></td> <td class="table-cell"><%= server.props.websocket_room_status %></td> <td class="table-cell"><%= server.props.last_deploy %></td> </tr> </table> <% }; %> </div> <% }); %> </script> <script type="text/template" id="status-template"> <div class="row"> <div class="col-sm-6"> <div class="white-well padded-well" style="height:120px;"> <h4 class="green-color"> UPTIME YEAR TO DATE</h4> <span class="big-font"> <%- ytd_uptime %> % </span> </div> </div> <div class="col-sm-6"> <div class="white-well padded-well" style="height:120px;"> <h4 class="green-color"> CURRENT STATUS</h4> <% if( status ){ %> <div class="row"> <div class="col-xs-2"> <div class="status-icon green-color"> <span class="glyphicon glyphicon-ok"></span> </div> </div> <div class="col-xs-10" style="padding:7px;font-weight: 600;"> System is healthy </div> </div> <% }else{ %> <div class="row"> <div class="col-xs-2"> <div class="status-icon red-color"> <span class="glyphicon glyphicon-remove"></span> </div> </div> <div class="col-xs-10" style="padding:7px;font-weight: 600;"> System Failures Detected </div> </div> <% } %> </div> </div> </div> <div class="white-well padded-well"> <div class="row"> <div class="col-sm-6"> <h4 class="green-color"> UPTIME MONTH TO DATE</h4> <%- mtd_uptime %> % </div> <div class="col-sm-6"> <h4 class="green-color"> MTD RESPONSE TIME</h4> <%- mtd_response_time %> sec </div> </div> </div> </script> <script type="text/javascript" src="/static/jquery/jquery-1.11.0.min.js"></script> <script language="javascript" type="text/javascript" src="/static/highcharts/js/highcharts.js"></script> <script language="javascript" type="text/javascript" src="/static/js/lib/underscore.js"></script> <script language="javascript" type="text/javascript" src="/static/js/lib/moment.min.js"></script> <script type="text/javascript"> $(document).ready(function () { fetchStats() setInterval(fetchStats, 10000); }); function renderSystemStatus(status) { let $statusArea = $("#status-area"); $statusArea.html(_.template($("#status-template").html(), status)); } function renderServers(servers) { let $serverArea = $("#server-area"); $serverArea.html(_.template($("#server-template").html(), {"servers": servers})) } function renderGraphs(history) { let $graphArea = $("#graph-area"); $graphArea.html(_.template($("#graph-template").html(), history)) // Above renders the html, below renders the highcharts graphs let data = []; let idx = 0; let daily_history = history.daily; for (idx in daily_history) { data.push([daily_history[idx].date, daily_history[idx].uptime]); } new Highcharts.Chart({ chart: { renderTo: 'daily-history-chart', type: 'column', plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false }, title: {text: ''}, credits: {enabled: false}, xAxis: {type:"category"}, // xAxis: {type: 'datetime', dateTimeLabelFormats: {day: '%d %H:%M', month: '%m-%d', year: '%b'}}, yAxis: {title: {text: 'Uptime'}, min: 0, max: 100}, useUTC: true, tooltip: { formatter: function () { return Highcharts.dateFormat('%Y-%m-%d %H:%M', this.x) + ': ' + this.y; } }, series: [ {name: 'Daily Uptime', data: data} ] }); } function fetchStats() { $.ajax({ url: "/server_status", dataType: "json", type: "get", timeout: 2000, success: function (res) { renderSystemStatus(res.system_state) renderGraphs(res.history) renderServers(res.servers) } }); } </script> </body> </html>