int enable_ksm = 1;
volatile sig_atomic_t netdata_exit = 0;
+const char *os_type = NETDATA_OS_TYPE;
// ----------------------------------------------------------------------------
// memory allocation functions that handle failures
#if defined(__FreeBSD__)
#include "plugin_freebsd.h"
+#define NETDATA_OS_TYPE "freebsd"
#elif defined(__APPLE__)
#include "plugin_macos.h"
+#define NETDATA_OS_TYPE "macos"
#else
#include "plugin_proc.h"
#include "plugin_proc_diskspace.h"
+#define NETDATA_OS_TYPE "linux"
#endif /* __FreeBSD__, __APPLE__*/
#include "plugin_tc.h"
extern unsigned int hz;
extern void get_system_HZ(void);
+extern volatile sig_atomic_t netdata_exit;
+extern const char *os_type;
/* fix for alpine linux */
#ifndef RUSAGE_THREAD
#ifndef NETDATA_MAIN_H
#define NETDATA_MAIN_H 1
-extern volatile sig_atomic_t netdata_exit;
-
/**
* This struct contains information about command line options.
*/
buffer_sprintf(wb, "{\n"
"\t\"hostname\": \"%s\""
+ ",\n\t\"os\": \"%s\""
",\n\t\"update_every\": %d"
",\n\t\"history\": %d"
",\n\t\"charts\": {"
, localhost.hostname
+ , os_type
, rrd_update_every
, rrd_default_history_entries
);
}
else if(isgreaterequal(abs, 10)) len = snprintfz(value_string, value_string_len, "%0.1Lf", (long double) value);
else if(isgreaterequal(abs, 1)) len = snprintfz(value_string, value_string_len, "%0.2Lf", (long double) value);
- else if(isgreaterequal(abs, 0.1)) len = snprintfz(value_string, value_string_len, "%0.3Lf", (long double) value);
+ else if(isgreaterequal(abs, 0.1)) len = snprintfz(value_string, value_string_len, "%0.2Lf", (long double) value);
else len = snprintfz(value_string, value_string_len, "%0.4Lf", (long double) value);
if(unlikely(trim_zeros)) {
__legendFormatValueChartDecimalsLastMin = min;
__legendFormatValueChartDecimalsLastMax = max;
- if(this.value_decimal_detail !== -1) {
+ if(this.data !== null && this.data.min === this.data.max)
+ __legendFormatValueChartDecimals = -1;
+
+ else if(this.value_decimal_detail !== -1)
__legendFormatValueChartDecimals = this.value_decimal_detail;
- }
+
else {
var delta;
if (delta > 1000) __legendFormatValueChartDecimals = 0;
else if (delta > 10) __legendFormatValueChartDecimals = 1;
else if (delta > 1) __legendFormatValueChartDecimals = 2;
- else if (delta > 0.1) __legendFormatValueChartDecimals = 3;
+ else if (delta > 0.1) __legendFormatValueChartDecimals = 2;
else __legendFormatValueChartDecimals = 4;
}
};
if(abs > 1000) dmax = 0;
else if(abs > 10 ) dmax = 1;
else if(abs > 1) dmax = 2;
- else if(abs > 0.1) dmax = 3;
+ else if(abs > 0.1) dmax = 2;
else dmax = 4;
}
else {
dygraph.updateOptions(options);
}
- // decide the decimal points on the legend of the chart
- state.legendFormatValueDecimalsFromMinMax(
- state.dygraph_instance.axes_[0].extremeRange[0],
- state.dygraph_instance.axes_[0].extremeRange[1]
- );
-
state.dygraph_last_rendered = Date.now();
return true;
};
state.__commonMax = null;
}
- // decide the decimal points on the legend of the chart
- state.legendFormatValueDecimalsFromMinMax(
- state.dygraph_instance.axes_[0].extremeRange[0],
- state.dygraph_instance.axes_[0].extremeRange[1]
- );
-
return true;
};
'system.softnet_stat': {
title: 'softnet',
- info: 'Statistics for CPUs SoftIRQs related to network receive work. Break down per CPU core can be found at <a href="#menu_cpu_submenu_softnet_stat">CPU / softnet statistics</a>. <b>processed</b> states the number of packets processed, <b>dropped</b> is the number packets dropped because the network device backlog was full (to fix them use <code>sysctl</code> to increase <code>net.core.netdev_max_backlog</code>), <b>squeezed</b> is the number of packets dropped because the network device budget ran out (to fix them use <code>sysctl</code> to increase <code>net.core.netdev_budget</code>). More information about identifying and troubleshooting network driver related issues can be found at <a href="https://access.redhat.com/sites/default/files/attachments/20150325_network_performance_tuning.pdf" target="_blank">Red Hat Enterprise Linux Network Performance Tuning Guide</a>.'
+ info: function(os) {
+ if(os === 'linux')
+ return 'Statistics for CPUs SoftIRQs related to network receive work. Break down per CPU core can be found at <a href="#menu_cpu_submenu_softnet_stat">CPU / softnet statistics</a>. <b>processed</b> states the number of packets processed, <b>dropped</b> is the number packets dropped because the network device backlog was full (to fix them on Linux use <code>sysctl</code> to increase <code>net.core.netdev_max_backlog</code>), <b>squeezed</b> is the number of packets dropped because the network device budget ran out (to fix them on Linux use <code>sysctl</code> to increase <code>net.core.netdev_budget</code>). More information about identifying and troubleshooting network driver related issues can be found at <a href="https://access.redhat.com/sites/default/files/attachments/20150325_network_performance_tuning.pdf" target="_blank">Red Hat Enterprise Linux Network Performance Tuning Guide</a>.';
+ else
+ return 'Statistics for CPUs SoftIRQs related to network receive work.';
+ }
},
'cpu.softnet_stat': {
title: 'softnet',
- info: 'Statistics for per CPUs core SoftIRQs related to network receive work. Total for all CPU cores can be found at <a href="#menu_system_submenu_softnet_stat">System / softnet statistics</a>. <b>processed</b> states the number of packets processed, <b>dropped</b> is the number packets dropped because the network device backlog was full (to fix them use <code>sysctl</code> to increase <code>net.core.netdev_max_backlog</code>), <b>squeezed</b> is the number of packets dropped because the network device budget ran out (to fix them use <code>sysctl</code> to increase <code>net.core.netdev_budget</code>). More information about identifying and troubleshooting network driver related issues can be found at <a href="https://access.redhat.com/sites/default/files/attachments/20150325_network_performance_tuning.pdf" target="_blank">Red Hat Enterprise Linux Network Performance Tuning Guide</a>.'
+ info: function(os) {
+ if(os === 'linux')
+ return 'Statistics for per CPUs core SoftIRQs related to network receive work. Total for all CPU cores can be found at <a href="#menu_system_submenu_softnet_stat">System / softnet statistics</a>. <b>processed</b> states the number of packets processed, <b>dropped</b> is the number packets dropped because the network device backlog was full (to fix them on Linux use <code>sysctl</code> to increase <code>net.core.netdev_max_backlog</code>), <b>squeezed</b> is the number of packets dropped because the network device budget ran out (to fix them on Linux use <code>sysctl</code> to increase <code>net.core.netdev_budget</code>). More information about identifying and troubleshooting network driver related issues can be found at <a href="https://access.redhat.com/sites/default/files/attachments/20150325_network_performance_tuning.pdf" target="_blank">Red Hat Enterprise Linux Network Performance Tuning Guide</a>.';
+ else
+ return 'Statistics for per CPUs core SoftIRQs related to network receive work. Total for all CPU cores can be found at <a href="#menu_system_submenu_softnet_stat">System / softnet statistics</a>.';
+ }
}
};
//
netdataDashboard.context = {
'system.cpu': {
- info: function() {
+ info: function(os) {
+ void(os);
return 'Total CPU utilization (all cores). 100% here means there is no CPU idle time at all. You can get per core usage at the <a href="#menu_cpu">CPUs</a> section and per application usage at the <a href="#menu_apps">Applications Monitoring</a> section.'
+ netdataDashboard.sparkline('<br/>Keep an eye on <b>iowait</b> ', 'system.cpu', 'iowait', '%', '. If it is constantly high, your disks are a bottleneck and they slow your system down.')
+ netdataDashboard.sparkline('<br/>An important metric worth monitoring, is <b>softirq</b> ', 'system.cpu', 'softirq', '%', '. A constantly high percentage of softirq may indicate network driver issues.');
'mem.ksm_ratios': {
heads: [
- function(id) {
+ function(os, id) {
+ void(os);
return '<div data-netdata="' + id + '"'
+ ' data-gauge-max-value="100"'
+ ' data-chart-library="gauge"'
'tc.qos': {
heads: [
- function(id) {
+ function(os, id) {
+ void(os);
+
if(id.match(/.*-ifb$/))
return netdataDashboard.gaugeChart('Inbound', '12%', '', '#5555AA');
else
'apache.workers': {
mainheads: [
- function(id) {
+ function(os, id) {
+ void(os);
return '<div data-netdata="' + id + '"'
+ ' data-dimensions="busy"'
+ ' data-append-options="percentage"'
'retroshare.peers': {
info: 'Number of (connected) RetroShare friends.',
mainheads: [
- function(id) {
+ function(os, id) {
+ void(os);
return '<div data-netdata="' + id + '"'
+ ' data-dimensions="peers_connected"'
+ ' data-append-options="friends"'
var netdataDashboard = {
sparklines_registry: {},
+ os: 'unknown',
menu: {},
submenu: {},
if(typeof(x) === 'undefined')
return def;
- if(typeof(x) === 'function')
- return x();
+ if(typeof(x) === 'function') {
+ return x(netdataDashboard.os);
+ }
return x;
}
// ----------------------------------------------------------------------------
- function headMain(charts, duration) {
+ function headMain(os, charts, duration) {
+ void(os);
+
var head = '';
if(typeof charts['system.swap'] !== 'undefined')
var hi = 0, hlen = hcharts.length;
while(hi < hlen) {
if(typeof hcharts[hi] === 'function')
- head += hcharts[hi](chart.id).replace('CHART_DURATION', duration.toString()).replace('CHART_UNIQUE_ID', chart.id);
+ head += hcharts[hi](netdataDashboard.os, chart.id).replace('CHART_DURATION', duration.toString()).replace('CHART_UNIQUE_ID', chart.id);
else
head += hcharts[hi].replace('CHART_DURATION', duration.toString()).replace('CHART_UNIQUE_ID', chart.id);
hi++;
var duration = Math.round(($(div).width() * pcent_width / 100 * data.update_every / 3) / 60) * 60;
var html = '';
var sidebar = '<ul class="nav dashboard-sidenav" data-spy="affix" id="sidebar_ul">';
- var mainhead = headMain(data.charts, duration);
+ var mainhead = headMain(netdataDashboard.os, data.charts, duration);
// sort the menus
var main = sortObjectByPriority(menus);
if(data !== null) {
options.hostname = data.hostname;
options.data = data;
+ netdataDashboard.os = data.os;
// update the dashboard hostname
document.getElementById('hostname').innerHTML = options.hostname;
});
NETDATA.requiredJs.push({
- url: NETDATA.serverDefault + 'dashboard_info.js?v20170207-12',
+ url: NETDATA.serverDefault + 'dashboard_info.js?v20170208-6',
async: false,
isAlreadyLoaded: function() { return false; }
});
</div>
</body>
</html>
-<script type="text/javascript" src="dashboard.js?v20170205-39"></script>
+<script type="text/javascript" src="dashboard.js?v20170208-6"></script>