mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 23:04:04 +00:00
Save message for 503 status code
This commit is contained in:
parent
73ee62810d
commit
444661e77c
1 changed files with 4 additions and 1 deletions
|
@ -35,7 +35,8 @@ class RabbitMqMonitorType extends MonitorType {
|
||||||
},
|
},
|
||||||
// Use axios signal to handle connection timeouts https://stackoverflow.com/a/74739938
|
// Use axios signal to handle connection timeouts https://stackoverflow.com/a/74739938
|
||||||
signal: axiosAbortSignal((monitor.timeout + 10) * 1000),
|
signal: axiosAbortSignal((monitor.timeout + 10) * 1000),
|
||||||
validateStatus: () => true,
|
// Capture reason for 503 status
|
||||||
|
validateStatus: (status) => status === 200 || status === 503,
|
||||||
};
|
};
|
||||||
log.debug("monitor", `[${monitor.name}] Axios Request: ${JSON.stringify(options)}`);
|
log.debug("monitor", `[${monitor.name}] Axios Request: ${JSON.stringify(options)}`);
|
||||||
const res = await axios.request(options);
|
const res = await axios.request(options);
|
||||||
|
@ -44,6 +45,8 @@ class RabbitMqMonitorType extends MonitorType {
|
||||||
heartbeat.status = UP;
|
heartbeat.status = UP;
|
||||||
heartbeat.msg = "OK";
|
heartbeat.msg = "OK";
|
||||||
break;
|
break;
|
||||||
|
} else if (res.status === 503) {
|
||||||
|
heartbeat.msg = res.data.reason;
|
||||||
} else {
|
} else {
|
||||||
heartbeat.msg = `${res.status} - ${res.statusText}`;
|
heartbeat.msg = `${res.status} - ${res.statusText}`;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue