From 1c1f1af1f780cfcf1045fc49f1e09822672099c0 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 19 Jan 2024 12:12:03 +0100 Subject: [PATCH] add status monitor for open-gpu-server --- site/open-gpu-server.js | 29 +++++++++++++++++++++++++++++ site/template.html | 4 ++++ 2 files changed, 33 insertions(+) create mode 100644 site/open-gpu-server.js diff --git a/site/open-gpu-server.js b/site/open-gpu-server.js new file mode 100644 index 0000000..a4ab8ba --- /dev/null +++ b/site/open-gpu-server.js @@ -0,0 +1,29 @@ +function loadOpenStatusJSON (url, callback) { + var xobj = new XMLHttpRequest() + xobj.overrideMimeType('application/json') + xobj.open('GET', url, true) + xobj.onreadystatechange = function () { + if (xobj.readyState === 4 && xobj.status === 200) { + // Required use of an anonymous callback as .open will NOT return a value + // but simply returns undefined in asynchronous mode + callback(xobj.responseText) + } + } + xobj.send(null) +} + +function displayOpenGPUServerStatus (reportText) { + var report = JSON.parse(reportText) + var div = document.getElementById('open-gpu-server-status') + + if (report.status === 'operational') { + div.className = 'status operational' + div.innerHTML = 'All Systems Operational' + } else { + div.className = 'status degraded performance' + div.innerHTML = report.status + } +} + +var url = 'https://api.openstatus.dev/public/status/open-gpu-server' +loadOpenStatusJSON(url, displayOpenGPUServerStatus) diff --git a/site/template.html b/site/template.html index c328cec..d471bcf 100644 --- a/site/template.html +++ b/site/template.html @@ -207,6 +207,10 @@

Cloud
Azure DevOps: No Status Available
+
+
Open GPU Server: No Status Available
+
+

Short-Term Migrations