' + issue.title + '
\n'; html += '\n'; html += '
' + issue.body + '
\n'; if (issue.state === 'closed') { html += 'Updated ' + datetime(issue.closed_at) + '
';
html += 'The system is back in normal operation.
$(document).ready(function() { var config = { uptimerobot: { api_keys: [ "YOUR-UPTIME-ROBOT-API-KEY-1", "YOUR-UPTIME-ROBOT-API-KEY-2" ], logs: 1 }, github: { org: 'YOUR-GITHUB-USERNAME', repo: 'YOUR-GITHUB-REPO' } }; var status_text = { 'operational': 'operational', 'investigating': 'investigating', 'major outage': 'outage', 'degraded performance': 'degraded', }; var monitors = config.uptimerobot.api_keys; for( var i in monitors ){ var api_key = monitors[i]; $.post('https://api.uptimerobot.com/v2/getMonitors', { "api_key": api_key, "format": "json", "logs": config.uptimerobot.logs, }, function(response) { status( response ); }, 'json'); } function status(data) { data.monitors = data.monitors.map(function(check) { check.class = check.status === 2 ? 'label-success' : 'label-danger'; check.text = check.status === 2 ? 'operational' : 'major outage'; if( check.status !== 2 && !check.lasterrortime ){ check.lasterrortime = Date.now(); } if (check.status === 2 && Date.now() - (check.lasterrortime * 1000) <= 86400000) { check.class = 'label-warning'; check.text = 'degraded performance'; } return check; }); var status = data.monitors.reduce(function(status, check) { return check.status !== 2 ? 'danger' : 'operational'; }, 'operational'); if (!$('#panel').data('incident')) { $('#panel').attr('class', (status === 'operational' ? 'panel-success' : 'panel-warning') ); $('#paneltitle').html(status === 'operational' ? 'All systems are operational.' : 'One or more systems inoperative'); } data.monitors.forEach(function(item) { var name = item.friendly_name; var clas = item.class; var text = item.text; $('#services').append('
' + issue.body + '
\n'; if (issue.state === 'closed') { html += 'Updated ' + datetime(issue.closed_at) + '
';
html += 'The system is back in normal operation.