|
|
|
@ -24,23 +24,22 @@ class Atlassian extends MonitorType {
|
|
|
|
|
const response = (await fetch(monitor.url));
|
|
|
|
|
const body = await response.json();
|
|
|
|
|
// log.debug("AtlassianStatus",body["components"]);
|
|
|
|
|
let component_status = new Map();
|
|
|
|
|
let componentStatus = new Map();
|
|
|
|
|
for (let index = 0; index < body["components"].length; index++) {
|
|
|
|
|
const element = body["components"][index];
|
|
|
|
|
component_status.set(element["name"],element["status"])
|
|
|
|
|
componentStatus.set(element["name"], element["status"]);
|
|
|
|
|
}
|
|
|
|
|
log.debug("AtlassianStatus",component_status);
|
|
|
|
|
if (component_status.get(monitor.component_name)!= undefined ) {
|
|
|
|
|
if (component_status.get(monitor.component_name) === "operational") {
|
|
|
|
|
log.debug("AtlassianStatus",component_status.get(monitor.component_name))
|
|
|
|
|
heartbeat.status = UP
|
|
|
|
|
log.debug("AtlassianStatus", componentStatus);
|
|
|
|
|
if (componentStatus.get(monitor.component_name) !== undefined ) {
|
|
|
|
|
if (componentStatus.get(monitor.component_name) === "operational") {
|
|
|
|
|
log.debug("AtlassianStatus", componentStatus.get(monitor.component_name));
|
|
|
|
|
heartbeat.status = UP;
|
|
|
|
|
} else {
|
|
|
|
|
heartbeat.status = DOWN
|
|
|
|
|
heartbeat.status = DOWN;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
throw new Error("Component not exist into the status");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
// trigger log function somewhere to display a notification or alert to the user (but how?)
|
|
|
|
|
throw new Error(`StatusPage check errors: ${err}`);
|
|
|
|
|