diff options
author | Lennart Weller <lhw@ring0.de> | 2016-04-21 12:27:29 +0000 |
---|---|---|
committer | Lennart Weller <lhw@ring0.de> | 2016-04-21 12:27:29 +0000 |
commit | 30b94862648cdbf4f537337d2e2f01c369a9dee9 (patch) | |
tree | f0219dd8bd744fc09899bd0266402e05a4bff854 /web/index.html | |
parent | Imported Upstream version 1.0.0 (diff) | |
download | netdata-30b94862648cdbf4f537337d2e2f01c369a9dee9.tar.xz netdata-30b94862648cdbf4f537337d2e2f01c369a9dee9.zip |
Imported Upstream version 1.1.0upstream/1.1.0
Diffstat (limited to 'web/index.html')
-rw-r--r--[-rwxr-xr-x] | web/index.html | 470 |
1 files changed, 425 insertions, 45 deletions
diff --git a/web/index.html b/web/index.html index 8c86e16c..6f6013da 100755..100644 --- a/web/index.html +++ b/web/index.html @@ -12,7 +12,7 @@ <meta name="author" content="costa@tsaousis.gr"> <link rel="shortcut icon" href="images/seo-performance-multi-size.ico"> - + <link rel="apple-touch-icon" href="images/seo-performance-72.png"> <link rel="apple-touch-icon" sizes="72x72" href="images/seo-performance-72.png"> <link rel="apple-touch-icon" sizes="114x114" href="images/seo-performance-114.png"> @@ -28,7 +28,7 @@ <style> - /* prevent body from hidding under the navbar */ + /* prevent body from hiding under the navbar */ body { padding-top: 50px; } @@ -48,12 +48,12 @@ position: relative; z-index: -2; } - h1:before, h2:before { - display: block; - content: " "; + h1:before, h2:before { + display: block; + content: " "; margin-top: -70px; height: 70px; - visibility: hidden; + visibility: hidden; } .p { @@ -74,7 +74,7 @@ } .chart-message { - display: block; + display: block; margin-top: 10px; } @@ -280,9 +280,57 @@ <!-- you can also give a different server per chart, with the attribute: data-host="http://netdata.server:19999" --> <!-- <script> netdataServer = "http://box:19999"; </script> --> + <!-- check which theme to use --> + <script> + function loadLocalStorage(name) { + var ret = null; + + try { + if(typeof Storage !== "undefined" && typeof localStorage === 'object') + ret = localStorage.getItem(name); + } + catch(error) { + ; + } + + if(typeof ret === 'undefined' || ret === null) + return null; + + return ret; + } + + function saveLocalStorage(name, value) { + try { + if(typeof Storage !== "undefined" && typeof localStorage === 'object') { + localStorage.setItem(name, value.toString()); + return true; + } + } + catch(error) { + ; + } + + return false; + } + + function getTheme(def) { + var ret = loadLocalStorage('netdataTheme'); + if(typeof ret === 'undefined' || ret === null || ret === 'undefined') + return def; + else + return ret; + } + var netdataTheme = getTheme('slate'); + + function setTheme(theme) { + if(theme === netdataTheme) return false; + + return saveLocalStorage('netdataTheme', theme); + } + </script> + <!-- load the dashboard manager - it will do the rest --> - <script>var netdataTheme = 'slate';</script> - <script type="text/javascript" src="dashboard.js?v25"></script> + <script type="text/javascript" src="dashboard.js?v32"></script> </head> <body data-spy="scroll" data-target="#sidebar"> @@ -301,6 +349,7 @@ <ul class="nav navbar-nav"> <li><a href="#" class="btn" data-toggle="modal" data-target="#optionsModal"><i class="fa fa-cog"></i> settings</a></li> <li><a href="https://github.com/firehol/netdata/wiki" class="btn" target="_blank"><i class="fa fa-github"></i> community</a></li> + <li id="updateButton"><a href="#" class="btn" data-toggle="modal" data-target="#updateModal"><i class="fa fa-cloud-download"></i> update</a></li> <!-- <li><a href="old/" class="btn" target="_blank"><i class="fa fa-step-backward"></i> old dashboard</a></li> --> <li><a href="#" class="btn" data-toggle="modal" data-target="#helpModal"><i class="fa fa-question-circle"></i> help</a></li> <!-- <li><a href="#sec">Visualize</a></li> @@ -407,6 +456,9 @@ <i class="fa fa-circle"></i> <a href="http://D3js.org/" target="_blank">D3</a>, <i class="fa fa-copyright"></i> Copyright 2015, Mike Bostock, <a href="http://opensource.org/licenses/BSD-3-Clause" target="_blank">BSD License</a> + <i class="fa fa-circle"></i> <a href="https://github.com/broofa/node-int64" target="_blank">node-int64</a>, + <i class="fa fa-copyright"></i> Copyright 2014, Robert Kieffer, <a href="https://github.com/broofa/node-int64/blob/master/LICENSE" target="_blank">MIT License</a> + </small> </div> </div> @@ -422,7 +474,7 @@ </div> <div class="modal-body"> <div class="p"> - <b><a href="https://github.com/firehol/netdata/wiki" target="_blank">netdata</a></b> is the fastest way to visualize metrics. It is a resource efficient, highly optimized system for collecting and visualizing any type of realtime timeseries data, from CPU usage, disk activity, SQL queries, API calls, web site visitors, etc. + <b><a href="https://github.com/firehol/netdata/wiki" target="_blank">netdata</a></b> is the fastest way to visualize metrics. It is a resource efficient, highly optimized system for collecting and visualizing any type of real-time time series data, from CPU usage, disk activity, SQL queries, API calls, web site visitors, etc. </div> <div class="p"> <b><a href="https://github.com/firehol/netdata/wiki" target="_blank">netdata</a></b> tries to visualize the truth of <b>now</b>, in its <b>greatest detail</b>, so that you can get insights of what is happening now and what just happened, on your systems and applications. @@ -494,7 +546,7 @@ While pressing the shift key, click on the contents of a chart and move the mouse to select an area, to zoom in. The other charts will follow too. Zooming is performed in two phases: <ul> <li>The already loaded chart contents are zoomed (low resolution)</li> - <li>New data are transfered from the netdata server, to refresh the chart with possibly more detail.</li> + <li>New data are transferred from the netdata server, to refresh the chart with possibly more detail.</li> </ul> Once a chart is zoomed, auto refreshing stops for all charts. To enable it again, <b>double click</b> a zoomed chart. </div> @@ -508,9 +560,9 @@ <hr/> <div class="p"> <h4>Legend Operations</h4> - Click on the label or value of a dimension, will select / unselect this dimension. + Click on the label or value of a dimension, will select / un-select this dimension. <br/> - You can press any of the SHIFT or CONTROL keys and then click on legend labels or values, to select / unselect multiple dimensions. + You can press any of the SHIFT or CONTROL keys and then click on legend labels or values, to select / un-select multiple dimensions. </div> </div> <div role="tabpanel" class="tab-pane" id="help_touch"> @@ -544,7 +596,7 @@ <hr/> <div class="p"> <h4>Legend Operations</h4> - Tap on the label or value of a dimension, will select / unselect this dimension. + Tap on the label or value of a dimension, will select / un-select this dimension. </div> </div> </div> @@ -565,9 +617,11 @@ </div> <div class="modal-body"> <center> - <small style="color: #BBBBBB;">Settings take effect immediately and are saved permanently to browser local storage (except the refresh on focus / always option). + <small style="color: #BBBBBB;">These are browser settings. Each viewer has its own. They do not affect the operation of your netdata server. <br/> - To reset all options (including charts sizes) to their defaults, click <a href="#" onclick="NETDATA.resetOptions(); return false;">here</a>.</small> + Settings take effect immediately and are saved permanently to browser local storage (except the refresh on focus / always option). + <br/> + To reset all options (including charts sizes) to their defaults, click <a href="#" onclick="resetDashboardOptions(); return false;">here</a>.</small> </center> <div style="padding: 10px;"></div> @@ -581,7 +635,7 @@ <!-- Tab panes --> <div class="tab-content"> <div role="tabpanel" class="tab-pane active" id="settings_performance"> - <form id="optionsForm" method="get" class="form-horizontal"> + <form id="optionsForm1" method="get" class="form-horizontal"> <div class="form-group"> <table> <tr class="option-row"> @@ -595,7 +649,7 @@ <input id="eliminate_zero_dimensions" type="checkbox" checked data-toggle="toggle" data-on="Non Zero" data-off="All" data-width="110px"> </td> <td class="option-info"><strong>Which dimensions to show?</strong><br/> - <small>When set to <b>Non Zero</b>, dimensions that have all their values (within the current view) set to zero will not be transfered from the netdata server (except if all dimensions of the chart are zero, in which case this setting does nothing - all dimensions are transfered and shown). When set to <b>All</b>, all dimensions will always be shown. Set it to <b>Non Zero</b> to lower the data transfered between netdata and your browser, lower the CPU requirements of your browser (fewer lines to draw) and increase the focus on the legends (fewer entries at the legends).</small> + <small>When set to <b>Non Zero</b>, dimensions that have all their values (within the current view) set to zero will not be transferred from the netdata server (except if all dimensions of the chart are zero, in which case this setting does nothing - all dimensions are transferred and shown). When set to <b>All</b>, all dimensions will always be shown. Set it to <b>Non Zero</b> to lower the data transferred between netdata and your browser, lower the CPU requirements of your browser (fewer lines to draw) and increase the focus on the legends (fewer entries at the legends).</small> </td> </tr> <tr class="option-row"> @@ -609,13 +663,13 @@ </form> </div> <div role="tabpanel" class="tab-pane" id="settings_sync"> - <form id="optionsForm" method="get" class="form-horizontal"> + <form id="optionsForm2" method="get" class="form-horizontal"> <div class="form-group"> <table> <tr class="option-row"> - <td class="option-control"><input id="parallel_refresher" type="checkbox" checked data-toggle="toggle" data-on="Parallel" data-off="Sequencial" data-width="110px"></td> + <td class="option-control"><input id="parallel_refresher" type="checkbox" checked data-toggle="toggle" data-on="Parallel" data-off="Sequential" data-width="110px"></td> <td class="option-info"><strong>Which chart refresh policy to use?</strong><br/> - <small>When set to <b>parallel</b>, visible charts are refreshed in parallel (all queries are sent to netdata server in parallel) and are rendered asynchronously. When set to <b>sequencial</b> charts are refreshed one after another. Set it to parallel if your browser can cope with it (most modern browsers do), set it to sequencial if you work on an older/slower computer.</small> + <small>When set to <b>parallel</b>, visible charts are refreshed in parallel (all queries are sent to netdata server in parallel) and are rendered asynchronously. When set to <b>sequential</b> charts are refreshed one after another. Set it to parallel if your browser can cope with it (most modern browsers do), set it to sequential if you work on an older/slower computer.</small> </td> </tr> <tr class="option-row" id="concurrent_refreshes_row"> @@ -651,10 +705,28 @@ </form> </div> <div role="tabpanel" class="tab-pane" id="settings_visual"> - <form id="optionsForm" method="get" class="form-horizontal"> + <form id="optionsForm3" method="get" class="form-horizontal"> <div class="form-group"> <table> <tr class="option-row"> + <td class="option-control"><input id="netdata_theme_control" type="checkbox" checked data-toggle="toggle" data-offstyle="danger" data-onstyle="success" data-on="Dark" data-off="White" data-width="110px"></td> + <td class="option-info"><strong>Which theme to use?</strong><br/> + <small>Netdata comes with two themes: <b>Dark</b> (the default) and <b>White</b>. + <br/> + <b>Switching this will reload the dashboard</b>. + </small> + </td> + </tr> + <tr class="option-row"> + <td class="option-control"><input id="show_help" type="checkbox" checked data-toggle="toggle" data-on="Help Me" data-off="No Help" data-width="110px"></td> + <td class="option-info"><strong>Do you need help?</strong><br/> + <small>Netdata can show some help in some areas to help you use the dashboard. If all these balloons bother you, disable them using this switch. + <br/> + <b>Switching this will reload the dashboard</b>. + </small> + </td> + </tr> + <tr class="option-row"> <td class="option-control"><input id="pan_and_zoom_data_padding" type="checkbox" checked data-toggle="toggle" data-on="Pad" data-off="Don't Pad" data-width="110px"></td> <td class="option-info"><strong>Enable data padding when panning and zooming?</strong><br/> <small>When set to <b>Pad</b> the charts will be padded with more data, both before and after the visible area, thus giving the impression the whole database is loaded. This padding will happen only after the first pan or zoom operation on the chart (initially all charts have only the visible data). When set to <b>Don't Pad</b> only the visible data will be transfered from the netdata server, even after the first pan and zoom operation.</small> @@ -663,7 +735,9 @@ <tr class="option-row"> <td class="option-control"><input id="smooth_plot" type="checkbox" checked data-toggle="toggle" data-on="Smooth" data-off="Rough" data-width="110px"></td> <td class="option-info"><strong>Enable Bézier lines on charts?</strong><br/> - <small>When set to <b>Smooth</b> the charts libraries that support it, will plot smooth curves instead of simple straight lines to connect the points.</small> + <small>When set to <b>Smooth</b> the charts libraries that support it, will plot smooth curves instead of simple straight lines to connect the points. + <br/> + Keep in mind <a href="http://dygraphs.com" target="_blank">dygraphs</a>, the main charting library in netdata dashboards, can only smooth line charts. It cannot smooth area or stacked charts. When set to <b>Rough</b>, this setting can lower the CPU resources consumed by your browser.</small> </td> </tr> </table> @@ -679,14 +753,47 @@ </div> </div> -</body> -</html> + + <div class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="updateModalLabel"> + <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="updateModalLabel">Update Check</h4> + </div> + <div class="modal-body"> + Your netdata version: <b><code><span id="netdataVersion">Unknown</span></code></b> + <br/> + <div style="padding: 10px;"></div> + <div id="versionCheckLog">Not checked yet. Please press the Check Now button.</div> + </div> + <div class="modal-footer"> + <a href="#" onclick="notifyForUpdate(true);" type="button" class="btn btn-default">Check Now</a> + <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> + </div> + </div> + </div> + </div> + <script> -var demo_hostname = 'netdata.firehol.org'; -// var demo_hostname = 'box'; +var this_is_demo = null; +function isdemo() { + if(this_is_demo !== null) return this_is_demo; + this_is_demo = false; + + try { + if(typeof document.location.hostname === 'string') + this_is_demo = document.location.hostname.endsWith('.firehol.org'); + } + catch(error) { + ; + } -if(document.location.hostname === demo_hostname) { + return this_is_demo; +} + +if(isdemo()) { document.getElementById('masthead').style.display = 'block'; } @@ -768,10 +875,10 @@ function sortObjectByPriority(object) { function gaugeChart(title, width, dimensions, colors) { if(typeof colors === 'undefined') colors = ''; - + if(typeof dimensions === 'undefined') dimensions = ''; - + return '<div data-netdata="CHART_UNIQUE_ID"' + ' data-dimensions="' + dimensions + '"' + ' data-chart-library="gauge"' @@ -813,6 +920,11 @@ var menuData = { info: undefined }, + 'ipv6': { + title: 'IPv6 Networking', + info: undefined + }, + 'ipvs': { title: 'IP Virtual Server', info: undefined @@ -850,7 +962,19 @@ var menuData = { 'apps': { title: 'Applications', - info: 'Per application statistics are collected using netdata\'s <code>apps.plugin</code>. This plugin walks through the entire <code>/proc</code> filesystem and aggregates statistics for applications of interest, defined in <code>/etc/netdata/apps_groups.conf</code> (the default is <a href="https://github.com/firehol/netdata/blob/master/conf.d/apps_groups.conf" target="_blank">here</a>). The plugin internaly builds a process tree (much like <code>ps fax</code> does), and groups processes together (evaluating both child and parent processes) so that the result is always a chart with a predefined set of dimensions (of course, only application groups found running are reported).<br/><b>IMPORTANT</b>: The values shown here are not 100% accurate. They only include values for the processes running. If an application is spawning childs continiously, which are terminated in just a few milliseconds (like shell scripts do), the values reported will be inaccurate. Linux does report the values for the exited childs of a process. However, these values are reported to the parent process <b>only when the child exits</b>. If these values, of the exited child processes, were also aggregated in the charts below, the charts would have been full of spikes, presenting unrealisting utilization for each process group. So, we decided to ignore these values and present only the utilization of <b>the currently running processes</b>.', + info: 'Per application statistics are collected using netdata\'s <code>apps.plugin</code>. This plugin walks through the entire <code>/proc</code> filesystem and aggregates statistics for applications of interest, defined in <code>/etc/netdata/apps_groups.conf</code> (the default is <a href="https://github.com/firehol/netdata/blob/master/conf.d/apps_groups.conf" target="_blank">here</a>). The plugin internally builds a process tree (much like <code>ps fax</code> does), and groups processes together (evaluating both child and parent processes) so that the result is always a chart with a predefined set of dimensions (of course, only application groups found running are reported).<br/><b>IMPORTANT</b>: The values shown here are not 100% accurate. They only include values for the processes running. If an application is spawning children continuously, which are terminated in just a few milliseconds (like shell scripts do), the values reported will be inaccurate. Linux does report the values for the exited children of a process. However, these values are reported to the parent process <b>only when the child exits</b>. If these values, of the exited child processes, were also aggregated in the charts below, the charts would have been full of spikes, presenting unrealistic utilization for each process group. So, we decided to ignore these values and present only the utilization of <b>the currently running processes</b>.', + height: 1.5 + }, + + 'users': { + title: 'Users', + info: 'Per user statistics are collected using netdata\'s <code>apps.plugin</code>. This plugin walks through the entire <code>/proc</code> filesystem and aggregates statistics per user.<br/><b>IMPORTANT</b>: The values shown here are not 100% accurate. They only include values for the processes running. If an application is spawning children continuously, which are terminated in just a few milliseconds (like shell scripts do), the values reported will be inaccurate. Linux does report the values for the exited children of a process. However, these values are reported to the parent process <b>only when the child exits</b>. If these values, of the exited child processes, were also aggregated in the charts below, the charts would have been full of spikes, presenting unrealistic utilization for each process group. So, we decided to ignore these values and present only the utilization of <b>the currently running processes</b>.', + height: 1.5 + }, + + 'groups': { + title: 'User Groups', + info: 'Per user group statistics are collected using netdata\'s <code>apps.plugin</code>. This plugin walks through the entire <code>/proc</code> filesystem and aggregates statistics per user group.<br/><b>IMPORTANT</b>: The values shown here are not 100% accurate. They only include values for the processes running. If an application is spawning children continuously, which are terminated in just a few milliseconds (like shell scripts do), the values reported will be inaccurate. Linux does report the values for the exited children of a process. However, these values are reported to the parent process <b>only when the child exits</b>. If these values, of the exited child processes, were also aggregated in the charts below, the charts would have been full of spikes, presenting unrealistic utilization for each process group. So, we decided to ignore these values and present only the utilization of <b>the currently running processes</b>.', height: 1.5 }, @@ -868,7 +992,22 @@ var menuData = { var submenuData = { 'mem.ksm': { title: 'Memory Deduper', - info: 'Kernel Same-page Merging (KSM) is the kernel memory de-duper.' + info: 'Kernel Same-page Merging (KSM) performance monitoring, read from several files in <code>/sys/kernel/mm/ksm/</code>. KSM is a memory-saving de-duplication feature in the Linux kernel (since version 2.6.32). The KSM daemon ksmd periodically scans those areas of user memory which have been registered with it, looking for pages of identical content which can be replaced by a single write-protected page (which is automatically copied if a process later wants to update its content). KSM was originally developed for use with KVM (where it was known as Kernel Shared Memory), to fit more virtual machines into physical memory, by sharing the data common between them. But it can be useful to any application which generates many instances of the same data.' + }, + + 'netfilter.conntrack': { + title: 'Connection Tracker', + info: 'Netfilter Connection Tracker performance monitoring, read from <code>/proc/net/stat/nf_conntrack</code>. The connection tracker keeps track of all connections of the machine, inbound and outbound. It works by keeping a database with all open connections, tracking network and address translation and connection expectations.' + }, + + 'netfilter.nfacct': { + title: 'Bandwidth Accounting', + info: 'The following information is read using the <code>nfacct.plugin</code>.' + }, + + 'netfilter.synproxy': { + title: 'DDoS Protection', + info: 'DDoS Protection performance monitoring read from <code>/proc/net/stat/synproxy</code>. <a href="https://github.com/firehol/firehol/wiki/Working-with-SYNPROXY" target="_blank">SYNPROXY</a> is a TCP SYN packets proxy. It is used to protect any TCP server (like a web server) from SYN floods and similar DDoS attacks. It is a netfilter module, in the Linux kernel (since version 3.12). It is optimized to handle millions of packets per second utilizing all CPUs available without any concurrency locking between the connections. It can be used for any kind of TCP traffic (even encrypted), since it does not interfere with the content itself.' } }; @@ -931,11 +1070,15 @@ var chartData = { 'system.idlejitter': { colors: '#5555AA', - info: 'Idle jitter is calculated by netdata. A thread is spawned that requests to sleep for a few microseconds. When the system wakes it up, it measures how many microseconds have passed. The different between the requested and the actual duration of the sleep, is the <b>idle jitter</b>. This number is useful in realtime environments, where CPU jitter can affect the quality of the service (like VoIP media gateways).' + info: 'Idle jitter is calculated by netdata. A thread is spawned that requests to sleep for a few microseconds. When the system wakes it up, it measures how many microseconds have passed. The difference between the requested and the actual duration of the sleep, is the <b>idle jitter</b>. This number is useful in real-time environments, where CPU jitter can affect the quality of the service (like VoIP media gateways).' }, 'system.ipv4': { - info: 'Total IPv4 Traffic, read from <code>/proc/net/netstat</code>. This includes <code>lo</code> device traffic.' + info: 'Total IPv4 Traffic, read from <code>/proc/net/netstat</code>.' + }, + + 'system.ipv6': { + info: 'Total IPv6 Traffic, read from <code>/proc/net/snmp6</code>.' }, 'system.ram': { @@ -986,6 +1129,30 @@ var chartData = { height: 2.0 }, + 'users.cpu': { + height: 2.0 + }, + + 'users.preads': { + height: 2.0 + }, + + 'users.pwrites': { + height: 2.0 + }, + + 'groups.cpu': { + height: 2.0 + }, + + 'groups.preads': { + height: 2.0 + }, + + 'groups.pwrites': { + height: 2.0 + }, + 'tc.qos': { heads: [ function(id) { @@ -1135,7 +1302,7 @@ function menuTitle(menu) { } function menuInfo(menu) { - return anyAttribute(menuData, 'title', menu, null); + return anyAttribute(menuData, 'info', menu, null); } function menuHeight(menu, relative) { @@ -1190,11 +1357,22 @@ function enrichChartData(chart) { case 'tc': chart.menu = tmp; - // find the interface name from the name - if(typeof options.submenu_names[chart.family] === 'undefined' || options.submenu_names[chart.family] === chart.family) - options.submenu_names[chart.family] = chart.name.split('.')[1].split('_')[0]; + // find a name for this device from fireqos info + // we strip '_(in|out)' or '(in|out)_' + if(typeof options.submenu_names[chart.family] === 'undefined' || options.submenu_names[chart.family] === chart.family) { + var n = chart.name.split('.')[1]; + if(n.endsWith('_in')) + options.submenu_names[chart.family] = n.slice(0, n.lastIndexOf('_in')); + else if(n.endsWith('_out')) + options.submenu_names[chart.family] = n.slice(0, n.lastIndexOf('_out')); + else if(n.startsWith('in_')) + options.submenu_names[chart.family] = n.slice(3, n.length); + else if(n.startsWith('out_')) + options.submenu_names[chart.family] = n.slice(4, n.length); + } // increase the priority of IFB devices + // to have inbound appear before outbound if(chart.id.match(/.*-ifb$/)) chart.priority--; @@ -1296,6 +1474,29 @@ function headMain(charts, duration) { + ' data-points="' + duration.toString() + '"' + ' role="application"></div>'; } + else if(typeof charts['system.ipv6'] !== 'undefined') { + head += '<div style="margin-right: 10px;" data-netdata="system.ipv6"' + + ' data-dimensions="received"' + + ' data-chart-library="easypiechart"' + + ' data-title="IPv6 Inbound"' + + ' data-units="kbps"' + + ' data-width="10%"' + + ' data-before="0"' + + ' data-after="-' + duration.toString() + '"' + + ' data-points="' + duration.toString() + '"' + + ' role="application"></div>'; + + head += '<div style="margin-right: 10px;" data-netdata="system.ipv6"' + + ' data-dimensions="sent"' + + ' data-chart-library="easypiechart"' + + ' data-title="IPv6 Outbound"' + + ' data-units="kbps"' + + ' data-width="10%"' + + ' data-before="0"' + + ' data-after="-' + duration.toString() + '"' + + ' data-points="' + duration.toString() + '"' + + ' role="application"></div>'; + } if(typeof charts['system.ram'] !== 'undefined') head += '<div style="margin-right: 10px;" data-netdata="system.ram"' @@ -1433,7 +1634,7 @@ function renderChartsAndMenu(data) { height: menuHeight(charts[c].menu, options.chartsHeight) }; } - + if(charts[c].priority < menus[charts[c].menu].priority) menus[charts[c].menu].priority = charts[c].priority; @@ -1447,7 +1648,7 @@ function renderChartsAndMenu(data) { height: submenuHeight(charts[c].menu, charts[c].submenu, menus[charts[c].menu].height) }; } - + if(charts[c].priority < menus[charts[c].menu].submenus[charts[c].submenu].priority) menus[charts[c].menu].submenus[charts[c].submenu].priority = charts[c].priority; @@ -1484,7 +1685,7 @@ function downloadAllCharts(netdata_url) { document.getElementById('hostname').innerHTML = options.hostname; document.getElementById('hostname').href = NETDATA.serverDefault; document.title = options.hostname + ' dashboard'; - + renderChartsAndMenu(data); // prepare our DOM @@ -1498,6 +1699,141 @@ function downloadAllCharts(netdata_url) { // ---------------------------------------------------------------------------- +function versionLog(msg) { + document.getElementById('versionCheckLog').innerHTML = msg; +} + +function getNetdataVersion(callback) { + versionLog('Downloading installed version info from netdata...'); + + $.ajax({ + url: 'version.txt', + async: true, + cache: false + }) + .done(function(data) { + data = data.replace(/(\r\n|\n|\r| |\t)/gm,""); + if(data.length !== 40) { + versionLog('Received version string is invalid.'); + callback(null); + } + else { + versionLog('Installed version of netdata is ' + data); + document.getElementById('netdataVersion').innerHTML = data; + callback(data); + } + }) + .fail(function() { + versionLog('Failed to download installed version info from netdata!'); + callback(null); + }); +} + +function getGithubLatestCommit(callback) { + versionLog('Downloading latest version info from github...'); + + $.ajax({ + url: 'https://api.github.com/repos/firehol/netdata/commits', + async: true, + cache: false + }) + .done(function(data) { + versionLog('Latest version info from github is ' + data[0].sha); + callback(data[0].sha); + }) + .fail(function() { + versionLog('Failed to download installed version info from github!'); + callback(null); + }); +} + +function checkForUpdate(callback) { + getNetdataVersion(function(sha1) { + if(sha1 === null) callback(null, null); + + getGithubLatestCommit(function(sha2) { + callback(sha1, sha2); + }); + }); + + return null; +} + +var updateBlinkCounter = 0; +function notifyForUpdate(force) { + versionLog('<p>checking for updates...</p>'); + + var now = new Date().getTime(); + + if(typeof force === 'undefined' || force !== true) { + var last = loadLocalStorage('last_update_check'); + + if(typeof last === 'string') + last = parseInt(last); + else + last = 0; + + if(now - last < 3600000 * 8) { + // no need to check it - too soon + return; + } + } + + checkForUpdate(function(sha1, sha2) { + var save = false; + + if(sha1 === null) { + save = false; + versionLog('<p><big>Failed to get your netdata version!</big></p><p>You can always get the latest version of netdata from <a href="https://github.com/firehol/netdata" target="_blank">its github page</a>.</p>'); + } + else if(sha2 === null) { + save = false; + versionLog('<p><big>Failed to get the latest version from github.</big></p><p>You can always get the latest version of netdata from <a href="https://github.com/firehol/netdata" target="_blank">its github page</a>.</p>'); + } + else if(sha1 === sha2) { + save = true; + versionLog('<p><big>You already have the latest version of netdata!</big></p><p>No update yet?<br/>Probably, we need some motivation to keep going on!</p><p>If you haven\'t already, <a href="https://github.com/firehol/netdata" target="_blank">give netdata a <b>Star</b> at its github page</a>.</p>'); + } + else { + save = true; + var compare = 'https://github.com/firehol/netdata/compare/' + sha1.toString() + '...' + sha2.toString(); + + versionLog('<p><big><strong>New version of netdata available!</strong></big></p><p>Latest version: ' + sha2.toString() + '</p><p><a href="' + compare + '" target="_blank">Click here for the changes log</a> since your installed version, and<br/><a href="https://github.com/firehol/netdata/wiki/Updating-Netdata" target="_blank">click here for directions on updating</a> your netdata installation.</p><p>We suggest to review the changes log for new features you may be interested, or important bug fixes you may need.<br/>Keeping your netdata updated, is generally a good idea.</p>'); + + function updateButtonBlink() { + updateBlinkCounter--; + if(updateBlinkCounter > 0) + $('#updateButton').fadeOut(500).fadeIn(500, updateButtonBlink); + } + + if(updateBlinkCounter === 0) { + updateBlinkCounter = 300; + updateButtonBlink(); + } + } + + if(save) + saveLocalStorage('last_update_check', now.toString()); + }); +} + +// ---------------------------------------------------------------------------- + +function getUrlParameter(sParam) { + var sPageURL = decodeURIComponent(window.location.search.substring(1)), + sURLVariables = sPageURL.split('&'), + sParameterName, + i; + + for (i = 0; i < sURLVariables.length; i++) { + sParameterName = sURLVariables[i].split('='); + + if (sParameterName[0] === sParam) { + return sParameterName[1] === undefined ? true : sParameterName[1]; + } + } +} + function finalizePage() { // resize all charts - without starting the background thread // this has to be done while NETDATA is paused @@ -1505,6 +1841,13 @@ function finalizePage() { // the Dom elements are initially zero-sized NETDATA.parseDom(); + var before = 0, after = 0; + after = getUrlParameter('force_after_ms'); + before = getUrlParameter('force_before_ms'); + + if(before > 0 && after > 0) + NETDATA.globalPanAndZoom.setMaster(NETDATA.options.targets[0], after, before); + // let it run (update the charts) NETDATA.unpause(); @@ -1521,7 +1864,7 @@ function finalizePage() { /* activate bootstrap sidebar (affix) */ $('#sidebar').affix({ offset: { - top: (document.location.hostname === demo_hostname)?150:0, + top: (isdemo())?150:0, bottom: 0 } }); @@ -1532,7 +1875,7 @@ function finalizePage() { $('#sidebar').on('affixed.bs.affix', function() { $(this).removeAttr('style'); }); - + /* activate bootstrap scrollspy (needed for sidebar) */ $(document.body).scrollspy({ target: '#sidebar', @@ -1554,6 +1897,12 @@ function finalizePage() { } } + var theme_sync_option = function(option) { + var self = $('#' + option); + + self.bootstrapToggle(netdataTheme === 'slate'?'on':'off'); + } + sync_option('eliminate_zero_dimensions'); sync_option('destroy_on_hide'); sync_option('parallel_refresher'); @@ -1563,6 +1912,8 @@ function finalizePage() { sync_option('stop_updates_when_focus_is_lost'); sync_option('smooth_plot'); sync_option('pan_and_zoom_data_padding'); + sync_option('show_help'); + theme_sync_option('netdata_theme_control'); if(NETDATA.getOption('parallel_refresher') === false) { $('#concurrent_refreshes_row').hide(); @@ -1583,13 +1934,42 @@ function finalizePage() { $('#stop_updates_when_focus_is_lost').change(function() { NETDATA.setOption('stop_updates_when_focus_is_lost', $(this).prop('checked')); }); $('#smooth_plot').change(function() { NETDATA.setOption('smooth_plot', $(this).prop('checked')); }); $('#pan_and_zoom_data_padding').change(function() { NETDATA.setOption('pan_and_zoom_data_padding', $(this).prop('checked')); }); - - if(document.location.hostname === demo_hostname) + $('#show_help').change(function() { NETDATA.setOption('show_help', $(this).prop('checked')); location.reload(); }); + + // this has to be the last + // it reloads the page + $('#netdata_theme_control').change(function() { + if(setTheme($(this).prop('checked')?'slate':'default')) + location.reload(); + }); + + if(isdemo()) { setTimeout(function() { $('#welcomeModal').modal(); }, 1000); + } + else + notifyForUpdate(); + + $('#updateModal').on('shown.bs.modal', function() { + notifyForUpdate(true); + }); +} + +function resetDashboardOptions() { + var help = NETDATA.options.current.show_help; + + NETDATA.resetOptions(); + if(setTheme('slate')) + location.reload(); + + if(help !== NETDATA.options.current.show_help) + location.reload(); } downloadAllCharts(); </script> + +</body> +</html> |