diff options
Diffstat (limited to 'applications/luci-app-statistics/htdocs')
9 files changed, 423 insertions, 119 deletions
diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/dsl.js b/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/dsl.js new file mode 100644 index 0000000000..87e2d989e4 --- /dev/null +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/dsl.js @@ -0,0 +1,193 @@ +/* Licensed to the public under the Apache License 2.0. */ + +'use strict'; + +return L.Class.extend({ + title: _('DSL'), + + rrdargs: function(graph, host, plugin, plugin_instance, dtype) { + var g = []; + var dtypes = graph.dataTypes(host, plugin, plugin_instance); + + const d_snr = { + title: _("DSL Signal"), + vlabel: "dB", + data: { + types: ["snr"], + options: { + snr_latn_up: { + title: _("Line Attenuation Up (LATN)"), + noarea: true, + overlay: true + }, + snr_latn_down: { + title: _("Line Attenuation Down (LATN)"), + noarea: true, + overlay: true + }, + snr_satn_up: { + title: _("Signal Attenuation Up (SATN)"), + noarea: true, + overlay: true + }, + snr_satn_down: { + title: _("Signal Attenuation Down (SATN)"), + noarea: true, + overlay: true + }, + snr_snr_up: { + title: _("Noise Margin Up (SNR)"), + noarea: true, + overlay: true + }, + snr_snr_down: { + title: _("Noise Margin Down (SNR)"), + noarea: true, + overlay: true + }, + } + } + }; + const d_uptime = { + title: _("DSL Line Uptime"), + vlabel: "seconds", + data: { + types: ["uptime"], + options: { + uptime: { + title: _("Uptime"), + noarea: true + } + } + } + }; + const d_flags = { + title: _("DSL Flags"), + data: { + instances: { + bool: [ + "bitswap_up", + "bitswap_down", + "vector_up", + "vector_down" + ] + }, + options: { + bool_bitswap_up: { + title: _("Bitswap Up"), + noarea: true, + overlay: true + }, + bool_bitswap_down: { + title: _("Bitswap Down"), + noarea: true, + overlay: true + }, + bool_vector_up: { + title: _("Vectoring Up"), + noarea: true, + overlay: true + }, + bool_vector_down: { + title: _("Vectoring Down"), + noarea: true, + overlay: true + }, + } + } + }; + const d_bitrate = { + title: _("Bitrate"), + vlabel: "b/s", + data: { + instances: { + bitrate: [ + "attndr_up", + "attndr_down", + "data_rate_up", + "data_rate_down" + ] + }, + options: { + bitrate_attndr_up: { + title: _("Max. Attainable Data Rate (ATTNDR) Up"), + noarea: true, + overlay: true + }, + bitrate_attndr_down: { + title: _("Max. Attainable Data Rate (ATTNDR) Down"), + noarea: true, + overlay: true + }, + bitrate_data_rate_up: { + title: _("Data Rate Up"), + noarea: true, + overlay: true + }, + bitrate_data_rate_down: { + title: _("Data Rate Down"), + noarea: true, + overlay: true + } + } + } + }; + const d_count = { + title: _("Errors"), + vlabel: "count", + data: { + types: ["errors"], + options: { + errors_rx_corrupted_far: { + title: _("Rx Corrupted Far"), + noarea: true, + overlay: true + }, + errors_rx_corrupted_near: { + title: _("Rx Corrupted Near"), + noarea: true, + overlay: true + }, + errors_rx_retransmitted_far: { + title: _("Rx Retransmitted Far"), + noarea: true, + overlay: true + }, + errors_tx_retransmitted_far: { + title: _("Tx Retransmitted Far"), + noarea: true, + overlay: true + }, + errors_rx_retransmitted_near: { + title: _("Rx Retransmitted Near"), + noarea: true, + overlay: true + }, + errors_tx_retransmitted_near: { + title: _("Tx Retransmitted Near"), + noarea: true, + overlay: true + }, + } + } + }; + + if (dtypes.includes("snr")) { + g.push(d_snr); + } + if (dtypes.includes("uptime")) { + g.push(d_uptime); + } + if (dtypes.includes("bool")) { + g.push(d_flags); + } + if (dtypes.includes("bitrate")) { + g.push(d_bitrate); + } + if (dtypes.includes("count")) { + g.push(d_count); + } + + return g; + } +}); diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/memory.js b/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/memory.js index 9b0d179b0a..960d98c108 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/memory.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/memory.js @@ -5,12 +5,14 @@ 'use strict'; 'require baseclass'; +'require uci'; return baseclass.extend({ title: _('Memory'), rrdargs: function(graph, host, plugin, plugin_instance, dtype) { var p = []; + var hide_free = uci.get("luci_statistics", "collectd_memory", "HideFree") == "1" ? true : false; var memory = { title: "%H: Memory usage", @@ -21,7 +23,7 @@ return baseclass.extend({ data: { instances: { memory: [ - "free", + ...(hide_free ? [] : ["free"]), "buffered", "cached", "used" @@ -58,7 +60,7 @@ return baseclass.extend({ data: { instances: { percent: [ - "free", + ...(hide_free ? [] : ["free"]), "buffered", "cached", "used" diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/nut.js b/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/nut.js index 5d7a92f7fb..dbd25f6c07 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/nut.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/nut.js @@ -7,125 +7,150 @@ return baseclass.extend({ title: _('UPS'), rrdargs: function(graph, host, plugin, plugin_instance, dtype) { - var voltages_ac = { - title: "%H: AC voltages on UPS \"%pi\"", - vlabel: "V", - number_format: "%5.1lfV", - data: { - instances: { - voltage: [ "input", "output" ] - }, - options: { - voltage_output : { color: "00e000", title: "Output voltage", noarea: true, overlay: true }, - voltage_input : { color: "ffb000", title: "Input voltage", noarea: true, overlay: true } + var definitions = []; + var instances; + + function find_instances(dtype, wanted) { + var matching = graph.dataInstances(host, plugin, plugin_instance, dtype).filter(function(instance) { + return wanted.indexOf(instance) > -1; + }); + + return matching.length ? { [dtype]: matching } : null; + } + + if ((instances = find_instances('voltage', [ 'input', 'output' ])) != null) { + definitions.push({ + title: "%H: AC voltages on UPS \"%pi\"", + vlabel: "V", + number_format: "%5.1lfV", + data: { + instances: instances, + options: { + voltage_output : { color: "00e000", title: "Output voltage", noarea: true, overlay: true }, + voltage_input : { color: "ffb000", title: "Input voltage", noarea: true, overlay: true } + } + } + }); + } + + if ((instances = find_instances('voltage', [ 'battery' ])) != null) { + definitions.push({ + title: "%H: Battery voltage on UPS \"%pi\"", + vlabel: "V", + number_format: "%5.1lfV", + data: { + instances: instances, + options: { + voltage: { color: "0000ff", title: "Battery voltage", noarea: true, overlay: true } + } } - } - }; + }); + } - var voltages_dc = { - title: "%H: Battery voltage on UPS \"%pi\"", - vlabel: "V", - number_format: "%5.1lfV", - data: { - instances: { - voltage: [ "battery" ] - }, - options: { - voltage: { color: "0000ff", title: "Battery voltage", noarea: true, overlay: true } + if ((instances = find_instances('current', [ 'battery', 'output' ])) != null) { + definitions.push({ + title: "%H: Current on UPS \"%pi\"", + vlabel: "A", + number_format: "%5.3lfA", + data: { + instances: instances, + options: { + current_output : { color: "00e000", title: "Output current", noarea: true, overlay: true }, + current_battery: { color: "0000ff", title: "Battery current", noarea: true, overlay: true } + } } - } - }; + }); + } - var currents = { - title: "%H: Current on UPS \"%pi\"", - vlabel: "A", - number_format: "%5.3lfA", - data: { - instances: { - current: [ "battery", "output" ] - }, - options: { - current_output : { color: "00e000", title: "Output current", noarea: true, overlay: true }, - current_battery: { color: "0000ff", title: "Battery current", noarea: true, overlay: true } + if ((instances = find_instances('percent', [ 'charge', 'load' ])) != null) { + definitions.push({ + title: "%H: Battery charge/load on UPS \"%pi\"", + vlabel: "Percent", + y_min: "0", + y_max: "100", + number_format: "%5.1lf%%", + data: { + instances: instances, + options: { + percent_charge: { color: "00ff00", title: "Charge level", noarea: true, overlay: true }, + percent_load: { color: "ff0000", title: "Load", noarea: true, overlay: true } + } } - } - }; + }); + } - var percentage = { - title: "%H: Battery charge/load on UPS \"%pi\"", - vlabel: "Percent", - y_min: "0", - y_max: "100", - number_format: "%5.1lf%%", - data: { - instances: { - percent: [ "charge", "load" ] - }, - options: { - percent_charge: { color: "00ff00", title: "Charge level", noarea: true, overlay: true }, - percent_load: { color: "ff0000", title: "Load", noarea: true, overlay: true } + if ((instances = find_instances('temperature', [ 'battery' ])) != null) { + /* Note: This is in ISO8859-1 for rrdtool. Welcome to the 20th century. */ + definitions.push({ + title: "%H: Battery temperature on UPS \"%pi\"", + vlabel: "\u00b0C", + number_format: "%5.1lf\u00b0C", + data: { + instances: instances, + options: { + temperature_battery: { color: "ffb000", title: "Battery temperature", noarea: true } + } } - } - }; + }); + } - /* Note: This is in ISO8859-1 for rrdtool. Welcome to the 20th century. */ - var temperature = { - title: "%H: Battery temperature on UPS \"%pi\"", - vlabel: "\u00b0C", - number_format: "%5.1lf\u00b0C", - data: { - instances: { - temperature: "battery" - }, - options: { - temperature_battery: { color: "ffb000", title: "Battery temperature", noarea: true } + if ((instances = find_instances('timeleft', [ 'battery' ])) != null) { + definitions.push({ + title: "%H: Time left on UPS \"%pi\"", + vlabel: "Minutes", + number_format: "%.1lfm", + data: { + instances: instances, + options: { + timeleft_battery: { color: "0000ff", title: "Time left", transform_rpn: "60,/", noarea: true } + } } - } - }; + }); + } - var timeleft = { - title: "%H: Time left on UPS \"%pi\"", - vlabel: "Minutes", - number_format: "%.1lfm", - data: { - instances: { - timeleft: [ "battery" ] - }, - options: { - timeleft_battery: { color: "0000ff", title: "Time left", transform_rpn: "60,/", noarea: true } + if ((instances = find_instances('power', [ 'watt-ups' ])) != null) { + definitions.push({ + title: "%H: Power on UPS \"%pi\"", + vlabel: "Watt", + number_format: "%5.1lf%%", + data: { + instances: instances, + options: { + ['power_watt-ups']: { color: "00ff00", title: "Power level (Watt)" } + } } - } - }; + }); + } - var power = { - title: "%H: Power on UPS \"%pi\"", - vlabel: "Power", - number_format: "%5.1lf%%", - data: { - instances: { - power: [ "ups" ] - }, - options: { - power_ups: { color: "00ff00", title: "Power level" } + if ((instances = find_instances('power', [ 'ups' ])) != null) { + definitions.push({ + title: "%H: Power on UPS \"%pi\"", + vlabel: "VA", + number_format: "%5.1lf%%", + data: { + instances: instances, + options: { + power_ups: { color: "00ff00", title: "Power level (VA)" } + } } - } - }; + }); + } - var frequencies = { - title: "%H: Frequencies on UPS \"%pi\"", - vlabel: "Hz", - number_format: "%5.1lfHz", - data: { - instances: { - frequency: [ "input", "output" ] - }, - options: { - frequency_output : { color: "00e000", title: "Output frequency", noarea: true, overlay: true }, - frequency_input : { color: "ffb000", title: "Input frequency", noarea: true, overlay: true } + if ((instances = find_instances('frequency', [ 'input', 'output' ])) != null) { + definitions.push({ + title: "%H: Frequencies on UPS \"%pi\"", + vlabel: "Hz", + number_format: "%5.1lfHz", + data: { + instances: instances, + options: { + frequency_output : { color: "00e000", title: "Output frequency", noarea: true, overlay: true }, + frequency_input : { color: "ffb000", title: "Input frequency", noarea: true, overlay: true } + } } - } - }; + }); + } - return [ voltages_ac, voltages_dc, currents, percentage, temperature, timeleft, power, frequencies ]; + return definitions; } }); diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/sensors.js b/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/sensors.js index 3da1bcfd82..f612e39f6b 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/sensors.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/sensors.js @@ -44,6 +44,74 @@ return baseclass.extend({ } }); } + if (types.indexOf('voltage') > -1) { + rv.push({ + per_instance: true, + title: "%H: %pi - %di", + vlabel: "V", + number_format: "%4.1lf V", + data: { + types: [ "voltage" ], + options: { + voltage__value: { + color: "0000ff", + title: "Voltage" + } + } + } + }); + } + if (types.indexOf('current') > -1) { + rv.push({ + per_instance: true, + title: "%H: %pi - %di", + vlabel: "A", + number_format: "%4.1lf A", + data: { + types: [ "current" ], + options: { + current__value: { + color: "00ff00", + title: "Current" + } + } + } + }); + } + if (types.indexOf('power') > -1) { + rv.push({ + per_instance: true, + title: "%H: %pi - %di", + vlabel: "W", + number_format: "%4.1lf W", + data: { + types: [ "power" ], + options: { + power__value: { + color: "ff0000", + title: "Power" + } + } + } + }); + } + if (types.indexOf('fanspeed') > -1) { + rv.push({ + per_instance: true, + title: "%H: %pi - %di", + vlabel: "rpm", + number_format: "%4lf rpm", + data: { + types: [ "fanspeed" ], + options: { + fanspeed__value: { + color: "0000ff", + title: "Fan speed" + } + } + } + }); + } return rv; } diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/graphs.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/graphs.js index a3189143eb..db24d18592 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/graphs.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/graphs.js @@ -182,7 +182,7 @@ return view.extend({ E('button', { 'class': 'cbi-button', 'click': function(ev) { location.href = 'collectd' } - }, [ _('Setup collectd') ]) + }, [ _('Set up collectd') ]) ]) ]); }, diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/memory.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/memory.js index a4a8eb2761..864857faa3 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/memory.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/memory.js @@ -11,6 +11,11 @@ return baseclass.extend({ o = s.option(form.Flag, 'enable', _('Enable this plugin')); + o = s.option(form.Flag, 'HideFree', _('Hide free memory'), + _('Hiding the free memory item makes the graph to scale to actual memory usage, not to 100%.')); + o.default = '0'; + o.rmempty = false; + o = s.option(form.Flag, 'ValuesAbsolute', _('Absolute values'), _('When set to true, we request absolute values')); o.default = '1'; o.depends('enable', '1'); diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/rrdtool.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/rrdtool.js index e971e2c6c4..7e2704a2c3 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/rrdtool.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/rrdtool.js @@ -16,6 +16,11 @@ return baseclass.extend({ o.default = '/tmp/rrd'; o.depends('enable', '1'); + o = s.option(form.Flag, 'backup', _('Backup RRD statistics'), + _('Backup and restore RRD statistics to/from non-volatile storage around shutdown, reboot, and/or sysupgrade')); + o.default = '0'; + o.depends('enable', '1'); + o = s.option(form.Value, 'StepSize', _('RRD step interval'), _('Seconds')); o.placeholder = '30'; o.datatype = 'uinteger'; diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/sensors.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/sensors.js index a1a2472654..a55be1f4f4 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/sensors.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/sensors.js @@ -9,6 +9,7 @@ var sensorTypes = [ /^(?:cpu_temp|remote_temp|temp)[0-9]*$/, 'temperature', /^(?:fan)[0-9]*$/, 'fanspeed', /^(?:humidity)[0-9]*$/, 'humidity', + /^(?:curr)[0-9]*$/, 'current', /^(?:power)[0-9]*$/, 'power' ]; diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/tcpconns.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/tcpconns.js index 84471ebb87..526b10f3c3 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/tcpconns.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/tcpconns.js @@ -19,25 +19,30 @@ return baseclass.extend({ o = s.option(form.DynamicList, 'LocalPorts', _('Monitor local ports')); o.optional = true; o.datatype = 'port'; - o.default = '22 80'; - o.depends({ enable: '1', ListeningPorts: '0' }); + o.default = '22'; + o.depends('enable', '1'); o = s.option(form.DynamicList, 'RemotePorts', _('Monitor remote ports')); o.optional = true; o.datatype = 'port'; - o.depends({ enable: '1', ListeningPorts: '0' }); + o.depends('enable', '1'); + + o = s.option(form.Flag, 'AllPortsSummary', _('Summary of all ports')); + o.rmempty = false; + o.depends('enable', '1'); }, configSummary: function(section) { var lports = L.toArray(section.LocalPorts), - rports = L.toArray(section.RemotePorts); - - if (section.ListeningPorts == '1') - return _('Monitoring local listen ports'); - else - return _('Monitoring %s and %s').format( - N_(lports.length, 'one local port', '%d local ports').format(lports.length), - N_(rports.length, 'one remote port', '%d remote ports').format(rports.length) - ); + rports = L.toArray(section.RemotePorts), + listen = section.ListeningPorts == '1', + summary = section.AllPortsSummary == '1'; + + return _('Monitoring %s and %s, %s %s').format( + N_(lports.length, 'one local', '%d local').format(lports.length), + N_(rports.length, 'one remote port', '%d remote ports').format(rports.length), + listen ? _('all local listening ports,') : '', + summary ? _('summary of all ports') : _('no summary') + ); } }); |