netdata-swagger.yaml \
netdata-swagger.json \
robots.txt \
+ registry.html \
tv.html \
version.txt \
$(NULL)
var numberDigitGroupCount = self.data('sparkline-numberdigitgroupcount') || undefined;
var animatedZooms = self.data('sparkline-animatedzooms') || false;
+ if(spotColor === 'disable') spotColor='';
+ if(minSpotColor === 'disable') minSpotColor='';
+ if(maxSpotColor === 'disable') maxSpotColor='';
+
state.sparkline_options = {
type: type,
lineColor: lineColor,
state.log('dygraphChartUpdate() forced zoom update');
options.dateWindow = (state.requested_padding !== null)?[ state.view_after, state.view_before ]:null;
- options.valueRange = null;
+ options.valueRange = state.dygraph_options.valueRange;
options.isZoomedIgnoreProgrammaticZoom = true;
state.dygraph_force_zoom = false;
}
else if(state.current.name !== 'auto') {
if(NETDATA.options.debug.dygraph === true || state.debug === true)
state.log('dygraphChartUpdate() loose update');
+
+ options.valueRange = state.dygraph_options.valueRange;
}
else {
if(NETDATA.options.debug.dygraph === true || state.debug === true)
state.log('dygraphChartUpdate() strict update');
options.dateWindow = (state.requested_padding !== null)?[ state.view_after, state.view_before ]:null;
- options.valueRange = null;
+ options.valueRange = state.dygraph_options.valueRange;
options.isZoomedIgnoreProgrammaticZoom = true;
}
xRangePad: self.data('dygraph-xrangepad') || 0,
yRangePad: self.data('dygraph-yrangepad') || 1,
+ valueRange: self.data('dygraph-valuerange') || null,
+
ylabel: state.units,
yLabelWidth: self.data('dygraph-ylabelwidth') || 12,
person_guid: null, // the unique ID of this browser / user
machine_guid: null, // the unique ID the netdata server that served dashboard.js
hostname: null, // the hostname of the netdata server that served dashboard.js
- urls: null, // the user's other URLs
- urls_array: null, // the user's other URLs in an array
+ machines: null, // the user's other URLs
+ machines_array: null, // the user's other URLs in an array
+ person_urls: null,
parsePersonUrls: function(person_urls) {
// console.log(person_urls);
+ NETDATA.registry.person_urls = person_urls;
if(person_urls) {
- NETDATA.registry.urls = {};
- NETDATA.registry.urls_array = new Array();
+ NETDATA.registry.machines = {};
+ NETDATA.registry.machines_array = new Array();
var now = new Date().getTime();
var apu = person_urls;
var i = apu.length;
while(i--) {
- if(typeof NETDATA.registry.urls[apu[i][0]] === 'undefined') {
+ if(typeof NETDATA.registry.machines[apu[i][0]] === 'undefined') {
// console.log('adding: ' + apu[i][4] + ', ' + ((now - apu[i][2]) / 1000).toString());
var obj = {
name: apu[i][4],
alternate_urls: new Array()
};
+ obj.alternate_urls.push(apu[i][1]);
- NETDATA.registry.urls[apu[i][0]] = obj;
- NETDATA.registry.urls_array.push(obj);
+ NETDATA.registry.machines[apu[i][0]] = obj;
+ NETDATA.registry.machines_array.push(obj);
}
else {
// console.log('appending: ' + apu[i][4] + ', ' + ((now - apu[i][2]) / 1000).toString());
- var pu = NETDATA.registry.urls[apu[i][0]];
+ var pu = NETDATA.registry.machines[apu[i][0]];
if(pu.last_t < apu[i][2]) {
pu.url = apu[i][1];
pu.last_t = apu[i][2];
}
if(typeof netdataRegistryCallback === 'function')
- netdataRegistryCallback(NETDATA.registry.urls_array);
+ netdataRegistryCallback(NETDATA.registry.machines_array);
},
init: function() {
return saveLocalStorage('netdataTheme', theme);
}
- var netdataRegistryCallback = function(urls_array) {
+ var netdataRegistryCallback = function(machines_array) {
var el = '';
var a1 = '';
var found = 0;
- if(urls_array) {
+ if(machines_array) {
function name_comparator_desc(a, b) {
if (a.name > b.name) return -1;
if (a.name < b.name) return 1;
return 0;
}
- var urls = urls_array.sort(name_comparator_desc);
- var len = urls.length;
+ var machines = machines_array.sort(name_comparator_desc);
+ var len = machines.length;
while(len--) {
- var u = urls[len];
-
- var status = "enabled";
+ var u = machines[len];
found++;
-
- if(u.guid === NETDATA.registry.machine_guid)
- status = "disabled"
-
- el += '<li id="registry_server_' + u.guid + '" class="' + status + '"><a href="' + u.url + '">' + u.name + '</a></li>';
+ el += '<li id="registry_server_' + u.guid + '"><a href="#" onClick="return gotoServerModalHandler(\'' + u.guid + '\');">' + u.name + '</a></li>';
a1 += '<li id="registry_action_' + u.guid + '"><a href="#" onclick="deleteRegistryModalHandler(\'' + u.guid + '\',\'' + u.name + '\',\'' + u.url + '\'); return false;"><i class="fa fa-trash-o" aria-hidden="true" style="color: #999;"></i></a></li>';
}
}
if(!found) {
- if(urls)
+ if(machines)
el += '<li><a href="https://github.com/firehol/netdata/wiki/mynetdata-menu-item" style="color: #666;" target="_blank">your netdata server list is empty...</a></li>';
else
el += '<li><a href="https://github.com/firehol/netdata/wiki/mynetdata-menu-item" style="color: #666;" target="_blank">failed to contact the registry...</a></li>';
- a1 += '<li><a href="#"> </a></li>';
+ a1 += '<li><a href="#" onClick="return false;"> </a></li>';
el += '<li role="separator" class="divider"></li>' +
'<li><a href="//london.netdata.rocks/default.html">EU - London (DigitalOcean.com)</a></li>' +
</div>
</div>
+ <div class="modal fade" id="gotoServerModal" tabindex="-1" role="dialog" aria-labelledby="gotoServerModalLabel">
+ <div class="modal-dialog" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
+ <h4 class="modal-title" id="gotoServerModalLabel"><span id="gotoServerName"></span></h4>
+ </div>
+ <div class="modal-body">
+ Checking known URLs for this server...
+ <div style="padding-top: 20px;">
+ <table id="gotoServerList">
+ </table>
+ </div>
+ <div id="gotoServerResponse" style="display: block; width: 100%; text-align: center; padding-top: 20px;"></div>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+ </div>
+ </div>
+ </div>
+ </div>
+
<script>
var this_is_demo = null;
function isdemo() {
if(isdemo()) {
document.getElementById('masthead').style.display = 'block';
}
+var gotoServerValidateRemaining = 0;
+function gotoServerValidateUrl(id, guid, url) {
+ setTimeout(function() {
+ document.getElementById('gotoServerList').innerHTML += '<tr><td style="padding-left: 20px;">' + url + '</td><td style="padding-left: 30px;"><code id="' + guid + '-' + id + '-status">checking...</code></td></tr>';
+ NETDATA.registry.hello(url, function(data) {
+ if (data) {
+ console.log('OK ' + id + ' URL: ' + url);
+ document.getElementById(guid + '-' + id + '-status').innerHTML = "OK";
+ document.location = url;
+ }
+ else {
+ document.getElementById(guid + '-' + id + '-status').innerHTML = "failed!";
+ gotoServerValidateRemaining--;
+ if(gotoServerValidateRemaining <= 0)
+ document.getElementById('gotoServerResponse').innerHTML = '<b>Sorry! I cannot find any operational URL for this server</b>';
+ }
+ });
+ }, id * 50);
+}
+
+function gotoServerModalHandler(guid) {
+ console.log('goto server: ' + guid);
+
+ var len = NETDATA.registry.machines[guid].alternate_urls.length;
+
+ document.getElementById('gotoServerResponse').innerHTML = '';
+ document.getElementById('gotoServerList').innerHTML = '';
+ document.getElementById('gotoServerName').innerHTML = NETDATA.registry.machines[guid].name;
+ $('#gotoServerModal').modal('show');
+
+ gotoServerValidateRemaining = len;
+ while(len--)
+ gotoServerValidateUrl(len, guid, NETDATA.registry.machines[guid].alternate_urls[len]);
+
+ return false;
+}
function switchRegistryModalHandler() {
document.getElementById('switchRegistryPersonGUID').value = NETDATA.registry.person_guid;
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <title>NetData Registry Dashboard</title>
+
+ <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, initial-scale=1">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+ <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
+
+ <meta property="og:locale" content="en_US" />
+ <meta property="og:image" content="https://my-netdata.io/images/seo-performance-512.png"/>
+ <meta property="og:url" content="http://my-netdata.io/"/>
+ <meta property="og:type" content="website"/>
+ <meta property="og:site_name" content="netdata"/>
+ <meta property="og:title" content="netdata - real-time performance monitoring, done right!"/>
+ <meta property="og:description" content="Stunning real-time dashboards, blazingly fast and extremely interactive. Zero configuration, zero dependencies, zero maintenance." />
+
+ <script>
+ // this section has to appear before loading dashboard.js
+
+ // Select a theme.
+ // uncomment on of the two themes:
+
+ // var netdataTheme = 'default'; // this is white
+ var netdataTheme = 'slate'; // this is dark
+
+
+ // Set the default netdata server.
+ // on charts without a 'data-host', this one will be used.
+ // the default is the server that dashboard.js is downloaded from.
+
+ // var netdataServer = 'http://my.server:19999/';
+
+ function registryGotoServer(guid) {
+ console.log('goto server: ' + guid);
+ }
+
+ function registryAddServer(u) {
+ return '<div id="registry_server_' + u.guid + '" class="registry-server-container" onClick="registryGotoServer(\'' + u.guid + '\'); return false;">'
+ + '<div class="registry-server-name">' + u.name + '</div>'
+ + '<div data-netdata="system.cpu"'
+ + ' data-host="' + u.url + '"'
+ + ' data-chart-library="sparkline"'
+ + ' data-sparkline-chartrangemin="0"'
+ + ' data-sparkline-chartrangemax="100"'
+ + ' data-sparkline-chartrangeclip="true"'
+ + ' data-sparkline-disabletooltips="true"'
+ + ' data-sparkline-disableinteraction="true"'
+ + ' data-sparkline-disablehighlight="true"'
+ + ' data-sparkline-linecolor="#444"'
+ + ' data-sparkline-spotcolor="disable"'
+ + ' data-sparkline-minspotcolor="disable"'
+ + ' data-sparkline-maxspotcolor="disable"'
+ + ' data-width="100%"'
+ + ' data-height="20px"'
+ + ' data-after="-200"'
+ + '></div>'
+ + '</div>';
+ }
+
+ var netdataRegistryCallback = function(machines_array) {
+ var el = '';
+ var a1 = '';
+ var found = 0;
+
+ if(machines_array) {
+ function name_comparator_desc(a, b) {
+ if (a.name > b.name) return -1;
+ if (a.name < b.name) return 1;
+ return 0;
+ }
+
+ var machines = machines_array.sort(name_comparator_desc);
+ var len = machines.length;
+ while(len--) {
+ var u = machines[len];
+
+ var status = "enabled";
+ found++;
+
+ if(u.guid === NETDATA.registry.machine_guid)
+ status = "disabled"
+
+ el += registryAddServer(u);
+ a1 += '<li id="registry_action_' + u.guid + '"><a href="#" onclick="deleteRegistryModalHandler(\'' + u.guid + '\',\'' + u.name + '\',\'' + u.url + '\'); return false;"><i class="fa fa-trash-o" aria-hidden="true" style="color: #999;"></i></a></li>';
+ }
+ }
+
+ if(!found) {
+ if(machines)
+ el += '<li><a href="https://github.com/firehol/netdata/wiki/mynetdata-menu-item" style="color: #666;" target="_blank">your netdata server list is empty...</a></li>';
+ else
+ el += '<li><a href="https://github.com/firehol/netdata/wiki/mynetdata-menu-item" style="color: #666;" target="_blank">failed to contact the registry...</a></li>';
+
+ a1 += '<li><a href="#"> </a></li>';
+
+ el += '<li role="separator" class="divider"></li>' +
+ '<li><a href="//london.netdata.rocks/default.html">EU - London (DigitalOcean.com)</a></li>' +
+ '<li><a href="//atlanta.netdata.rocks/default.html">US - Atlanta (CDN77.com)</a></li>' +
+ '<li><a href="//athens.netdata.rocks/default.html">EU - Athens</a></li>';
+ a1 += '<li role="separator" class="divider"></li>' +
+ '<li><a href="#"> </a></li>' +
+ '<li><a href="#"> </a></li>'+
+ '<li><a href="#"> </a></li>';
+ }
+
+ el += '<li role="separator" class="divider"></li>';
+ a1 += '<li role="separator" class="divider"></li>';
+
+ el += '<li><a href="https://github.com/firehol/netdata/wiki/mynetdata-menu-item" style="color: #999;" target="_blank">What is this?</a></li>';
+ a1 += '<li><a href="#" style="color: #999;" onclick="switchRegistryModalHandler(); return false;"><i class="fa fa-cog" aria-hidden="true" style="color: #999;"></i></a></li>'
+
+ document.getElementById('mynetdata_servers').innerHTML = el;
+ //document.getElementById('mynetdata_servers2').innerHTML = el;
+ //document.getElementById('mynetdata_actions1').innerHTML = a1;
+ NETDATA.updatedDom();
+ };
+ </script>
+
+ <!--
+ Load dashboard.js
+
+ to host this HTML file on your web server,
+ you have to load dashboard.js from the netdata server.
+
+ So, pick one the two below
+ If you pick the first, set the server name/IP.
+
+ The second assumes you host this file on /usr/share/netdata/web
+ and that you have chown it to be owned by netdata:netdata
+ -->
+ <!-- <script type="text/javascript" src="http://my.server:19999/dashboard.js"></script> -->
+ <script type="text/javascript" src="dashboard.js?v38"></script>
+
+ <script>
+ // Set options for TV operation
+ // This has to be done, after dashboard.js is loaded
+
+ // destroy charts not shown (lowers memory on the browser)
+ NETDATA.options.current.destroy_on_hide = true;
+
+ // set this to false, to always show all dimensions
+ NETDATA.options.current.eliminate_zero_dimensions = true;
+
+ // lower the pressure on this browser
+ NETDATA.options.current.concurrent_refreshes = true;
+
+ // if the tv browser is too slow (a pi?)
+ // set this to false
+ NETDATA.options.current.parallel_refresher = true;
+
+ // always update the charts, even if focus is lost
+ // NETDATA.options.current.stop_updates_when_focus_is_lost = false;
+ </script>
+
+ <style>
+ .registry-container {
+ margin-left: 50px;
+ max-width: 400px;
+ min-width: 200px;
+ border: 1px solid #555;
+ max-height: 80vh;
+ height: auto;
+ overflow-x: hidden;
+ /* background-color: #3a3f44; */
+ text-align: center;
+ }
+ .registry-server-container {
+ width: 100%;
+ height: auto;
+ overflow-x: hidden;
+ font-size: 10px;
+ padding-left: 10px;
+ padding-right: 10px;
+ }
+ .registry-server-container:hover {
+ color: #f5f5f5;
+ background-color: #262626;
+ }
+ .registry-server-name {
+ display: block;
+ text-decoration: none !important;
+ clear: both;
+ font-size: 16px;
+ font-weight: bold;
+ white-space: normal;
+ padding-top: 10px;
+ }
+ </style>
+</head>
+<body>
+
+<div id="mynetdata_servers" class="registry-container" onscroll="NETDATA.onscroll();">
+
+ Loading....
+
+</div> <!-- registry-container -->
+</body>
+</html>