|
@ -31,16 +31,16 @@ module.exports = async function (topic, apiKey) { |
|
|
color: _stat ? _stat[1] : 'grey' |
|
|
color: _stat ? _stat[1] : 'grey' |
|
|
} |
|
|
} |
|
|
case 'day': |
|
|
case 'day': |
|
|
return uptime('last-day', custom_uptime_ratio) |
|
|
return uptime('past-day', custom_uptime_ratio) |
|
|
case 'week': |
|
|
case 'week': |
|
|
return uptime('last-week', custom_uptime_ratio) |
|
|
return uptime('past-week', custom_uptime_ratio) |
|
|
case 'month': |
|
|
case 'month': |
|
|
return uptime('last-month', custom_uptime_ratio) |
|
|
return uptime('past-month', custom_uptime_ratio) |
|
|
case 'response': |
|
|
case 'response': |
|
|
return { |
|
|
return { |
|
|
subject: 'response', |
|
|
subject: 'response', |
|
|
status: average_response_time + 'ms', |
|
|
status: average_response_time + 'ms', |
|
|
color: 'green' |
|
|
color: 'blue' |
|
|
} |
|
|
} |
|
|
default: |
|
|
default: |
|
|
return { |
|
|
return { |
|
@ -62,19 +62,19 @@ const statuses = { |
|
|
function uptime (period, ratios) { |
|
|
function uptime (period, ratios) { |
|
|
const [day, week, month] = ratios.split('-').map(r => parseFloat(r)) |
|
|
const [day, week, month] = ratios.split('-').map(r => parseFloat(r)) |
|
|
switch (period) { |
|
|
switch (period) { |
|
|
case 'last-day': |
|
|
case 'past-day': |
|
|
return { |
|
|
return { |
|
|
subject: 'uptime', |
|
|
subject: 'uptime', |
|
|
status: day + '%', |
|
|
status: day + '%', |
|
|
color: ratioColor(day) |
|
|
color: ratioColor(day) |
|
|
} |
|
|
} |
|
|
case 'last-week': |
|
|
case 'past-week': |
|
|
return { |
|
|
return { |
|
|
subject: 'uptime', |
|
|
subject: 'uptime', |
|
|
status: week + '%', |
|
|
status: week + '%', |
|
|
color: ratioColor(week) |
|
|
color: ratioColor(week) |
|
|
} |
|
|
} |
|
|
case 'last-month': |
|
|
case 'past-month': |
|
|
return { |
|
|
return { |
|
|
subject: 'uptime', |
|
|
subject: 'uptime', |
|
|
status: month + '%', |
|
|
status: month + '%', |
|
|