1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
<!doctype html><html><head><title>Netdata Agent Console</title><script>var pathsRegex = /\/(spaces|nodes|overview|alerts|dashboards|anomalies|events|cloud|v2)\/?.*/
var getBasename = function() {
return window.location.origin + window.location.pathname.replace(pathsRegex, "")
}
var goToOld = function(path) {
var goToUrl = getBasename() + path;
if (path === "/v2") {
var pathsRegex = /(\/(spaces|nodes|overview|alerts|dashboards|anomalies|events|cloud)\/?.*)/
if (pathsRegex.test(window.location.origin + window.location.pathname)) {
goToUrl = (window.location.origin + window.location.pathname).replace(pathsRegex, "/v2$1")
}
}
window.location.replace((goToUrl + window.location.search).replace(/([^:]\/)\/+/g, "$1"))
}
var getAssetFile = function(path) {
window.location.replace(__webpack_public_path__ + path)
}
var searchParams = new URLSearchParams(location.search)
window.envSettings = {
isAgent: true,
apiUrl: "https://app.netdata.cloud",
cloudUrl: "https://app.netdata.cloud",
uiUrl: "https://app.netdata.cloud",
demoSlug: "netdata-demo",
demoFavourites: {"postgresql":["postgres"],"redis":["redis"],"dns-query":["dns_query"],"http-endpoints":["httpcheck"],"nginx":["web_log","nginx"],"apache":["apache"],"host-reachability":["ping"],"cassandra":["cassandra"],"coredns":["coredns"],"logind":["logind"],"iis":["iis"],"active-directory":["ad"],"windows":["windows","ad","iis","mssql","exchange","netframework"],"docker":["cgroup","docker"]},
webpackPublicPath: "",
agentApiUrl: searchParams.get("agent") || getBasename(),
version: "6.21.3",
tracking: false,
cookieDomain: ".netdata.cloud"
}
__webpack_public_path__ = (window.envSettings.webpackPublicPath ? "/" : (window.envSettings.agentApiUrl + "/v2/")).replace(/([^:]\/)\/+/g, "$1")
function loadStyle(url, { media, insertAfter: aref, insertBefore: bref, rel, type } = {}) {
rel = rel || 'stylesheet'
type = type || 'text/css'
return new Promise(function(resolve, reject) {
var link = document.createElement('link');
link.type = type;
link.rel = rel;
link.href = url;
link.media = media || 'all';
link.onerror = function(err) {
reject(new URIError(`loadStyle: the stylesheet ${err.target.src} is not accessible.`));
};
link.onload = function() {
resolve();
};
if (aref) {
aref.parentNode.insertBefore(link, aref.nextSibling);
return;
}
if (bref) {
bref.parentNode.insertBefore(link, bref);
return;
}
document.head.appendChild(link);
});
}
loadStyle(window.envSettings.agentApiUrl + "/v2/static/splash.css")
loadStyle(window.envSettings.agentApiUrl + "/v2/favicon.ico", {rel: "icon", type: "image/x-icon"})</script><meta name="application-name" content="netdata"/><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/><meta name="viewport" content="width=device-width,height=device-height,initial-scale=1,minimum-scale=1"/><meta name="apple-mobile-web-app-capable" content="yes"/><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/></head><body><div id="app"><div id="agent-splash-screen" class="loading"><div class="hero"><div class="logo-container"><svg width="133" height="105" viewBox="0 0 133 105" fill="none" xmlns="http://www.w3.org/2000/svg" class="logo-blur"><path fill-rule="evenodd" clip-rule="evenodd" d="M81.697 105H55.0693L0.5 0.5H77.9598C108.079 0.554913 132.484 24.7711 132.5 54.6451C132.452 82.485 109.73 105 81.697 105Z" fill="rgba(0,171,68,0.1)"/></svg> <svg width="133" height="105" viewBox="0 0 133 105" fill="none" xmlns="http://www.w3.org/2000/svg" class="logo"><path fill-rule="evenodd" clip-rule="evenodd" d="M81.697 105H55.0693L0.5 0.5H77.9598C108.079 0.554913 132.484 24.7711 132.5 54.6451C132.452 82.485 109.73 105 81.697 105Z" fill="#DDFFEB"/></svg></div><div class="headings"><h1 class="title">Welcome to Netdata</h1><div class="loading-message"><p class="subtitle">Loading latest Netdata Cloud UI...</p><div class="flex-center">We couldn't load the latest Netdata Cloud UI. <a class="button ghost" href="javascript:location.reload();">You can try again <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M18.364 8.05001L17.657 7.34301C16.318 6.00369 14.5472 5.18285 12.6598 5.02654C10.7724 4.87022 8.89077 5.38856 7.34966 6.48934C5.80855 7.59011 4.70794 9.20193 4.24365 11.038C3.77936 12.8741 3.98151 14.8153 4.81412 16.5164C5.64674 18.2174 7.05583 19.5678 8.79067 20.3275C10.5255 21.0871 12.4736 21.2067 14.2883 20.6648C16.103 20.123 17.6666 18.955 18.701 17.3685C19.7353 15.782 20.1733 13.8801 19.937 12.001M18.364 8.05001L14.121 8.05101M18.364 8.05001V3.80701" stroke="#00ab44" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/></svg></a></div></div></div></div><div class="flex-center">Or you can load the <a class="button ghost" href="javascript:goToOld('/v1');">old single node dashboard</a> or a <a class="button ghost" href="javascript:goToOld('/v2');">local copy</a> of Netdata Cloud UI</div><div class="flex-center terms"><a href="javascript:getAssetFile('/LICENSE.md');">Netdata Cloud UI license</a></div></div></div><script>var status = {
TIMEOUT: 'timeout',
SUCCESS: 'success',
SKIPPED: 'skipped'
};
function loadScript(
url,
{ async = true, defer = false, insertAfter: aref, insertBefore: bref, timeout = 5000, attrs, skipIf } = {}
) {
return new Promise(function(resolve, reject) {
if (typeof skipIf === 'function' && skipIf()) {
resolve(status.SKIPPED);
return;
}
var rejectWithTimeout = setTimeout(function() { reject(status.TIMEOUT) }, timeout);
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
script.async = async;
script.defer = defer;
if (attrs) {
for (var attr in attrs) {
script.setAttribute(attr, attrs[attr]);
}
}
script.onerror = function(err) {
reject(new URIError(`loadScript: the script ${err.target.src} is not accessible.`));
};
script.onload = function() {
clearTimeout(rejectWithTimeout);
resolve(status.SUCCESS);
};
if (aref) {
aref.parentNode.insertBefore(script, aref.nextSibling);
return;
}
if (bref) {
bref.parentNode.insertBefore(script, bref);
return;
}
document.body.appendChild(script);
});
}
fetch(window.envSettings.agentApiUrl + "/api/v1/registry?action=hello", { cache: "no-cache", credentials: "include" })
.then(function(response) { return response.json() })
.then(function(data) {
var to = data.cloud_base_url.lastIndexOf('/');
to = (to == -1 || to < data.cloud_base_url.length -2) ? data.cloud_base_url.length : to;
var cloudUrl = data.cloud_base_url.substring(0, to);
window.envSettings.apiUrl = cloudUrl
window.envSettings.cloudUrl = cloudUrl
window.localNetdataRegistry = {
anonymousStatistics: data.anonymous_statistics,
registry: data.registry,
isNetdataRegistry: data.registry === "https://registry.my-netdata.io",
hostname: data.hostname,
mg: data.agent.machine_guid,
nd: data.agent.node_id,
claimId: data.agent.claim_id
}
if (window.localNetdataRegistry.anonymousStatistics) {
;(function (w, d, s, l, i) {
w[l] = w[l] || []
w[l].push({
"gtm.start": new Date().getTime(),
event: "gtm.js",
})
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s),
dl = l != "dataLayer" ? "&l=" + l : ""
j.async = true
j.src = "https://www.googletagmanager.com/gtm.js?id=" + i + dl
f.parentNode.insertBefore(j, f)
})(window, document, "script", "dataLayer", "GTM-N6CBMJD")
loadScript("https://www.googletagmanager.com/gtag/js?id=G-J69Z2JCTFB", {
async: true,
})
window.dataLayer = window.dataLayer || []
window.gtag = function() {
window.dataLayer.push(arguments)
}
window.gtag("consent", "default", {
"ad_storage": "granted",
"analytics_storage": "granted",
"functionality_storage": "granted",
"personalization_storage": "granted"
})
gtag("js", new Date());
gtag("config", "G-J69Z2JCTFB");
!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags opt_in_site_apps".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);
posthog.init("phc_hnhlqe6D2Q4IcQNrFItaqdXJAxQ8RcHkPAFAp74pubv", { api_host: "https://app.posthog.com", disable_session_recording: true, opt_in_site_apps: true } )
}
var withoutNodes = JSON.parse(JSON.stringify(data))
withoutNodes.nodes = []
var iframe = document.createElement('iframe');
iframe.src = data.registry + "/registry-access.html?x=" + btoa(JSON.stringify(withoutNodes)) + "&originUrl=" + window.envSettings.agentApiUrl;
iframe.style = { position: "absolute", left: "-99999999px" };
iframe.width = 0 ;
iframe.height = 0;
iframe.tabindex = -1;
iframe.title = "empty";
iframe.classList.add("hidden");
document.body.appendChild(iframe);
setTimeout(function () {
iframe.contentWindow.postMessage(["netdata-registry", window.envSettings.agentApiUrl, data], "*")
}, 300);
window.addEventListener('message', function(event) {
if (event.source !== iframe.contentWindow) return;
if (event.data.status === "disabled") console.error("Your netdata registry is disabled! Check your configuration.")
});
})
fetch(window.envSettings.agentApiUrl + "/api/v1/info")
.then(function(response) { return response.json() })
.then(function(agent) {
window.localNetdataAgent = {
mg: agent.uid,
version: agent.version,
cloudEnabled: agent["cloud-enabled"],
cloudAvailable: agent["cloud-available"],
claimed: agent["agent-claimed"],
aclk: agent["aclk-available"]
}
if (!window.localNetdataAgent.cloudEnabled && /netdata\.cloud/.test("/bundlesManifest.6.json")) {
goToOld("/v2")
return
}
fetch(__webpack_public_path__ + "bundlesManifest."+ window.envSettings.version.toString().replace(/(\d+)\..+/, "$1") +".json")
.then(function(response) { return response.json() })
.then(function(data) {
Object.keys(data).forEach(function(k) {
if (/\.(map|ico|html)$/.test(data[k])) return
if (/static\//.test(data[k])) return
if (/\.css.*$/.test(data[k])) {
loadStyle((__webpack_public_path__ + data[k]).replace(/([^:]\/)\/+/g, "$1"))
return
}
if (/\.js.*$/.test(data[k])) {
loadScript((__webpack_public_path__ + data[k]).replace(/([^:]\/)\/+/g, "$1"), {
async: false,
});
}
var el = document.getElementById('agent-splash-screen');
el.classList.remove("loading");
})
}).catch(function() {
var el = document.getElementById('agent-splash-screen');
el.classList.remove("loading");
el.classList.add("error");
});
})</script></body></html>
|