问题描述
我正在尝试使用 UpTimeRobot 的 API 来监控 2 个云提供商,Locaweb 和 AWS,所以我使用了一个名为“nocodeapi/status”(https://github.com/nocodeapi/status)的 git,它是一个 React 程序,从这里提取数据 例如 https://v1.nocodeapi.com/hugonh/uptime/XPBjzmgSBPYqMCNj?monitors=785820041-785820037-787326309-787325770 并在 localhost:3000 上转换为图形界面,如图像所示
SMTP Monitor Example of HTTP monitor
如何获得向下标志(红色箭头;类型===1)发生的次数或停机时间最长、持续时间更长?
我第一次使用 React (JS)
const statusComp = type => {
let status = "";
if (type === 1)
status = (
<>
<ArrowDown color="red" size={14} /> Down
</>
);
if (type === 2)
status = (
<>
<ArrowUp color="green" size={14} /> Up
</>
);
if (type === 98)
status = (
<>
<Play color="blue" size={14} /> Started
</>
);
return status;
};
function getLastDown(logs){
const downLogIndex = logs.findindex(log => log.type === 1)
let message;
if(downLogIndex === -1){
message = "No down time"
}else {
message = `${moment
.unix(logs[downLogIndex].datetime)
.format("YYYY-MM-DD,h:mm:ss")} (${secondsToHms(logs[downLogIndex].duration)})`
}
return message
}
//else 在它下降时发生,并在正确的彩色图表上显示时间和持续时间。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)