From ad98af3a2be6c87b1f36cec05c8c3529831b7787 Mon Sep 17 00:00:00 2001 From: John Kohl Date: Tue, 24 Oct 2023 22:12:19 -0400 Subject: luci-app-statistics: Add backup/restore for RRD statistics Add a backup/restore capability for rrd data storage in luci_statistics. The data storage is typically in /tmp and does not survive reboot or sysupgrade. This adds an option for the administrator to configure the RRD plugin, so that the RRD data are are preserved with a backup copy in the overlay file system. This works for shutdown/reboot, sysupgrade (backup config files, restore config files, and true sysupgrade). Also fix a bug where starting luci_statistics for the first time would not get a restart a running collectd: during install of the package when it is not included in the base flashed image, collectd might be started when it got installed/configured before this package gets installed/configured. So we need to check if it's running, and restart it to use the luci_statistics configuration. Signed-off-by: John Kohl --- .../htdocs/luci-static/resources/view/statistics/plugins/rrdtool.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'applications/luci-app-statistics/htdocs/luci-static/resources') 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'; -- cgit v1.2.3